From patchwork Fri Feb 3 01:12:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 6583 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id BB15A23E01 for ; Fri, 3 Feb 2012 01:13:09 +0000 (UTC) Received: from mail-tul01m020-f180.google.com (mail-tul01m020-f180.google.com [209.85.214.180]) by fiordland.canonical.com (Postfix) with ESMTP id 7881CA1807B for ; Fri, 3 Feb 2012 01:13:09 +0000 (UTC) Received: by mail-tul01m020-f180.google.com with SMTP id uo19so4766559obb.11 for ; Thu, 02 Feb 2012 17:13:09 -0800 (PST) Received: by 10.50.156.196 with SMTP id wg4mr5998592igb.13.1328231589180; Thu, 02 Feb 2012 17:13:09 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.169.210 with SMTP id a18cs72919ibz; Thu, 2 Feb 2012 17:13:08 -0800 (PST) Received: by 10.68.218.104 with SMTP id pf8mr12669895pbc.24.1328231588495; Thu, 02 Feb 2012 17:13:08 -0800 (PST) Received: from e39.co.us.ibm.com (e39.co.us.ibm.com. [32.97.110.160]) by mx.google.com with ESMTPS id e8si5969541pbw.59.2012.02.02.17.13.08 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 02 Feb 2012 17:13:08 -0800 (PST) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.160 as permitted sender) client-ip=32.97.110.160; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.160 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 Feb 2012 18:13:07 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 2 Feb 2012 18:12:55 -0700 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 9612C19D8051; Thu, 2 Feb 2012 18:12:51 -0700 (MST) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q131CsaC088072; Thu, 2 Feb 2012 18:12:54 -0700 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q131Cp5s024214; Thu, 2 Feb 2012 18:12:53 -0700 Received: from paulmck-ThinkPad-W500 ([9.47.24.98]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q131Coim024188; Thu, 2 Feb 2012 18:12:51 -0700 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 57513E51FF; Thu, 2 Feb 2012 17:12:50 -0800 (PST) From: "Paul E. McKenney" 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 E. McKenney" , Kevin Hilman , Len Brown , Trinabh Gupta , Arjan van de Ven , Deepthi Dharwar 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 Message-Id: <1328231568-2971-3-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1328231568-2971-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120203011208.GA2004@linux.vnet.ibm.com> <1328231568-2971-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12020301-4242-0000-0000-000000ACFA54 From: "Paul E. McKenney" 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 Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney Cc: Kevin Hilman Cc: Len Brown Cc: Trinabh Gupta Cc: Arjan van de Ven Cc: Deepthi Dharwar Acked-by: Deepthi Dharwar --- 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 */