[Cbe-oss-dev] [RFC] [PATCH 3:8] SPU Gang Scheduling - Change cbe_spu_info[] mutex to spin lock

Luke Browning lukebr at linux.vnet.ibm.com
Wed Mar 5 04:41:00 EST 2008


On Tue, 2008-03-04 at 06:31 +0100, Arnd Bergmann wrote:
> On Monday 03 March 2008, Luke Browning wrote:
> > Change the mutex_lock protecting the cbe_spu_info[] to a spin_lock.
> > 
> > This structure groups the physical spus. The list_mutex must be changed 
> > to a spin lock, because the runq_lock is a spin_lock.  You can't nest 
> > mutexes under spin_locks.  The lock for the cbe_spu_info[] is taken 
> > under the runq_lock as may spus need to be allocated to schedule a gang.
> > 
> > Change spu_bind_context() and spu_unbind_context() so that they are not 
> > called under the new spin lock as that would cause a deadlock, if they
> > blocked on higher level allocations (mmap) that are protected by mutexes.
> > 
> > Signed-off-by: Luke Browning <lukebrowning at us.ibm.com>
> 
> Have you checked whether there are places in the code where we
> currently take the runq_lock inside of the list_mutex?  If so,
> we certainly need to change that code to avoid AB-BA type dead
> locks. 

It doesn't happen today.

> 
> Would it be possible to turn the runq_lock into a mutex to get
> them to nest in the right order?

That's a possibility, but I don't think it is the right thing to do.
Both locks are held for very short periods of time and protect key
system resources. I think the extra latency of lock sleep / wakeup 
would be very noticeable in spu scheduling.


Luke




More information about the cbe-oss-dev mailing list