From patchwork Sat Feb 4 01:44:37 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: 6632 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 1C92D23E92 for ; Sat, 4 Feb 2012 01:46:16 +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 CE4E6A180C7 for ; Sat, 4 Feb 2012 01:46:15 +0000 (UTC) Received: by obbuo19 with SMTP id uo19so6612804obb.11 for ; Fri, 03 Feb 2012 17:46:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.161.231 with SMTP id xv7mr571278igb.0.1328319975139; Fri, 03 Feb 2012 17:46:15 -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 a18cs33820ibz; Fri, 3 Feb 2012 17:46:14 -0800 (PST) Received: by 10.68.212.130 with SMTP id nk2mr22380149pbc.69.1328319972396; Fri, 03 Feb 2012 17:46:12 -0800 (PST) Received: from e37.co.us.ibm.com (e37.co.us.ibm.com. [32.97.110.158]) by mx.google.com with ESMTPS id j9si10796887pbh.65.2012.02.03.17.46.11 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 03 Feb 2012 17:46:12 -0800 (PST) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.158 as permitted sender) client-ip=32.97.110.158; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.158 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Feb 2012 18:46:10 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 3 Feb 2012 18:46:06 -0700 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 7E8663E4004C for ; Fri, 3 Feb 2012 18:46:05 -0700 (MST) 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 q141jW27087214 for ; Fri, 3 Feb 2012 18:45:33 -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 q141jPCA013110 for ; Fri, 3 Feb 2012 18:45:32 -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 q141jPkb013081; Fri, 3 Feb 2012 18:45:25 -0700 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 95510E51EF; Fri, 3 Feb 2012 17:45:24 -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" Subject: [PATCH tip/core/rcu 02/47] rcu: Improve synchronize_rcu() diagnostics Date: Fri, 3 Feb 2012 17:44:37 -0800 Message-Id: <1328319922-30828-2-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1328319922-30828-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120204014452.GA29811@linux.vnet.ibm.com> <1328319922-30828-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12020401-7408-0000-0000-0000026335F8 X-Gm-Message-State: ALoCoQkTq9GvwYYEWKwuAWTRTISX6/a5SXDX04nlYt5rnx1fI8JDQ1QZNEhSk1Hy8DUNHEaXmZap From: Frederic Weisbecker Although TREE_PREEMPT_RCU indirectly uses might_sleep() to detect illegal use of synchronize_sched() and synchronize_rcu_bh() from within an RCU read-side critical section, this might_sleep() check is bypassed when there is only a single CPU (for example, when running an SMP kernel on a single-CPU system). This patch therefore adds a might_sleep() call to the rcu_blocking_is_gp() check that is unconditionally invoked from both synchronize_sched() and synchronize_rcu_bh(). Signed-off-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney --- include/linux/rcutree.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index 6745846..73e7195 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h @@ -83,6 +83,7 @@ extern void rcu_sched_force_quiescent_state(void); /* A context switch is a grace period for RCU-sched and RCU-bh. */ static inline int rcu_blocking_is_gp(void) { + might_sleep(); /* Check for RCU read-side critical section. */ return num_online_cpus() == 1; }