Re: [PATCH] locking/mutex: Clear mutex-handoff flag on interrupt
From: Chris Wilson
Date: Wed Jan 11 2017 - 11:58:05 EST
On Wed, Jan 11, 2017 at 05:43:02PM +0100, Peter Zijlstra wrote:
> On Mon, Jan 09, 2017 at 11:52:03AM +0000, Chris Wilson wrote:
> > If we abort the mutex_lock() due to an interrupt, or other error from
>
> s/interrupt/signal/, right?
Yes. EINTR is ingrained.
> > ww_mutex, we need to relinquish the handoff flag if we applied it.
> > Otherwise, we may cause missed wakeups as the current owner may try to
> > handoff to a new thread that is not expecting the handoff and so sleep
> > thinking the lock is already claimed (and since the owner unlocked there
> > may never be a new wakeup).
>
> Isn't that the exact same scenario as Nicolai fixed here:
>
> http://lkml.kernel.org/r/1482346000-9927-3-git-send-email-nhaehnle@xxxxxxxxx
>
> Did you, like Nicolai, find this by inspection, or can you reproduce?
Looks like it should be. It takes about 20 minutes of running a stress
test, but it is very reliably hit on the current kernel.
> FWIW, I have the below patch that should also solve this problem afaict.
Thanks, I shall see if makes my machines happy.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre