All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] rcu: Create rcu_sync infrastructure
Date: Thu, 3 Oct 2013 21:32:06 +0200	[thread overview]
Message-ID: <20131003193206.GA17796@redhat.com> (raw)
In-Reply-To: <20131003192135.GR5790@linux.vnet.ibm.com>

On 10/03, Paul E. McKenney wrote:
>
> On Thu, Oct 03, 2013 at 08:47:19PM +0200, Oleg Nesterov wrote:
> >
> > Yes, but...
> >
> > I think it would be better to start with the patch below, this way
> > it would be easier a) to add the new ops (we need more anyway) and b)
> > use CONFIG_PROVE_RCU to avoid the unused members even if this is
> > really minor.
>
> I am fine with this as well, but I don't see the code that checks for
> the required RCU read-side critical section.

Because I believe this needs another patch ;) see below, didn't test
it yet.

(and yes, until I saw the patch from Peter I didn't realize we already
 have all necessary helpers as functions, somehow I tought that they
 are macros).

Oleg.

rcusync: add the CONFIG_PROVE_RCU checks

CHANGELOG
---

diff --git a/include/linux/rcusync.h b/include/linux/rcusync.h
index 30c6037..aa7e9e0 100644
--- a/include/linux/rcusync.h
+++ b/include/linux/rcusync.h
@@ -7,6 +7,9 @@
 struct rcu_sync_ops {
 	void (*sync)(void);
 	void (*call)(struct rcu_head *, void (*)(struct rcu_head *));
+#ifdef CONFIG_PROVE_RCU
+	bool (*held)(void);
+#endif
 };
 
 struct rcu_sync_struct {
@@ -22,6 +25,9 @@ struct rcu_sync_struct {
 
 static inline bool rcu_sync_is_idle(struct rcu_sync_struct *rss)
 {
+#ifdef CONFIG_PROVE_RCU
+	WARN_ON(!rss->ops->held());
+#endif
 	return !rss->gp_state; /* GP_IDLE */
 }
 
diff --git a/kernel/rcusync.c b/kernel/rcusync.c
index 1cefb83..21f191f 100644
--- a/kernel/rcusync.c
+++ b/kernel/rcusync.c
@@ -6,18 +6,27 @@ enum { CB_IDLE = 0, CB_PENDING, CB_REPLAY };
 
 #define	rss_lock	gp_wait.lock
 
+#ifdef CONFIG_PROVE_RCU
+#define __INIT_HELD(func)	.held = func,
+#else
+#define	__INIT_HELD(func)
+#endif
+
 struct rcu_sync_ops rcu_sync_ops_array[] = {
 	[RCU_SYNC] = {
 		.sync = synchronize_rcu,
 		.call = call_rcu,
+		__INIT_HELD(rcu_read_lock_held)
 	},
 	[RCU_SCHED_SYNC] = {
 		.sync = synchronize_sched,
 		.call = call_rcu_sched,
+		__INIT_HELD(rcu_read_lock_sched_held)
 	},
 	[RCU_BH_SYNC] = {
 		.sync = synchronize_rcu_bh,
 		.call = call_rcu_bh,
+		__INIT_HELD(rcu_read_lock_bh_held)
 	},
 };
 


  reply	other threads:[~2013-10-03 19:39 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02 14:56 [PATCH 0/3] Optimize the cpu hotplug locking Peter Zijlstra
2013-10-02 14:56 ` [PATCH 1/3] hotplug: Optimize {get,put}_online_cpus() Peter Zijlstra
2013-10-03 14:01   ` Peter Zijlstra
2013-10-03 16:27     ` Paul E. McKenney
2013-10-03 16:26   ` Paul E. McKenney
2013-10-02 14:56 ` [PATCH 2/3] rcu: Create rcu_sync infrastructure Peter Zijlstra
2013-10-02 15:49   ` Oleg Nesterov
2013-10-03 16:42     ` Paul E. McKenney
2013-10-08  8:18     ` Peter Zijlstra
2013-10-03 16:41   ` Paul E. McKenney
2013-10-03 17:00     ` Oleg Nesterov
2013-10-03 17:15       ` Paul E. McKenney
2013-10-03 18:40     ` Peter Zijlstra
2013-10-03 18:45       ` Paul E. McKenney
2013-10-03 18:47       ` Oleg Nesterov
2013-10-03 19:21         ` Paul E. McKenney
2013-10-03 19:32           ` Oleg Nesterov [this message]
2013-10-03 19:33             ` Oleg Nesterov
2013-10-03 19:50               ` Paul E. McKenney
2013-10-03 20:00                 ` Oleg Nesterov
2013-10-03 21:10                   ` Oleg Nesterov
2013-10-03 22:00                     ` Paul E. McKenney
2013-10-04 11:29                       ` Oleg Nesterov
2013-10-04 16:22                         ` Paul E. McKenney
2013-10-04  7:18                     ` Peter Zijlstra
2013-10-04 11:15                       ` Oleg Nesterov
2013-10-04 11:36                         ` Peter Zijlstra
2013-10-04 11:50                           ` Oleg Nesterov
2013-10-04 11:44                         ` Peter Zijlstra
2013-10-04 12:13                           ` Oleg Nesterov
2013-10-04 12:38                             ` Peter Zijlstra
2013-10-04 13:31                               ` Oleg Nesterov
2013-10-04 14:43                                 ` Peter Zijlstra
2013-10-04 15:13                                   ` Oleg Nesterov
2013-10-04 16:25                                     ` Peter Zijlstra
2013-10-04 19:06                                       ` Oleg Nesterov
2013-10-04 19:41                                         ` Peter Zijlstra
2013-10-05 17:31                                           ` Oleg Nesterov
2013-10-04  7:00                   ` Peter Zijlstra
2013-10-03 20:14       ` Paolo Bonzini
2013-10-04  7:01         ` Peter Zijlstra
2013-10-02 14:56 ` [PATCH 3/3] hotplug: Optimize cpu_hotplug_{begin,done}() using rcu_sync Peter Zijlstra
2013-10-03 16:48   ` Paul E. McKenney
2013-10-03 18:41     ` Peter Zijlstra
2013-10-03 18:46       ` Paul E. McKenney
2013-10-03 19:05       ` Oleg Nesterov

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=20131003193206.GA17796@redhat.com \
    --to=oleg@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.