tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mutexes, locks and so on...

On 11/17/10 05:03, matthew green wrote:
- hppa seems to have a mutex implemented without cas.  is it broken?

FWIW, the sparc implementation is only broken on SMP.

Did they use their own mutex_enter and mutex_spin_enter? If so, it might be that the fact that mutex_vector_enter has it's own implementation of mutex_spin_lock, which might have been incompatible with the sparc code that caused it to break.

I've seen cases of a spin mutex being taken through mutex_vector_enter, and then released through mutex_spin_exit. I have no clue on how on earth the taking of a spin mutex managed through to mutex_vector_enter, since mutex_enter explicitly checkes for spin mutexes first, and calls mutex_spin_enter in that case, and mutex_spin_enter never calls mutex_vector_enter.

But it still happened. I verified this with my own mutex implementation for VAX. After I changed the mutex_vector_enter code to duplicate what I do in mutex_spin_enter, mutex_spin_exit never more got called with mutexes that would appear to be free, so there is obviously some code path that manage to bypass mutex_enter and mutex_spin_enter, and directly end up in mutex_vector_enter for spin mutexes.

So, I was thinking if that could have bitten the sparc code? In the UP case, the essential part is always only the rising of the SPL, so even if the implementations are incompatible, chances are that the system will survive. In the MP case, you really need to do things correct, and if the mutex_spin_enter mismatch mutex_vector_enter, you could end up with two cpus both being able to grab a spin mutex.


Home | Main Index | Thread Index | Old Index