tech-kern archive

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

Re: compat linux futex locking problem



On Mon, Jun 02, 2008 at 04:35:15PM +0200, Roman Divacky wrote:
> On Mon, Jun 02, 2008 at 10:07:55AM +0200, Nicolas Joly wrote:
> > 
> > While testing some threaded apps under amd64 NTPL linux emulation, i
> > discovered a locking problem with our futex implementation.
> > 
> > In most cases, futex_get() is called from linux_sys_futex() without
> > lock held, but there is one extra call in futex_wake() where the futex
> > lock is already hold ... leading to a panic.
> > 
> > I'm not sure about the correct way to fix it (i'm not a locking
> > specialist) and wanted to ask.
> > 
> > In the mean time, i checked the corresponding code in FreeBSD which
> > added an extra argument to futex_get to record if the lock is already
> > hold. But that does not seems right to me, especially because
> > futex_get() can sleep for quite some time due to a call to
> > kmem_zalloc(x, KM_SLEEP).
> 
> yes indeed... we use sleepable lock in the futex_get() so it's ok it
> can sleep.

We recently switched from old kernel locks to mutexes. But a closer
look to mutex(9) seems to show that IPL_NONE types are allowed to
sleep. Maybe i'll try that way too ...

> We have some more fixes to the futexes you still have not
> incorporated. I am sure you want to import those....
> 
> feel free to contact me in private to discuss those fixes

Will do. Thanks.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index