mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: 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,
	Yong Zhang <yong.zhang0@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH RFC tip/core/rcu 7/7] rcu: Quiet RCU-lockdep warnings involving interrupt disabling
Date: Sat,  3 Dec 2011 10:34:42 -0800	[thread overview]
Message-ID: <1322937282-19846-7-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <20111203183417.GA18914@linux.vnet.ibm.com>

From: Yong Zhang <yong.zhang0@gmail.com>

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 <yong.zhang0@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 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. */
+	local_irq_restore(flags);
 
 	return rnp->exp_tasks != NULL || rnp->boost_tasks != NULL;
 }
-- 
1.7.3.2


  parent reply	other threads:[~2011-12-03 18:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-03 18:34 [PATCH tip/core/rcu 0/7] Preview of fourth set of RCU changes for 3.3 Paul E. McKenney
2011-12-03 18:34 ` [PATCH RFC tip/core/rcu 1/7] rcu: Don't check irq nesting from rcu idle entry/exit Paul E. McKenney
2011-12-03 18:34 ` [PATCH RFC tip/core/rcu 2/7] rcu: Irq nesting is always 0 on rcu_enter_idle_common Paul E. McKenney
2011-12-03 18:34 ` [PATCH RFC tip/core/rcu 3/7] rcu: Keep invoking callbacks if CPU otherwise idle Paul E. McKenney
2011-12-03 18:34 ` [PATCH RFC tip/core/rcu 4/7] rcu: Adaptive dyntick-idle preparation Paul E. McKenney
2011-12-03 18:34 ` [PATCH RFC tip/core/rcu 5/7] rcu: remove redundant rcu_cpu_stall_suppress declaration Paul E. McKenney
2011-12-03 18:34 ` [PATCH RFC tip/core/rcu 6/7] driver-core/cpu: Add cpu_is_hotpluggable() for rcutorture error analysis Paul E. McKenney
2011-12-03 21:06   ` Josh Triplett
2011-12-03 23:14     ` Paul E. McKenney
2011-12-03 18:34 ` Paul E. McKenney [this message]
2011-12-05  9:19   ` [PATCH RFC tip/core/rcu 7/7] rcu: Quiet RCU-lockdep warnings involving interrupt disabling Yong Zhang
2011-12-05 16:45     ` Paul E. McKenney
2011-12-06  1:26       ` Yong Zhang
2011-12-06  2:12         ` Paul E. McKenney
2011-12-06  3:27           ` [PATCH 1/3] kernel.h: sched: introduce might_sleep_disabled() Yong Zhang
2011-12-06  3:28           ` [PATCH 2/3] rtmutex: introduce rt_mutex_lock_irqdisabled() Yong Zhang
2011-12-06  3:29           ` [PATCH 3/3] rcu: use rt_mutex_lock_irqdisabled() in rcu_boost() Yong Zhang
2011-12-06  9:52         ` [PATCH RFC tip/core/rcu 7/7] rcu: Quiet RCU-lockdep warnings involving interrupt disabling Peter Zijlstra
2011-12-06 10:05           ` Yong Zhang
2011-12-06 10:32             ` Peter Zijlstra
2011-12-06 12:26               ` Steven Rostedt
2011-12-06 16:04                 ` Paul E. McKenney
2011-12-06 16:33                   ` Paul E. McKenney
2011-12-06 16:56                   ` Steven Rostedt
2011-12-06 17:16                     ` Paul E. McKenney
2011-12-06 10:27           ` Peter Zijlstra
2011-12-06 16:11             ` Paul E. McKenney
2011-12-06 16:14               ` Peter Zijlstra
2011-12-06 16:01           ` Paul E. McKenney
2011-12-05  9:41   ` Peter Zijlstra
2011-12-05 10:03     ` Yong Zhang
2011-12-05 16:48       ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322937282-19846-7-git-send-email-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=darren@dvhart.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=eric.dumazet@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=niv@us.ibm.com \
    --cc=patches@linaro.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=yong.zhang0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®