Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1240798
| From | Josh Triplett <josh@joshtriplett.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() |
| Date | 2015-10-06 19:40 +0200 |
| Message-ID | <qgEnz-4wt-57@gated-at.bofh.it> (permalink) |
| References | <qgD85-2O1-3@gated-at.bofh.it> <qgD85-2O1-5@gated-at.bofh.it> <qgDhN-2Zi-37@gated-at.bofh.it> <qgEdQ-4lc-13@gated-at.bofh.it> <qgEnw-4wt-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Oct 06, 2015 at 10:31:52AM -0700, Paul E. McKenney wrote:
> On Tue, Oct 06, 2015 at 10:21:28AM -0700, Josh Triplett wrote:
> > On Tue, Oct 06, 2015 at 09:13:45AM -0700, Paul E. McKenney wrote:
> > > This commit adds an rcu_pointer_handoff() that is intended to mark
> > > situations where a structure's protection transitions from RCU to some
> > > other mechanism (locking, reference counting, whatever). These markings
> > > should allow external tools to more easily spot bugs involving leaking
> > > pointers out of RCU read-side critical sections.
> > >
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> >
> > Shouldn't this expect the __rcu address space on the pointer, and cast
> > away the __rcu with __force?
>
> I do not believe so, given that the __rcu was already removed by a preceding
> rcu_dereference(). Or am I missing something?
Ah, I see. Per the example, you don't call this on an __rcu pointer
directly, only on a pointer you've already obtained from RCU after
giving it a lifetime of its own. Nevermind.
> > > include/linux/rcupdate.h | 22 ++++++++++++++++++++++
> > > 1 file changed, 22 insertions(+)
> > >
> > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > > index 6c3ceceb6148..587eb057e2fa 100644
> > > --- a/include/linux/rcupdate.h
> > > +++ b/include/linux/rcupdate.h
> > > @@ -813,6 +813,28 @@ static inline void rcu_preempt_sleep_check(void)
> > > #define rcu_dereference_sched(p) rcu_dereference_sched_check(p, 0)
> > >
> > > /**
> > > + * rcu_pointer_handoff() - Hand off a pointer from RCU to other mechanism
> > > + * @p: The pointer to hand off
> > > + *
> > > + * This is simply an identity function, but it documents where a pointer
> > > + * is handed off from RCU to some other synchronization mechanism, for
> > > + * example, reference counting or locking. In C11, it would map to
> > > + * kill_dependency(). It could be used as follows:
> > > + *
> > > + * rcu_read_lock();
> > > + * p = rcu_dereference(gp);
> > > + * long_lived = is_long_lived(p);
> > > + * if (long_lived) {
> > > + * if (!atomic_inc_not_zero(p->refcnt))
> > > + * long_lived = false;
> > > + * else
> > > + * p = rcu_pointer_handoff(p);
> > > + * }
> > > + * rcu_read_unlock();
> > > + */
> > > +#define rcu_pointer_handoff(p) (p)
> > > +
> > > +/**
> > > * rcu_read_lock() - mark the beginning of an RCU read-side critical section
> > > *
> > > * When synchronize_rcu() is invoked on one CPU while other CPUs
> > > --
> > > 2.5.2
> > >
> >
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH tip/core/rcu 0/13] Miscellaneous fixes for 4.4 "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
[PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
Re: [Kernel networking modules.] OSI levels 2 & 3, Assistance - If anyone knows anyone in the US. North West region "John D Allen, Leveridge Systems INC" <john.allen@leveridgesystems.com> - 2015-10-06 18:30 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers Josh Triplett <josh@joshtriplett.org> - 2015-10-06 18:50 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers Josh Triplett <josh@joshtriplett.org> - 2015-10-06 19:20 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers Josh Triplett <josh@joshtriplett.org> - 2015-10-06 19:50 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 19:50 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers Peter Zijlstra <peterz@infradead.org> - 2015-10-06 22:10 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 22:20 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers Peter Zijlstra <peterz@infradead.org> - 2015-10-06 23:00 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 23:10 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers Peter Zijlstra <peterz@infradead.org> - 2015-10-07 09:30 +0200
Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 19:20 +0200
[PATCH tip/core/rcu 03/13] rcu: Use call_rcu_func_t to replace explicit type equivalents "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
[PATCH tip/core/rcu 01/13] sched: Export sched_setscheduler_nocheck "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
[PATCH tip/core/rcu 09/13] rcu: Correct comment for values of ->gp_state field "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
[PATCH tip/core/rcu 11/13] rculist: Make list_entry_rcu() use lockless_dereference() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
[PATCH tip/core/rcu 02/13] rcu: Use rcu_callback_t in call_rcu*() and friends "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
[PATCH tip/core/rcu 12/13] rcu: Remove deprecated rcu_lockdep_assert() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
[PATCH tip/core/rcu 06/13] rcu: Add online/offline info to stall warning message "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:20 +0200
Re: [PATCH tip/core/rcu 06/13] rcu: Add online/offline info to stall warning message Josh Triplett <josh@joshtriplett.org> - 2015-10-06 19:20 +0200
[PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:30 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() Josh Triplett <josh@joshtriplett.org> - 2015-10-06 19:20 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 19:40 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() Josh Triplett <josh@joshtriplett.org> - 2015-10-06 19:50 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 20:10 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() Peter Zijlstra <peterz@infradead.org> - 2015-10-06 22:10 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 22:20 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() Peter Zijlstra <peterz@infradead.org> - 2015-10-06 22:40 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 23:10 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() Peter Zijlstra <peterz@infradead.org> - 2015-10-07 09:30 +0200
Re: [PATCH tip/core/rcu 07/13] rcu: Move preemption disabling out of __srcu_read_lock() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-07 16:20 +0200
[PATCH tip/core/rcu 05/13] rcu: Eliminate panic when silly boot-time fanout specified "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:30 +0200
[PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 18:30 +0200
Re: [PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() Josh Triplett <josh@joshtriplett.org> - 2015-10-06 19:30 +0200
Re: [PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 19:40 +0200
Re: [PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() Josh Triplett <josh@joshtriplett.org> - 2015-10-06 19:40 +0200
Re: [PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() Peter Zijlstra <peterz@infradead.org> - 2015-10-06 22:30 +0200
Re: [PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 23:10 +0200
Re: [PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() Peter Zijlstra <peterz@infradead.org> - 2015-10-07 09:30 +0200
Re: [PATCH tip/core/rcu 10/13] rcu: Add rcu_pointer_handoff() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-07 16:30 +0200
Re: [PATCH tip/core/rcu 0/13] Miscellaneous fixes for 4.4 Josh Triplett <josh@joshtriplett.org> - 2015-10-06 19:30 +0200
Re: [PATCH tip/core/rcu 0/13] Miscellaneous fixes for 4.4 "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-06 19:40 +0200
csiph-web