mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot for Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com,
	hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:core/rcu] rcu: Add debug check for too many rcu_read_unlock()
Date: Wed, 13 Jan 2010 10:27:58 GMT	[thread overview]
Message-ID: <tip-cba8244a0f1c277b6b1e48ed6504fa434119e24d@git.kernel.org> (raw)
In-Reply-To: <12626498423064-git-send-email->

Commit-ID:  cba8244a0f1c277b6b1e48ed6504fa434119e24d
Gitweb:     http://git.kernel.org/tip/cba8244a0f1c277b6b1e48ed6504fa434119e24d
Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
AuthorDate: Mon, 4 Jan 2010 16:04:01 -0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 13 Jan 2010 09:06:06 +0100

rcu: Add debug check for too many rcu_read_unlock()

TREE_PREEMPT_RCU maintains an rcu_read_lock_nesting counter in
the task structure, which happens to be a signed int.  So this
patch adds a check for this counter being negative at the end of
__rcu_read_unlock(). This check is under CONFIG_PROVE_LOCKING,
so can be thought of as being part of lockdep.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
LKML-Reference: <12626498423064-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/rcutree_plugin.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index f11ebd4..e77cdf3 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -304,6 +304,9 @@ void __rcu_read_unlock(void)
 	if (--ACCESS_ONCE(t->rcu_read_lock_nesting) == 0 &&
 	    unlikely(ACCESS_ONCE(t->rcu_read_unlock_special)))
 		rcu_read_unlock_special(t);
+#ifdef CONFIG_PROVE_LOCKING
+	WARN_ON_ONCE(ACCESS_ONCE(t->rcu_read_lock_nesting) < 0);
+#endif /* #ifdef CONFIG_PROVE_LOCKING */
 }
 EXPORT_SYMBOL_GPL(__rcu_read_unlock);
 

  parent reply	other threads:[~2010-01-13 10:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05  0:03 [PATCH tip/core/rcu 0/3] rcu: improve diagnostics and documentation of source files Paul E. McKenney
2010-01-05  0:04 ` [PATCH tip/core/rcu 1/3] rcu: make MAINTAINERS file match new RCU reality Paul E. McKenney
2010-01-13 10:27   ` [tip:core/rcu] rcu: Make " tip-bot for Paul E. McKenney
2010-01-05  0:04 ` [PATCH tip/core/rcu 2/3] rcu: add debug check for too many rcu_read_unlock() Paul E. McKenney
2010-01-05  2:03   ` Josh Triplett
2010-01-05  2:19     ` Paul E. McKenney
2010-01-05  2:28       ` Josh Triplett
2010-01-05 16:21         ` Paul E. McKenney
2010-01-05 17:08           ` Josh Triplett
2010-01-13 10:27   ` tip-bot for Paul E. McKenney [this message]
2010-01-05  0:04 ` [PATCH tip/core/rcu 3/3] rcu: give different levels of the rcu_node hierarchy distinct lockdep names Paul E. McKenney
2010-01-13 10:28   ` [tip:core/rcu] rcu: Give " tip-bot for Paul E. McKenney

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=tip-cba8244a0f1c277b6b1e48ed6504fa434119e24d@git.kernel.org \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --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

Powered by JetHome