From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938683AbdAKQ6C (ORCPT ); Wed, 11 Jan 2017 11:58:02 -0500 Received: from mail.fireflyinternet.com ([109.228.58.192]:52390 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S937856AbdAKQ6B (ORCPT ); Wed, 11 Jan 2017 11:58:01 -0500 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Date: Wed, 11 Jan 2017 16:57:32 +0000 From: Chris Wilson To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Waiman Long , Andrew Morton , Linus Torvalds , "Paul E . McKenney" , Thomas Gleixner Subject: Re: [PATCH] locking/mutex: Clear mutex-handoff flag on interrupt Message-ID: <20170111165731.GB16278@nuc-i3427.alporthouse.com> References: <20161007150211.196801561@infradead.org> <20170109115203.2750-1-chris@chris-wilson.co.uk> <20170111164302.GA3051@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170111164302.GA3051@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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@gmail.com > > 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