lkml.org 
[lkml]   [2012]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC tip/core/rcu 3/3] cpuidle: Inform RCU of read-side critical sections
On 02/03/2012 06:42 AM, Paul E. McKenney wrote:

> 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 */


Cleaner design esp by moving away from architecture specific
tweaking is much appreciated :)

Acked-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>



\
 
 \ /
  Last update: 2012-02-03 12:05    [W:0.071 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site