From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932828Ab1LFB0s (ORCPT ); Mon, 5 Dec 2011 20:26:48 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:63362 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932780Ab1LFB0r (ORCPT ); Mon, 5 Dec 2011 20:26:47 -0500 Date: Tue, 6 Dec 2011 09:26:35 +0800 From: Yong Zhang To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, patches@linaro.org Subject: Re: [PATCH RFC tip/core/rcu 7/7] rcu: Quiet RCU-lockdep warnings involving interrupt disabling Message-ID: <20111206012635.GA32498@zhy> Reply-To: Yong Zhang References: <20111203183417.GA18914@linux.vnet.ibm.com> <1322937282-19846-7-git-send-email-paulmck@linux.vnet.ibm.com> <20111205091924.GA28117@zhy> <20111205164505.GB2326@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20111205164505.GB2326@linux.vnet.ibm.com> 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 Mon, Dec 05, 2011 at 08:45:05AM -0800, Paul E. McKenney wrote: > On Mon, Dec 05, 2011 at 05:19:24PM +0800, Yong Zhang wrote: > > On Sat, Dec 03, 2011 at 10:34:42AM -0800, Paul E. McKenney wrote: > > > From: Yong Zhang > > > > > > RCU-lockdep will issue warnings given the following use pattern: > > > > > > rcu_read_lock(); > > > local_irq_disable(); > > > rcu_read_unlock(); > > > local_irq_enable(); > > > > > > However, this use pattern is legal except for the scheduler's runqueue > > > and priority-inheritance locks (and any other locks that the scheduler > > > might use during priority-inheritance operations). > > > > > > Signed-off-by: Yong Zhang > > > Signed-off-by: Paul E. McKenney > > > --- > > > kernel/rcutree_plugin.h | 8 ++++++-- > > > 1 files changed, 6 insertions(+), 2 deletions(-) > > > > > > diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h > > > index 8cd9efe..2020e8a 100644 > > > --- a/kernel/rcutree_plugin.h > > > +++ b/kernel/rcutree_plugin.h > > > @@ -401,8 +401,11 @@ static noinline void rcu_read_unlock_special(struct task_struct *t) > > > > > > #ifdef CONFIG_RCU_BOOST > > > /* Unboost if we were boosted. */ > > > - if (rbmp) > > > + if (rbmp) { > > > + local_irq_save(flags); > > > rt_mutex_unlock(rbmp); > > > + local_irq_restore(flags); > > > + } > > > #endif /* #ifdef CONFIG_RCU_BOOST */ > > > > > > /* > > > @@ -1233,9 +1236,10 @@ static int rcu_boost(struct rcu_node *rnp) > > > lockdep_set_class_and_name(&mtx.wait_lock, &rcu_boost_class, > > > "rcu_boost_mutex"); > > > t->rcu_boost_mutex = &mtx; > > > - raw_spin_unlock_irqrestore(&rnp->lock, flags); > > > + raw_spin_unlock(&rnp->lock); /* rrupts remain disabled. */ > > > rt_mutex_lock(&mtx); /* Side effect: boosts task t's priority. */ > > > rt_mutex_unlock(&mtx); /* Keep lockdep happy. */ > > > > We permit rt_mutex_unlock() to be call with irq disabled, > > but rt_mutex_lock() is still not allowed. So this usage > > is not legal now. > > Even after commit #5342e269b has been applied? Yeah, because we call might_sleep() in rt_mutex_lock() unconditionally. But in this case the 'BUG: sleeping function called from invalid context at *' is obviously false positive. Maybe we could teach might_sleep() about this special case? Thanks, Yong