MIPS deadlock bug fix

Maxim Kizub M.Kizub at post.skynet.lt
Wed Jan 10 01:09:31 PST 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Walter,

Wednesday, January 10, 2001, 8:52:51 AM, you wrote:


SW> Hello Godmar,

SW> It's good to know that someone is listening who can do
SW> something with the comment.

>>>
>>> With this fix I seem to have no more unexpected deadlocks.
>>> Just to be on the safe side, does anyone know of similar
>>> "supposed to be atomic" operations?
>>>
>>
>> Not that, but we've repeatedly pointed out that the CMPEXCH
>> in locks.c in broken.  By now, we've wasted more time discussing
>> this subject than it would take to just remove, so below it goes.
>>
>> I didn't put in your generic version in order to encourage
>> you and others to look through your MIPS manual and submit a
>> working md version. We don't want to make kaffe too easy to port
>> ;-)  

SW> I known my MIPS manual by hart. Unfortunately, an original R3000
SW> processor core has no instructions to provide an atomic exchange
or
SW> an atomic compare and exchange. I there were, I definitely would
have
SW> used that as that seemed to be the proper action. Maybe an R4000
SW> (which has a store conditional instruction) might be able to do
this,
SW> but on an R3000 you are really out of luck. If I hadn't used the
SW> "jthread_suspendall" call then I would have to switch to kernel
mode
SW> to disable interrupts....

>> #error Please define COMPARE_AND_EXCHANGE or ATOMIC_EXCHANGE

SW> I agree that this is better than the broken macro. It would have
saved me
SW> the time I spent in finding the problem. Yet COMPARE_AND_EXCHANGE
SW> is only defined for i386 architectures and ATOMIC_EXCHANGE is
never
SW> defined (at least in the Kaffe 1.0.6 sources). So a working
backup solution
SW> might not be that bad. And some embedded/old processor cores
simply
SW> don't have these very convenient instructions.

Probably, you can use something like:

disable_interrupts
compare and exchange
enable_interrupts

?

- --
Best regards,
 Maxim                            mailto:M.Kizub at post.skynet.lt

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5i

iQA/AwUBOlwY6Ow5enpENJF+EQLE0QCghN2sgi5XhwXrUfK9RkFFPhyluPYAoMyl
alA7yi/3MwfvD1adtg2Jp64o
=cRei
-----END PGP SIGNATURE-----




More information about the kaffe mailing list