[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-sparc/37930: sparc mutex stubs are broken on MP
>Synopsis: sparc mutex stubs are broken on MP
>Arrival-Date: Thu Jan 31 11:45:01 +0000 2008
>Originator: Andrew Doran
The NetBSD Project
The sparc mutex stubs are broken on MP systems. Usually they
work like this:
- grab the mutex interlock
- that suceeds, so set the full owning LWP address into mtx_owner
On an MP system the following can occur:
cpu2 acquire kernel_lock
cpu1 grab mutex interlock
cpu1 device interrupt occurs before setting mtx_owner
cpu1 spin on kernel_lock trying to process device interrupt
cpu2 spin or block trying to acquire mutex 'half held' by cpu1
-> potentially deadlock
- Implement 'restart' for mutex_enter() in all the interrupt stubs.
This would be very tricky.
- Change the sparc to __HAVE_SIMPLE_MUTEXES.
- Use atomic_cas_ptr() to acquire and release mutexes.
- Work on optimizing atomic_cas_ptr().
I'll create a patch.
Main Index |
Thread Index |