From patchwork Thu Aug 30 18:56:17 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: 11108 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 2789823F27 for ; Thu, 30 Aug 2012 21:43:47 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4C9BCA192F9 for ; Thu, 30 Aug 2012 21:43:10 +0000 (UTC) Received: by ieak11 with SMTP id k11so1153778iea.11 for ; Thu, 30 Aug 2012 14:43:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=b6fa/tciQhtd3w9k5ruIBg4F8g6eT64Dy7cHsUP7ba0=; b=KEXygFj/wXh/gJ4zydARZRwc6cAYjOWMePNzusmfwgkCGlJZQxF95g4mn5K41Zmi0N GhLPvusngYoJyXAXnTy/+Rj6x+RReUCmZQq+F5TPEJlA4cxMAnA8HZHWj/a8kHYjiT4Q Gt1AZfig/xUnci60Mg7X5YhxjiDh4QnEB75Abqqp50yMt/JSkbljjk+1y0N8ZEcHSMI5 4zjjnA16e4qLNy9qjipzMfj8F8jhPJISLSCthQLqXy6xNKj/fuiXPC4vUa3XIFZ9jOpX 7CnSAOMedNbA/uGLuQ5d8zM0bBSJF+EJlVaA6fLlvFo0pA4Omy4nwclImmdrGiZDcD4k 0EXw== Received: by 10.50.7.212 with SMTP id l20mr2420513iga.43.1346363026081; Thu, 30 Aug 2012 14:43:46 -0700 (PDT) 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.50.184.232 with SMTP id ex8csp32874igc; Thu, 30 Aug 2012 14:43:45 -0700 (PDT) Received: by 10.182.5.200 with SMTP id u8mr6001635obu.91.1346363025704; Thu, 30 Aug 2012 14:43:45 -0700 (PDT) Received: from e39.co.us.ibm.com (e39.co.us.ibm.com. [32.97.110.160]) by mx.google.com with ESMTPS id f7si3573378obd.10.2012.08.30.14.43.45 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Aug 2012 14:43:45 -0700 (PDT) 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, 30 Aug 2012 15:43:45 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 30 Aug 2012 15:43:42 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id B3BFE1FF003E; Thu, 30 Aug 2012 15:43:40 -0600 (MDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7ULhYOd179216; Thu, 30 Aug 2012 15:43:34 -0600 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 q7ULhXB1026368; Thu, 30 Aug 2012 15:43:34 -0600 Received: from paulmck-ThinkPad-W500 (sig-9-65-153-225.mts.ibm.com [9.65.153.225]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q7ULhWn0026328; Thu, 30 Aug 2012 15:43:33 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id B49FBEA829; Thu, 30 Aug 2012 11:56:30 -0700 (PDT) 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, sbw@mit.edu, patches@linaro.org, "Paul E. McKenney" , "Paul E. McKenney" Subject: [PATCH tip/core/rcu 04/15] rcu: Permit RCU_NONIDLE() to be used from interrupt context Date: Thu, 30 Aug 2012 11:56:17 -0700 Message-Id: <1346352988-32444-4-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1346352988-32444-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120830185607.GA32148@linux.vnet.ibm.com> <1346352988-32444-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12083021-4242-0000-0000-000002BA071B X-Gm-Message-State: ALoCoQlai9vmrwXwyyB1zUqXSVpc1oF1pgLGpSUz1s/lpW9W0rn31CivENOAToAAVZtgVqZVBdRw From: "Paul E. McKenney" There is a need to use RCU from interrupt context, but either before rcu_irq_enter() is called or after rcu_irq_exit() is called. If the interrupt occurs from idle, then lockdep-RCU will complain about such uses, as they appear to be illegal uses of RCU from the idle loop. In other environments, RCU_NONIDLE() could be used to properly protect the use of RCU, but RCU_NONIDLE() currently cannot be invoked except from process context. This commit therefore modifies RCU_NONIDLE() to permit its use more globally. Reported-by: Steven Rostedt Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney --- include/linux/rcupdate.h | 6 ++---- kernel/rcutiny.c | 2 ++ kernel/rcutree.c | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 115ead2..0fbbd52 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -210,14 +210,12 @@ extern void exit_rcu(void); * to nest RCU_NONIDLE() wrappers, but the nesting level is currently * quite limited. If deeper nesting is required, it will be necessary * to adjust DYNTICK_TASK_NESTING_VALUE accordingly. - * - * This macro may be used from process-level code only. */ #define RCU_NONIDLE(a) \ do { \ - rcu_idle_exit(); \ + rcu_irq_enter(); \ do { a; } while (0); \ - rcu_idle_enter(); \ + rcu_irq_exit(); \ } while (0) /* diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c index e4163c5..2e073a2 100644 --- a/kernel/rcutiny.c +++ b/kernel/rcutiny.c @@ -115,6 +115,7 @@ void rcu_irq_exit(void) rcu_idle_enter_common(newval); local_irq_restore(flags); } +EXPORT_SYMBOL_GPL(rcu_irq_exit); /* Common code for rcu_idle_exit() and rcu_irq_enter(), see kernel/rcutree.c. */ static void rcu_idle_exit_common(long long oldval) @@ -172,6 +173,7 @@ void rcu_irq_enter(void) rcu_idle_exit_common(oldval); local_irq_restore(flags); } +EXPORT_SYMBOL_GPL(rcu_irq_enter); #ifdef CONFIG_DEBUG_LOCK_ALLOC diff --git a/kernel/rcutree.c b/kernel/rcutree.c index f280e54..96b8aff 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -447,6 +447,7 @@ void rcu_irq_exit(void) rcu_idle_enter_common(rdtp, oldval); local_irq_restore(flags); } +EXPORT_SYMBOL_GPL(rcu_irq_exit); /* * rcu_idle_exit_common - inform RCU that current CPU is moving away from idle @@ -542,6 +543,7 @@ void rcu_irq_enter(void) rcu_idle_exit_common(rdtp, oldval); local_irq_restore(flags); } +EXPORT_SYMBOL_GPL(rcu_irq_enter); /** * rcu_nmi_enter - inform RCU of entry to NMI context