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, fweisbec@gmail.com,
patches@linaro.org, "Paul E. McKenney" <paul.mckenney@linaro.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Kevin Hilman <khilman@ti.com>, Len Brown <len.brown@intel.com>,
Trinabh Gupta <g.trinabh@gmail.com>,
Arjan van de Ven <arjan@linux.intel.com>,
Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Subject: [PATCH RFC tip/core/rcu 3/3] cpuidle: Inform RCU of read-side critical sections
Date: Thu, 2 Feb 2012 17:12:48 -0800 [thread overview]
Message-ID: <1328231568-2971-3-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <1328231568-2971-1-git-send-email-paulmck@linux.vnet.ibm.com>
From: "Paul E. McKenney" <paul.mckenney@linaro.org>
The cpuidle_idle_call() function is invoked in the inner idle loop,
after the call to rcu_idle_enter() and before the call to rcu_idle_exit().
This means that RCU is ignoring the CPU at this point. Unfortunately,
cpuidle_idle_call() nevertheless contains tracepoints (important ones
used by powertop) that expect RCU to be paying attention. The consequences
of using RCU read-side critical sections on CPUs that RCU is ignoring
can be severe, including random corruption of random memory.
Therefore, this commit uses the new RCU_NONIDLE() macro to let RCU
do its job with respect to the tracepoints.
Suggested-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Trinabh Gupta <g.trinabh@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
---
drivers/cpuidle/cpuidle.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 59f4261..cd8a553 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -94,13 +94,17 @@ int cpuidle_idle_call(void)
target_state = &drv->states[next_state];
- trace_power_start(POWER_CSTATE, next_state, dev->cpu);
- trace_cpu_idle(next_state, dev->cpu);
+ RCU_NONIDLE(
+ trace_power_start(POWER_CSTATE, next_state, dev->cpu);
+ trace_cpu_idle(next_state, dev->cpu)
+ );
entered_state = target_state->enter(dev, drv, next_state);
- trace_power_end(dev->cpu);
- trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
+ RCU_NONIDLE(
+ trace_power_end(dev->cpu);
+ trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
+ );
if (entered_state >= 0) {
/* Update cpuidle counters */
--
1.7.8
next prev parent reply other threads:[~2012-02-03 1:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-03 1:12 [PATCH RFC 0/3] Fix cpuidle_idle_call() RCU usage Paul E. McKenney
2012-02-03 1:12 ` [PATCH RFC tip/core/rcu 1/3] rcu: Allow nesting of rcu_idle_enter() and rcu_idle_exit() Paul E. McKenney
2012-02-03 1:12 ` [PATCH RFC tip/core/rcu 2/3] rcu: Add RCU_NONIDLE() for idle-loop RCU read-side critical sections Paul E. McKenney
2012-02-03 1:12 ` Paul E. McKenney [this message]
2012-02-03 11:02 ` [PATCH RFC tip/core/rcu 3/3] cpuidle: Inform RCU of " Deepthi Dharwar
2012-02-03 2:43 ` [PATCH RFC 0/3] Fix cpuidle_idle_call() RCU usage Josh Triplett
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=1328231568-2971-3-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=arjan@linux.intel.com \
--cc=darren@dvhart.com \
--cc=deepthi@linux.vnet.ibm.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=eric.dumazet@gmail.com \
--cc=fweisbec@gmail.com \
--cc=g.trinabh@gmail.com \
--cc=josh@joshtriplett.org \
--cc=khilman@ti.com \
--cc=laijs@cn.fujitsu.com \
--cc=len.brown@intel.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=paul.mckenney@linaro.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).