From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030872AbbKEB5f (ORCPT ); Wed, 4 Nov 2015 20:57:35 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:37831 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030498AbbKEB5e (ORCPT ); Wed, 4 Nov 2015 20:57:34 -0500 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Wed, 4 Nov 2015 17:57:24 -0800 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Dave Jones , Linux Kernel , Ingo Molnar , Stephane Eranian , Andi Kleen Subject: Re: perf related lockdep bug Message-ID: <20151105015724.GA29027@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20151104051717.GA6098@codemonkey.org.uk> <20151104102151.GG17308@twins.programming.kicks-ass.net> <20151104102800.GZ11639@twins.programming.kicks-ass.net> <20151104140133.GA32021@linux.vnet.ibm.com> <20151104143419.GY3604@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151104143419.GY3604@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15110501-0009-0000-0000-00000F7D9C68 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 04, 2015 at 03:34:19PM +0100, Peter Zijlstra wrote: > On Wed, Nov 04, 2015 at 06:01:33AM -0800, Paul E. McKenney wrote: > > On Wed, Nov 04, 2015 at 11:28:00AM +0100, Peter Zijlstra wrote: > > > On Wed, Nov 04, 2015 at 11:21:51AM +0100, Peter Zijlstra wrote: > > > > > > > The problem appears to be due to the new RCU expedited grace period > > > > stuff, with rcu_read_unlock() now randomly trying to acquire locks it > > > > previously didn't. > > > > > > > > Lemme go look at those rcu bits again.. > > > > > > Paul, I think this is because of: > > > > > > 8203d6d0ee78 ("rcu: Use single-stage IPI algorithm for RCU expedited grace period") > > > > > > What happens is that the IPI comes in and tags any random > > > rcu_read_unlock() with the special bit, which then goes on and takes > > > locks. > > > > > > Now the problem is that we have scheduler activity inside this lock; > > > the one reported lockdep seems easy enough to fix, see below. > > > > > > I'll got and see if there's more sites than can cause this. > > > > This one only happens during boot time, but it would be good hygiene > > in any case. May I have your SOB on this? > > Of course, > > Signed-off-by: Peter Zijlstra (Intel) Thank you, applied as shown below. Thanx, Paul ------------------------------------------------------------------------ commit 05faf451f1239a28fcd63bf4b66c0db57d7b13f9 Author: Peter Zijlstra Date: Wed Nov 4 08:22:05 2015 -0800 rcu: Move wakeup out from under rnp->lock This patch removes a potential deadlock hazard by moving the wake_up_process() in rcu_spawn_gp_kthread() out from under rnp->lock. Signed-off-by: Peter Zijlstra Signed-off-by: Paul E. McKenney diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index caf3651fa5c9..183445959d00 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -4323,8 +4323,8 @@ static int __init rcu_spawn_gp_kthread(void) sp.sched_priority = kthread_prio; sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); } - wake_up_process(t); raw_spin_unlock_irqrestore(&rnp->lock, flags); + wake_up_process(t); } rcu_spawn_nocb_kthreads(); rcu_spawn_boost_kthreads();