From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753704AbbCGEoo (ORCPT ); Fri, 6 Mar 2015 23:44:44 -0500 Received: from cantor2.suse.de ([195.135.220.15]:52760 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752863AbbCGEok (ORCPT ); Fri, 6 Mar 2015 23:44:40 -0500 Message-ID: <1425703470.19505.111.camel@stgolabs.net> Subject: Re: softlockups in multi_cpu_stop From: Davidlohr Bueso To: Jason Low Cc: Linus Torvalds , Ingo Molnar , tim.c.chen@linux.intel.com, paulmck@linux.vnet.ibm.com, Sasha Levin , Peter Zijlstra , LKML , Dave Jones , Ming Lei Date: Fri, 06 Mar 2015 20:44:30 -0800 In-Reply-To: <1425702688.2475.363.camel@j-VirtualBox> References: <54F41516.6060608@oracle.com> <54F98F1F.3080107@oracle.com> <20150306123233.GA9972@gmail.com> <1425662342.19505.41.camel@stgolabs.net> <1425668223.2475.94.camel@j-VirtualBox> <1425670188.2475.113.camel@j-VirtualBox> <1425676346.2475.135.camel@j-VirtualBox> <1425702688.2475.363.camel@j-VirtualBox> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2015-03-06 at 20:31 -0800, Jason Low wrote: > On Fri, 2015-03-06 at 13:12 -0800, Jason Low wrote: > > Just in case, here's the updated patch which addresses Linus's comments > and with a changelog. > > Note: The changelog says that it fixes (locking/rwsem: Avoid deceiving > lock spinners), though I still haven't seen full confirmation that it > addresses all of the lockup reports. > > ------ > Subject: [PATCH] rwsem: Avoid spinning when owner is not running > > Fixes tip commmit b3fd4f03ca0b (locking/rwsem: Avoid deceiving lock spinners). > > When doing optimistic spinning in rwsem, threads should stop spinning when > the lock owner is not running. While a thread is spinning on owner, if > the owner reschedules, owner->on_cpu returns false and we stop spinning. > > However, commit b3fd4f03ca0b essentially caused the check to get ignored > because when we break out of the spin loop due to !on_cpu, we continue > spinning if sem->owner != NULL. I would mention the actual effects of the bug, either just a "lockup" and/or a fragment of the trace. But ultimately this comes down to missing a need_resched() condition. > > This patch fixes this by making sure we stop spinning if the owner is not > running. Furthermore, just like with mutexes, refactor the code such that > we don't have separate checks for owner_running(). This makes it more > straightforward in terms of why we exit the spin on owner loop and we > would also avoid needing to "guess" why we broke out of the loop to make > this more readable. > > Cc: Ming Lei > Cc: Davidlohr Bueso Acked-by: Davidlohr Bueso