Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1240639 > unrolled thread
| Started by | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| First post | 2015-10-06 18:20 +0200 |
| Last post | 2015-10-06 19:40 +0200 |
| Articles | 20 on this page of 43 — 4 participants |
Back to article view | Back to linux.kernel
[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
Page 1 of 3 [1] 2 3 Next page →
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 0/13] Miscellaneous fixes for 4.4 |
| Message-ID | <qgD85-2O1-3@gated-at.bofh.it> |
Hello! This series contains miscellaneous fixes: 1. Export sched_setscheduler_nocheck() so that the new locktorture rtmutex_lock tests can be run as modules, courtesy of Davidlohr Bueso. 2. Use rcu_callback_t in call_rcu*() and friends to improve readability and to make cscope able to find them, courtesy of Boqun Feng. 3. Use call_rcu_func_t to replace explicit type equivalents when defining RCU callback functions, courtesy of Boqun Feng. 4. Don't unnecessarily disable preemption for Tiny and Tree RCU readers (only for preemptible RCU readers), courtesy of Boqun Feng. 5. Eliminate boot-time panic when a silly boot-time fanout is specified. 6. Add online/offline info to help debug stall-warning messages. 7. Move preemption disabling out of __srcu_read_lock() into srcu_read_lock(). 8. Finish folding ->fqs_state into ->gp_state, courtesy of Petr Mladek. 9. Correct comment for values of ->gp_state field. 10. Add rcu_pointer_handoff() to allow explicit marking of handing off protection from RCU to some other means, such as locking or reference counting. 11. Make list_entry_rcu() use lockless_dereference(), courtesy of Patrick Marlier. Despite the fact that this patch does nothing more than eliminate a single store and a single load of an unshared stack variable it nevertheless manages to provide a measurable performance increase: http://people.csail.mit.edu/amatveev/RLU_SOSP2015.pdf 12. Remove deprecated rcu_lockdep_assert(). Thanx, Paul ------------------------------------------------------------------------ b/Documentation/kernel-parameters.txt | 9 +++-- b/include/linux/list.h | 5 +- b/include/linux/list_bl.h | 5 +- b/include/linux/list_nulls.h | 3 + b/include/linux/rculist.h | 5 -- b/include/linux/rcupdate.h | 59 +++++++++++++++++----------------- b/include/linux/rcutiny.h | 3 + b/include/linux/rcutree.h | 2 - b/include/linux/srcu.h | 5 ++ b/kernel/exit.c | 2 + b/kernel/rcu/rcutorture.c | 6 +-- b/kernel/rcu/srcu.c | 4 -- b/kernel/rcu/tiny.c | 8 ++-- b/kernel/rcu/tree.c | 55 ++++++++++++++++++------------- b/kernel/rcu/tree.h | 21 +++--------- b/kernel/rcu/tree_plugin.h | 10 ++++- b/kernel/rcu/tree_trace.c | 2 - b/kernel/rcu/update.c | 2 - b/kernel/sched/core.c | 1 19 files changed, 111 insertions(+), 96 deletions(-) -- 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/
[toc] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgD86-2O1-23@gated-at.bofh.it> |
| In reply to | #1240639 |
From: Boqun Feng <boqun.feng@gmail.com>
Because preempt_disable() maps to barrier() for non-debug builds,
it forces the compiler to spill and reload registers. Because Tree
RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these
barrier() instances generate needless extra code for each instance of
rcu_read_lock() and rcu_read_unlock(). This extra code slows down Tree
RCU and bloats Tiny RCU.
This commit therefore removes the preempt_disable() and preempt_enable()
from the non-preemptible implementations of __rcu_read_lock() and
__rcu_read_unlock(), respectively. However, for debug purposes,
preempt_disable() and preempt_enable() are still invoked if
CONFIG_PREEMPT_COUNT=y, because this allows detection of sleeping inside
atomic sections in non-preemptible kernels.
This is based on an earlier patch by Paul E. McKenney, fixing
a bug encountered in kernels built with CONFIG_PREEMPT=n and
CONFIG_PREEMPT_COUNT=y.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
include/linux/rcupdate.h | 6 ++++--
include/linux/rcutiny.h | 1 +
kernel/rcu/tree.c | 9 +++++++++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d63bb77dab35..6c3ceceb6148 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -297,12 +297,14 @@ void synchronize_rcu(void);
static inline void __rcu_read_lock(void)
{
- preempt_disable();
+ if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
+ preempt_disable();
}
static inline void __rcu_read_unlock(void)
{
- preempt_enable();
+ if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
+ preempt_enable();
}
static inline void synchronize_rcu(void)
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index c8a0722f77ea..4c1aaf9cce7b 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void)
static inline void rcu_all_qs(void)
{
+ barrier(); /* Avoid RCU read-side critical sections leaking across. */
}
#endif /* __LINUX_RCUTINY_H */
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index b9d9e0249e2f..93c0f23c3e45 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
*/
void rcu_note_context_switch(void)
{
+ barrier(); /* Avoid RCU read-side critical sections leaking down. */
trace_rcu_utilization(TPS("Start context switch"));
rcu_sched_qs();
rcu_preempt_note_context_switch();
if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
rcu_momentary_dyntick_idle();
trace_rcu_utilization(TPS("End context switch"));
+ barrier(); /* Avoid RCU read-side critical sections leaking up. */
}
EXPORT_SYMBOL_GPL(rcu_note_context_switch);
@@ -353,12 +355,19 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switch);
* RCU flavors in desperate need of a quiescent state, which will normally
* be none of them). Either way, do a lightweight quiescent state for
* all RCU flavors.
+ *
+ * The barrier() calls are redundant in the common case when this is
+ * called externally, but just in case this is called from within this
+ * file.
+ *
*/
void rcu_all_qs(void)
{
+ barrier(); /* Avoid RCU read-side critical sections leaking down. */
if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
rcu_momentary_dyntick_idle();
this_cpu_inc(rcu_qs_ctr);
+ barrier(); /* Avoid RCU read-side critical sections leaking up. */
}
EXPORT_SYMBOL_GPL(rcu_all_qs);
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "John D Allen, Leveridge Systems INC" <john.allen@leveridgesystems.com> |
|---|---|
| Date | 2015-10-06 18:30 +0200 |
| Subject | Re: [Kernel networking modules.] OSI levels 2 & 3, Assistance - If anyone knows anyone in the US. North West region |
| Message-ID | <qgDhM-2Zi-23@gated-at.bofh.it> |
| In reply to | #1240640 |
OSI levels 2 & 3, Assistance - If anyone knows anyone in the US. North West region, please advise. Welcome assistance on Kernel developments on the networking side. thanks in advance. Regards, John. > > -- > 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/ -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Triplett <josh@joshtriplett.org> |
|---|---|
| Date | 2015-10-06 18:50 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgDB8-3mf-13@gated-at.bofh.it> |
| In reply to | #1240640 |
On Tue, Oct 06, 2015 at 09:13:39AM -0700, Paul E. McKenney wrote:
> From: Boqun Feng <boqun.feng@gmail.com>
>
> Because preempt_disable() maps to barrier() for non-debug builds,
> it forces the compiler to spill and reload registers. Because Tree
> RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these
> barrier() instances generate needless extra code for each instance of
> rcu_read_lock() and rcu_read_unlock(). This extra code slows down Tree
> RCU and bloats Tiny RCU.
>
> This commit therefore removes the preempt_disable() and preempt_enable()
> from the non-preemptible implementations of __rcu_read_lock() and
> __rcu_read_unlock(), respectively. However, for debug purposes,
> preempt_disable() and preempt_enable() are still invoked if
> CONFIG_PREEMPT_COUNT=y, because this allows detection of sleeping inside
> atomic sections in non-preemptible kernels.
>
> This is based on an earlier patch by Paul E. McKenney, fixing
> a bug encountered in kernels built with CONFIG_PREEMPT=n and
> CONFIG_PREEMPT_COUNT=y.
This also adds explicit barrier() calls to several internal RCU
functions, but the commit message doesn't explain those at all.
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> include/linux/rcupdate.h | 6 ++++--
> include/linux/rcutiny.h | 1 +
> kernel/rcu/tree.c | 9 +++++++++
> 3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index d63bb77dab35..6c3ceceb6148 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -297,12 +297,14 @@ void synchronize_rcu(void);
>
> static inline void __rcu_read_lock(void)
> {
> - preempt_disable();
> + if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> + preempt_disable();
> }
>
> static inline void __rcu_read_unlock(void)
> {
> - preempt_enable();
> + if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> + preempt_enable();
> }
>
> static inline void synchronize_rcu(void)
> diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
> index c8a0722f77ea..4c1aaf9cce7b 100644
> --- a/include/linux/rcutiny.h
> +++ b/include/linux/rcutiny.h
> @@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void)
>
> static inline void rcu_all_qs(void)
> {
> + barrier(); /* Avoid RCU read-side critical sections leaking across. */
> }
>
> #endif /* __LINUX_RCUTINY_H */
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index b9d9e0249e2f..93c0f23c3e45 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> */
> void rcu_note_context_switch(void)
> {
> + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> trace_rcu_utilization(TPS("Start context switch"));
> rcu_sched_qs();
> rcu_preempt_note_context_switch();
> if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> rcu_momentary_dyntick_idle();
> trace_rcu_utilization(TPS("End context switch"));
> + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> }
> EXPORT_SYMBOL_GPL(rcu_note_context_switch);
>
> @@ -353,12 +355,19 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> * RCU flavors in desperate need of a quiescent state, which will normally
> * be none of them). Either way, do a lightweight quiescent state for
> * all RCU flavors.
> + *
> + * The barrier() calls are redundant in the common case when this is
> + * called externally, but just in case this is called from within this
> + * file.
> + *
> */
> void rcu_all_qs(void)
> {
> + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> rcu_momentary_dyntick_idle();
> this_cpu_inc(rcu_qs_ctr);
> + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> }
> EXPORT_SYMBOL_GPL(rcu_all_qs);
>
> --
> 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Triplett <josh@joshtriplett.org> |
|---|---|
| Date | 2015-10-06 19:20 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgE49-49R-19@gated-at.bofh.it> |
| In reply to | #1240710 |
On Tue, Oct 06, 2015 at 10:01:01AM -0700, Paul E. McKenney wrote:
> On Tue, Oct 06, 2015 at 09:44:45AM -0700, Josh Triplett wrote:
> > On Tue, Oct 06, 2015 at 09:13:39AM -0700, Paul E. McKenney wrote:
> > > From: Boqun Feng <boqun.feng@gmail.com>
> > >
> > > Because preempt_disable() maps to barrier() for non-debug builds,
> > > it forces the compiler to spill and reload registers. Because Tree
> > > RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these
> > > barrier() instances generate needless extra code for each instance of
> > > rcu_read_lock() and rcu_read_unlock(). This extra code slows down Tree
> > > RCU and bloats Tiny RCU.
> > >
> > > This commit therefore removes the preempt_disable() and preempt_enable()
> > > from the non-preemptible implementations of __rcu_read_lock() and
> > > __rcu_read_unlock(), respectively. However, for debug purposes,
> > > preempt_disable() and preempt_enable() are still invoked if
> > > CONFIG_PREEMPT_COUNT=y, because this allows detection of sleeping inside
> > > atomic sections in non-preemptible kernels.
> > >
> > > This is based on an earlier patch by Paul E. McKenney, fixing
> > > a bug encountered in kernels built with CONFIG_PREEMPT=n and
> > > CONFIG_PREEMPT_COUNT=y.
> >
> > This also adds explicit barrier() calls to several internal RCU
> > functions, but the commit message doesn't explain those at all.
>
> To compensate for them being removed from rcu_read_lock() and
> rcu_read_unlock(), but yes, I will update.
That much seemed clear from the comments, but that doesn't explain *why*
those functions need barriers of their own even though rcu_read_lock()
and rcu_read_unlock() don't.
> > > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > ---
> > > include/linux/rcupdate.h | 6 ++++--
> > > include/linux/rcutiny.h | 1 +
> > > kernel/rcu/tree.c | 9 +++++++++
> > > 3 files changed, 14 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > > index d63bb77dab35..6c3ceceb6148 100644
> > > --- a/include/linux/rcupdate.h
> > > +++ b/include/linux/rcupdate.h
> > > @@ -297,12 +297,14 @@ void synchronize_rcu(void);
> > >
> > > static inline void __rcu_read_lock(void)
> > > {
> > > - preempt_disable();
> > > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> > > + preempt_disable();
> > > }
> > >
> > > static inline void __rcu_read_unlock(void)
> > > {
> > > - preempt_enable();
> > > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> > > + preempt_enable();
> > > }
> > >
> > > static inline void synchronize_rcu(void)
> > > diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
> > > index c8a0722f77ea..4c1aaf9cce7b 100644
> > > --- a/include/linux/rcutiny.h
> > > +++ b/include/linux/rcutiny.h
> > > @@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void)
> > >
> > > static inline void rcu_all_qs(void)
> > > {
> > > + barrier(); /* Avoid RCU read-side critical sections leaking across. */
> > > }
> > >
> > > #endif /* __LINUX_RCUTINY_H */
> > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > > index b9d9e0249e2f..93c0f23c3e45 100644
> > > --- a/kernel/rcu/tree.c
> > > +++ b/kernel/rcu/tree.c
> > > @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> > > */
> > > void rcu_note_context_switch(void)
> > > {
> > > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > > trace_rcu_utilization(TPS("Start context switch"));
> > > rcu_sched_qs();
> > > rcu_preempt_note_context_switch();
> > > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > > rcu_momentary_dyntick_idle();
> > > trace_rcu_utilization(TPS("End context switch"));
> > > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > > }
> > > EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> > >
> > > @@ -353,12 +355,19 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> > > * RCU flavors in desperate need of a quiescent state, which will normally
> > > * be none of them). Either way, do a lightweight quiescent state for
> > > * all RCU flavors.
> > > + *
> > > + * The barrier() calls are redundant in the common case when this is
> > > + * called externally, but just in case this is called from within this
> > > + * file.
> > > + *
> > > */
> > > void rcu_all_qs(void)
> > > {
> > > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > > rcu_momentary_dyntick_idle();
> > > this_cpu_inc(rcu_qs_ctr);
> > > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > > }
> > > EXPORT_SYMBOL_GPL(rcu_all_qs);
> > >
> > > --
> > > 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Triplett <josh@joshtriplett.org> |
|---|---|
| Date | 2015-10-06 19:50 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgExc-4Ib-25@gated-at.bofh.it> |
| In reply to | #1240761 |
On Tue, Oct 06, 2015 at 10:42:04AM -0700, Paul E. McKenney wrote: > On Tue, Oct 06, 2015 at 10:16:30AM -0700, Josh Triplett wrote: > > On Tue, Oct 06, 2015 at 10:01:01AM -0700, Paul E. McKenney wrote: > > > On Tue, Oct 06, 2015 at 09:44:45AM -0700, Josh Triplett wrote: > > > > On Tue, Oct 06, 2015 at 09:13:39AM -0700, Paul E. McKenney wrote: > > > > > From: Boqun Feng <boqun.feng@gmail.com> > > > > > > > > > > Because preempt_disable() maps to barrier() for non-debug builds, > > > > > it forces the compiler to spill and reload registers. Because Tree > > > > > RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these > > > > > barrier() instances generate needless extra code for each instance of > > > > > rcu_read_lock() and rcu_read_unlock(). This extra code slows down Tree > > > > > RCU and bloats Tiny RCU. > > > > > > > > > > This commit therefore removes the preempt_disable() and preempt_enable() > > > > > from the non-preemptible implementations of __rcu_read_lock() and > > > > > __rcu_read_unlock(), respectively. However, for debug purposes, > > > > > preempt_disable() and preempt_enable() are still invoked if > > > > > CONFIG_PREEMPT_COUNT=y, because this allows detection of sleeping inside > > > > > atomic sections in non-preemptible kernels. > > > > > > > > > > This is based on an earlier patch by Paul E. McKenney, fixing > > > > > a bug encountered in kernels built with CONFIG_PREEMPT=n and > > > > > CONFIG_PREEMPT_COUNT=y. > > > > > > > > This also adds explicit barrier() calls to several internal RCU > > > > functions, but the commit message doesn't explain those at all. > > > > > > To compensate for them being removed from rcu_read_lock() and > > > rcu_read_unlock(), but yes, I will update. > > > > That much seemed clear from the comments, but that doesn't explain *why* > > those functions need barriers of their own even though rcu_read_lock() > > and rcu_read_unlock() don't. > > Ah. The reason is that Tiny RCU and Tree RCU (the !PREEMPT ones) act > by implicitly extending (and, if need be, merging) the RCU read-side > critical sections to include all the code between successive quiescent > states, for example, all the code between a pair of calls to schedule(). > > Therefore, there need to be barrier() calls in the quiescent-state > functions. Some could be argued to be implicitly present due to > translation-unit boundaries, but paranoia and all that. > > Would adding that sort of explanation help? Yes, it would. -- 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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 19:50 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgExc-4Ib-27@gated-at.bofh.it> |
| In reply to | #1240761 |
On Tue, Oct 06, 2015 at 10:16:30AM -0700, Josh Triplett wrote:
> On Tue, Oct 06, 2015 at 10:01:01AM -0700, Paul E. McKenney wrote:
> > On Tue, Oct 06, 2015 at 09:44:45AM -0700, Josh Triplett wrote:
> > > On Tue, Oct 06, 2015 at 09:13:39AM -0700, Paul E. McKenney wrote:
> > > > From: Boqun Feng <boqun.feng@gmail.com>
> > > >
> > > > Because preempt_disable() maps to barrier() for non-debug builds,
> > > > it forces the compiler to spill and reload registers. Because Tree
> > > > RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these
> > > > barrier() instances generate needless extra code for each instance of
> > > > rcu_read_lock() and rcu_read_unlock(). This extra code slows down Tree
> > > > RCU and bloats Tiny RCU.
> > > >
> > > > This commit therefore removes the preempt_disable() and preempt_enable()
> > > > from the non-preemptible implementations of __rcu_read_lock() and
> > > > __rcu_read_unlock(), respectively. However, for debug purposes,
> > > > preempt_disable() and preempt_enable() are still invoked if
> > > > CONFIG_PREEMPT_COUNT=y, because this allows detection of sleeping inside
> > > > atomic sections in non-preemptible kernels.
> > > >
> > > > This is based on an earlier patch by Paul E. McKenney, fixing
> > > > a bug encountered in kernels built with CONFIG_PREEMPT=n and
> > > > CONFIG_PREEMPT_COUNT=y.
> > >
> > > This also adds explicit barrier() calls to several internal RCU
> > > functions, but the commit message doesn't explain those at all.
> >
> > To compensate for them being removed from rcu_read_lock() and
> > rcu_read_unlock(), but yes, I will update.
>
> That much seemed clear from the comments, but that doesn't explain *why*
> those functions need barriers of their own even though rcu_read_lock()
> and rcu_read_unlock() don't.
Ah. The reason is that Tiny RCU and Tree RCU (the !PREEMPT ones) act
by implicitly extending (and, if need be, merging) the RCU read-side
critical sections to include all the code between successive quiescent
states, for example, all the code between a pair of calls to schedule().
Therefore, there need to be barrier() calls in the quiescent-state
functions. Some could be argued to be implicitly present due to
translation-unit boundaries, but paranoia and all that.
Would adding that sort of explanation help?
Thanx, Paul
> > > > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > ---
> > > > include/linux/rcupdate.h | 6 ++++--
> > > > include/linux/rcutiny.h | 1 +
> > > > kernel/rcu/tree.c | 9 +++++++++
> > > > 3 files changed, 14 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > > > index d63bb77dab35..6c3ceceb6148 100644
> > > > --- a/include/linux/rcupdate.h
> > > > +++ b/include/linux/rcupdate.h
> > > > @@ -297,12 +297,14 @@ void synchronize_rcu(void);
> > > >
> > > > static inline void __rcu_read_lock(void)
> > > > {
> > > > - preempt_disable();
> > > > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> > > > + preempt_disable();
> > > > }
> > > >
> > > > static inline void __rcu_read_unlock(void)
> > > > {
> > > > - preempt_enable();
> > > > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> > > > + preempt_enable();
> > > > }
> > > >
> > > > static inline void synchronize_rcu(void)
> > > > diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
> > > > index c8a0722f77ea..4c1aaf9cce7b 100644
> > > > --- a/include/linux/rcutiny.h
> > > > +++ b/include/linux/rcutiny.h
> > > > @@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void)
> > > >
> > > > static inline void rcu_all_qs(void)
> > > > {
> > > > + barrier(); /* Avoid RCU read-side critical sections leaking across. */
> > > > }
> > > >
> > > > #endif /* __LINUX_RCUTINY_H */
> > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > > > index b9d9e0249e2f..93c0f23c3e45 100644
> > > > --- a/kernel/rcu/tree.c
> > > > +++ b/kernel/rcu/tree.c
> > > > @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> > > > */
> > > > void rcu_note_context_switch(void)
> > > > {
> > > > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > > > trace_rcu_utilization(TPS("Start context switch"));
> > > > rcu_sched_qs();
> > > > rcu_preempt_note_context_switch();
> > > > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > > > rcu_momentary_dyntick_idle();
> > > > trace_rcu_utilization(TPS("End context switch"));
> > > > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > > > }
> > > > EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> > > >
> > > > @@ -353,12 +355,19 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> > > > * RCU flavors in desperate need of a quiescent state, which will normally
> > > > * be none of them). Either way, do a lightweight quiescent state for
> > > > * all RCU flavors.
> > > > + *
> > > > + * The barrier() calls are redundant in the common case when this is
> > > > + * called externally, but just in case this is called from within this
> > > > + * file.
> > > > + *
> > > > */
> > > > void rcu_all_qs(void)
> > > > {
> > > > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > > > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > > > rcu_momentary_dyntick_idle();
> > > > this_cpu_inc(rcu_qs_ctr);
> > > > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > > > }
> > > > EXPORT_SYMBOL_GPL(rcu_all_qs);
> > > >
> > > > --
> > > > 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/
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-10-06 22:10 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgGIG-84P-7@gated-at.bofh.it> |
| In reply to | #1240811 |
On Tue, Oct 06, 2015 at 10:42:04AM -0700, Paul E. McKenney wrote:
>
> Ah. The reason is that Tiny RCU and Tree RCU (the !PREEMPT ones) act
> by implicitly extending (and, if need be, merging) the RCU read-side
> critical sections to include all the code between successive quiescent
> states, for example, all the code between a pair of calls to schedule().
>
> Therefore, there need to be barrier() calls in the quiescent-state
> functions. Some could be argued to be implicitly present due to
> translation-unit boundaries, but paranoia and all that.
>
> Would adding that sort of explanation help?
> +++ b/include/linux/rcutiny.h
> @@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void)
>
> static inline void rcu_all_qs(void)
> {
> + barrier(); /* Avoid RCU read-side critical sections leaking across. */
> }
>
> #endif /* __LINUX_RCUTINY_H */
This is more than sheer paranoia I think, inlined functions are not a
compiler barrier.
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index b9d9e0249e2f..93c0f23c3e45 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> */
> void rcu_note_context_switch(void)
> {
> + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> trace_rcu_utilization(TPS("Start context switch"));
> rcu_sched_qs();
> rcu_preempt_note_context_switch();
> if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> rcu_momentary_dyntick_idle();
> trace_rcu_utilization(TPS("End context switch"));
> + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> }
> EXPORT_SYMBOL_GPL(rcu_note_context_switch);
These OTOH could be fixed with a noinline, such that the compiler may
never inline it, even with whole-program-optimizations, thereby
guaranteeing a function call boundary or compiler barrier.
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 22:20 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgGSm-8hZ-7@gated-at.bofh.it> |
| In reply to | #1240936 |
On Tue, Oct 06, 2015 at 10:05:38PM +0200, Peter Zijlstra wrote:
> On Tue, Oct 06, 2015 at 10:42:04AM -0700, Paul E. McKenney wrote:
>
> >
> > Ah. The reason is that Tiny RCU and Tree RCU (the !PREEMPT ones) act
> > by implicitly extending (and, if need be, merging) the RCU read-side
> > critical sections to include all the code between successive quiescent
> > states, for example, all the code between a pair of calls to schedule().
> >
> > Therefore, there need to be barrier() calls in the quiescent-state
> > functions. Some could be argued to be implicitly present due to
> > translation-unit boundaries, but paranoia and all that.
> >
> > Would adding that sort of explanation help?
>
> > +++ b/include/linux/rcutiny.h
> > @@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void)
> >
> > static inline void rcu_all_qs(void)
> > {
> > + barrier(); /* Avoid RCU read-side critical sections leaking across. */
> > }
> >
> > #endif /* __LINUX_RCUTINY_H */
>
> This is more than sheer paranoia I think, inlined functions are not a
> compiler barrier.
Yep, agreed.
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index b9d9e0249e2f..93c0f23c3e45 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> > */
> > void rcu_note_context_switch(void)
> > {
> > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > trace_rcu_utilization(TPS("Start context switch"));
> > rcu_sched_qs();
> > rcu_preempt_note_context_switch();
> > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > rcu_momentary_dyntick_idle();
> > trace_rcu_utilization(TPS("End context switch"));
> > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > }
> > EXPORT_SYMBOL_GPL(rcu_note_context_switch);
>
> These OTOH could be fixed with a noinline, such that the compiler may
> never inline it, even with whole-program-optimizations, thereby
> guaranteeing a function call boundary or compiler barrier.
I like the barrier() with the comment. I expect it will be a bit more
robust against toolchain changes.
Thanx, Paul
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-10-06 23:00 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgHv4-AR-17@gated-at.bofh.it> |
| In reply to | #1240956 |
On Tue, Oct 06, 2015 at 01:18:01PM -0700, Paul E. McKenney wrote:
> On Tue, Oct 06, 2015 at 10:05:38PM +0200, Peter Zijlstra wrote:
> > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > > index b9d9e0249e2f..93c0f23c3e45 100644
> > > --- a/kernel/rcu/tree.c
> > > +++ b/kernel/rcu/tree.c
> > > @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> > > */
> > > void rcu_note_context_switch(void)
> > > {
> > > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > > trace_rcu_utilization(TPS("Start context switch"));
> > > rcu_sched_qs();
> > > rcu_preempt_note_context_switch();
> > > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > > rcu_momentary_dyntick_idle();
> > > trace_rcu_utilization(TPS("End context switch"));
> > > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > > }
> > > EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> >
> > These OTOH could be fixed with a noinline, such that the compiler may
> > never inline it, even with whole-program-optimizations, thereby
> > guaranteeing a function call boundary or compiler barrier.
>
> I like the barrier() with the comment. I expect it will be a bit more
> robust against toolchain changes.
Don't you in fact already rely on the fact that schedule() is a function
call and will not be inlined? (it doesn't have noinline and I suppose
whole program optimizers could go funny on it).
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 23:10 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgHEK-11w-15@gated-at.bofh.it> |
| In reply to | #1240991 |
On Tue, Oct 06, 2015 at 10:52:00PM +0200, Peter Zijlstra wrote:
> On Tue, Oct 06, 2015 at 01:18:01PM -0700, Paul E. McKenney wrote:
> > On Tue, Oct 06, 2015 at 10:05:38PM +0200, Peter Zijlstra wrote:
>
> > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > > > index b9d9e0249e2f..93c0f23c3e45 100644
> > > > --- a/kernel/rcu/tree.c
> > > > +++ b/kernel/rcu/tree.c
> > > > @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> > > > */
> > > > void rcu_note_context_switch(void)
> > > > {
> > > > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > > > trace_rcu_utilization(TPS("Start context switch"));
> > > > rcu_sched_qs();
> > > > rcu_preempt_note_context_switch();
> > > > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > > > rcu_momentary_dyntick_idle();
> > > > trace_rcu_utilization(TPS("End context switch"));
> > > > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > > > }
> > > > EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> > >
> > > These OTOH could be fixed with a noinline, such that the compiler may
> > > never inline it, even with whole-program-optimizations, thereby
> > > guaranteeing a function call boundary or compiler barrier.
> >
> > I like the barrier() with the comment. I expect it will be a bit more
> > robust against toolchain changes.
>
> Don't you in fact already rely on the fact that schedule() is a function
> call and will not be inlined? (it doesn't have noinline and I suppose
> whole program optimizers could go funny on it).
Probably pretty much everywhere I call schedule(). But I was thinking
that barrier() and the beginning and end of an external function didn't
need to do anything. Is that incorrect?
Thanx, Paul
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-10-07 09:30 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgRkK-6pe-15@gated-at.bofh.it> |
| In reply to | #1241002 |
On Tue, Oct 06, 2015 at 02:05:39PM -0700, Paul E. McKenney wrote:
> On Tue, Oct 06, 2015 at 10:52:00PM +0200, Peter Zijlstra wrote:
> > On Tue, Oct 06, 2015 at 01:18:01PM -0700, Paul E. McKenney wrote:
> > > On Tue, Oct 06, 2015 at 10:05:38PM +0200, Peter Zijlstra wrote:
> >
> > > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > > > > index b9d9e0249e2f..93c0f23c3e45 100644
> > > > > --- a/kernel/rcu/tree.c
> > > > > +++ b/kernel/rcu/tree.c
> > > > > @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> > > > > */
> > > > > void rcu_note_context_switch(void)
> > > > > {
> > > > > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > > > > trace_rcu_utilization(TPS("Start context switch"));
> > > > > rcu_sched_qs();
> > > > > rcu_preempt_note_context_switch();
> > > > > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > > > > rcu_momentary_dyntick_idle();
> > > > > trace_rcu_utilization(TPS("End context switch"));
> > > > > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > > > > }
> > > > > EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> > > >
> > > > These OTOH could be fixed with a noinline, such that the compiler may
> > > > never inline it, even with whole-program-optimizations, thereby
> > > > guaranteeing a function call boundary or compiler barrier.
> > >
> > > I like the barrier() with the comment. I expect it will be a bit more
> > > robust against toolchain changes.
> >
> > Don't you in fact already rely on the fact that schedule() is a function
> > call and will not be inlined? (it doesn't have noinline and I suppose
> > whole program optimizers could go funny on it).
>
> Probably pretty much everywhere I call schedule(). But I was thinking
> that barrier() and the beginning and end of an external function didn't
> need to do anything. Is that incorrect?
No. My point was more that by removing barrier() from
rcu_read_{un,}lock() you hard rely on schedule() being a compiler
barrier, and I was thinking you need it to be a function call for that,
but this is incorrect.
Even without it being a function call, there's explicit compiler
barriers in there that even whole program optimizers cannot make go
away, so my bad for creating confusion.
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 19:20 +0200 |
| Subject | Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers |
| Message-ID | <qgE49-49R-21@gated-at.bofh.it> |
| In reply to | #1240710 |
On Tue, Oct 06, 2015 at 09:44:45AM -0700, Josh Triplett wrote:
> On Tue, Oct 06, 2015 at 09:13:39AM -0700, Paul E. McKenney wrote:
> > From: Boqun Feng <boqun.feng@gmail.com>
> >
> > Because preempt_disable() maps to barrier() for non-debug builds,
> > it forces the compiler to spill and reload registers. Because Tree
> > RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these
> > barrier() instances generate needless extra code for each instance of
> > rcu_read_lock() and rcu_read_unlock(). This extra code slows down Tree
> > RCU and bloats Tiny RCU.
> >
> > This commit therefore removes the preempt_disable() and preempt_enable()
> > from the non-preemptible implementations of __rcu_read_lock() and
> > __rcu_read_unlock(), respectively. However, for debug purposes,
> > preempt_disable() and preempt_enable() are still invoked if
> > CONFIG_PREEMPT_COUNT=y, because this allows detection of sleeping inside
> > atomic sections in non-preemptible kernels.
> >
> > This is based on an earlier patch by Paul E. McKenney, fixing
> > a bug encountered in kernels built with CONFIG_PREEMPT=n and
> > CONFIG_PREEMPT_COUNT=y.
>
> This also adds explicit barrier() calls to several internal RCU
> functions, but the commit message doesn't explain those at all.
To compensate for them being removed from rcu_read_lock() and
rcu_read_unlock(), but yes, I will update.
And good catch!
Thanx, Paul
> > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > ---
> > include/linux/rcupdate.h | 6 ++++--
> > include/linux/rcutiny.h | 1 +
> > kernel/rcu/tree.c | 9 +++++++++
> > 3 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > index d63bb77dab35..6c3ceceb6148 100644
> > --- a/include/linux/rcupdate.h
> > +++ b/include/linux/rcupdate.h
> > @@ -297,12 +297,14 @@ void synchronize_rcu(void);
> >
> > static inline void __rcu_read_lock(void)
> > {
> > - preempt_disable();
> > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> > + preempt_disable();
> > }
> >
> > static inline void __rcu_read_unlock(void)
> > {
> > - preempt_enable();
> > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> > + preempt_enable();
> > }
> >
> > static inline void synchronize_rcu(void)
> > diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
> > index c8a0722f77ea..4c1aaf9cce7b 100644
> > --- a/include/linux/rcutiny.h
> > +++ b/include/linux/rcutiny.h
> > @@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void)
> >
> > static inline void rcu_all_qs(void)
> > {
> > + barrier(); /* Avoid RCU read-side critical sections leaking across. */
> > }
> >
> > #endif /* __LINUX_RCUTINY_H */
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index b9d9e0249e2f..93c0f23c3e45 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
> > */
> > void rcu_note_context_switch(void)
> > {
> > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > trace_rcu_utilization(TPS("Start context switch"));
> > rcu_sched_qs();
> > rcu_preempt_note_context_switch();
> > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > rcu_momentary_dyntick_idle();
> > trace_rcu_utilization(TPS("End context switch"));
> > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > }
> > EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> >
> > @@ -353,12 +355,19 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> > * RCU flavors in desperate need of a quiescent state, which will normally
> > * be none of them). Either way, do a lightweight quiescent state for
> > * all RCU flavors.
> > + *
> > + * The barrier() calls are redundant in the common case when this is
> > + * called externally, but just in case this is called from within this
> > + * file.
> > + *
> > */
> > void rcu_all_qs(void)
> > {
> > + barrier(); /* Avoid RCU read-side critical sections leaking down. */
> > if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
> > rcu_momentary_dyntick_idle();
> > this_cpu_inc(rcu_qs_ctr);
> > + barrier(); /* Avoid RCU read-side critical sections leaking up. */
> > }
> > EXPORT_SYMBOL_GPL(rcu_all_qs);
> >
> > --
> > 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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 03/13] rcu: Use call_rcu_func_t to replace explicit type equivalents |
| Message-ID | <qgD86-2O1-41@gated-at.bofh.it> |
| In reply to | #1240639 |
From: Boqun Feng <boqun.feng@gmail.com>
We have had the call_rcu_func_t typedef for a quite awhile, but we still
use explicit function pointer types in some places. These types can
confuse cscope and can be hard to read. This patch therefore replaces
these types with the call_rcu_func_t typedef.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/rcutorture.c | 2 +-
kernel/rcu/tree.h | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 51c8e7f02f48..f9ec6cbe77d3 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -252,7 +252,7 @@ struct rcu_torture_ops {
void (*exp_sync)(void);
unsigned long (*get_state)(void);
void (*cond_sync)(unsigned long oldstate);
- void (*call)(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
+ call_rcu_func_t call;
void (*cb_barrier)(void);
void (*fqs)(void);
void (*stats)(void);
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index ad11529375cc..0c33c82cec64 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -464,8 +464,7 @@ struct rcu_state {
/* shut bogus gcc warning) */
u8 flavor_mask; /* bit in flavor mask. */
struct rcu_data __percpu *rda; /* pointer of percu rcu_data. */
- void (*call)(struct rcu_head *head, /* call_rcu() flavor. */
- void (*func)(struct rcu_head *head));
+ call_rcu_func_t call; /* call_rcu() flavor. */
/* The following fields are guarded by the root rcu_node's lock. */
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 01/13] sched: Export sched_setscheduler_nocheck |
| Message-ID | <qgD85-2O1-5@gated-at.bofh.it> |
| In reply to | #1240639 |
From: Davidlohr Bueso <dave@stgolabs.net>
The new locktorture rtmutex_lock tests exercise priority boosting, which
means that they need to set some tasks to real-time priority. To do this,
they use sched_setscheduler_nocheck(). However, this is not exported to
modules, which results in the following error when building locktorture
as a module:
ERROR: "sched_setscheduler_nocheck" [kernel/locking/locktorture.ko] undefined!
This commit therefore adds an EXPORT_SYMBOL_GPL() to allow this function
to be invoked from locktorture when built as a module.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2f9c92884817..c4e607873d6f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4022,6 +4022,7 @@ int sched_setscheduler_nocheck(struct task_struct *p, int policy,
{
return _sched_setscheduler(p, policy, param, false);
}
+EXPORT_SYMBOL_GPL(sched_setscheduler_nocheck);
static int
do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 09/13] rcu: Correct comment for values of ->gp_state field |
| Message-ID | <qgD87-2O1-53@gated-at.bofh.it> |
| In reply to | #1240644 |
This commit corrects the comment for the values of the ->gp_state field,
which previously incorrectly said that these were for the ->gp_flags
field.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index be6d1e8eeb79..674ebbc3e406 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -529,7 +529,7 @@ struct rcu_state {
#define RCU_GP_FLAG_INIT 0x1 /* Need grace-period initialization. */
#define RCU_GP_FLAG_FQS 0x2 /* Need grace-period quiescent-state forcing. */
-/* Values for rcu_state structure's gp_flags field. */
+/* Values for rcu_state structure's gp_state field. */
#define RCU_GP_IDLE 0 /* Initial state and no GP in progress. */
#define RCU_GP_WAIT_GPS 1 /* Wait for grace-period start. */
#define RCU_GP_DONE_GPS 2 /* Wait done for grace-period start. */
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 11/13] rculist: Make list_entry_rcu() use lockless_dereference() |
| Message-ID | <qgD87-2O1-61@gated-at.bofh.it> |
| In reply to | #1240644 |
From: Patrick Marlier <patrick.marlier@gmail.com>
The current list_entry_rcu() implementation copies the pointer to a stack
variable, then invokes rcu_dereference_raw() on it. This results in an
additional store-load pair. Now, most compilers will emit normal store
and load instructions, which might seem to be of negligible overhead,
but this results in a load-hit-store situation that can cause surprisingly
long pipeline stalls, even on modern microprocessors. The problem is
that it takes time for the store to get the store buffer updated, which
can delay the subsequent load, which immediately follows.
This commit therefore switches to the lockless_dereference() primitive,
which does not expect the __rcu annotations (that are anyway not present
in the list_head structure) and which, like rcu_dereference_raw(),
does not check for an enclosing RCU read-side critical section.
Most importantly, it does not copy the pointer, thus avoiding the
load-hit-store overhead.
Signed-off-by: Patrick Marlier <patrick.marlier@gmail.com>
[ paulmck: Switched to lockless_dereference() to suppress sparse warnings. ]
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
include/linux/rculist.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 17c6b1f84a77..5ed540986019 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -247,10 +247,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
* primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
*/
#define list_entry_rcu(ptr, type, member) \
-({ \
- typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \
- container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member); \
-})
+ container_of(lockless_dereference(ptr), type, member)
/**
* Where are list_empty_rcu() and list_first_entry_rcu()?
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 02/13] rcu: Use rcu_callback_t in call_rcu*() and friends |
| Message-ID | <qgD87-2O1-63@gated-at.bofh.it> |
| In reply to | #1240644 |
From: Boqun Feng <boqun.feng@gmail.com>
As we now have rcu_callback_t typedefs as the type of rcu callbacks, we
should use it in call_rcu*() and friends as the type of parameters. This
could save us a few lines of code and make it clear which function
requires an rcu callbacks rather than other callbacks as its argument.
Besides, this can also help cscope to generate a better database for
code reading.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
include/linux/rcupdate.h | 10 +++++-----
include/linux/rcutiny.h | 2 +-
include/linux/rcutree.h | 2 +-
kernel/rcu/rcutorture.c | 4 ++--
kernel/rcu/srcu.c | 2 +-
kernel/rcu/tiny.c | 8 ++++----
kernel/rcu/tree.c | 8 ++++----
kernel/rcu/tree.h | 2 +-
kernel/rcu/tree_plugin.h | 2 +-
kernel/rcu/update.c | 2 +-
10 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 581abf848566..d63bb77dab35 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -160,7 +160,7 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
* more than one CPU).
*/
void call_rcu(struct rcu_head *head,
- void (*func)(struct rcu_head *head));
+ rcu_callback_t func);
#else /* #ifdef CONFIG_PREEMPT_RCU */
@@ -191,7 +191,7 @@ void call_rcu(struct rcu_head *head,
* memory ordering guarantees.
*/
void call_rcu_bh(struct rcu_head *head,
- void (*func)(struct rcu_head *head));
+ rcu_callback_t func);
/**
* call_rcu_sched() - Queue an RCU for invocation after sched grace period.
@@ -213,7 +213,7 @@ void call_rcu_bh(struct rcu_head *head,
* memory ordering guarantees.
*/
void call_rcu_sched(struct rcu_head *head,
- void (*func)(struct rcu_head *rcu));
+ rcu_callback_t func);
void synchronize_sched(void);
@@ -274,7 +274,7 @@ do { \
* See the description of call_rcu() for more detailed information on
* memory ordering guarantees.
*/
-void call_rcu_tasks(struct rcu_head *head, void (*func)(struct rcu_head *head));
+void call_rcu_tasks(struct rcu_head *head, rcu_callback_t func);
void synchronize_rcu_tasks(void);
void rcu_barrier_tasks(void);
@@ -1065,7 +1065,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
#define __kfree_rcu(head, offset) \
do { \
BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \
- kfree_call_rcu(head, (void (*)(struct rcu_head *))(unsigned long)(offset)); \
+ kfree_call_rcu(head, (rcu_callback_t)(unsigned long)(offset)); \
} while (0)
/**
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index ff968b7af3a4..c8a0722f77ea 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -83,7 +83,7 @@ static inline void synchronize_sched_expedited(void)
}
static inline void kfree_call_rcu(struct rcu_head *head,
- void (*func)(struct rcu_head *rcu))
+ rcu_callback_t func)
{
call_rcu(head, func);
}
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 5abec82f325e..60d15a080d7c 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -48,7 +48,7 @@ void synchronize_rcu_bh(void);
void synchronize_sched_expedited(void);
void synchronize_rcu_expedited(void);
-void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
+void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func);
/**
* synchronize_rcu_bh_expedited - Brute-force RCU-bh grace period
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 77192953dee5..51c8e7f02f48 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -448,7 +448,7 @@ static void synchronize_rcu_busted(void)
}
static void
-call_rcu_busted(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
+call_rcu_busted(struct rcu_head *head, rcu_callback_t func)
{
/* This is a deliberate bug for testing purposes only! */
func(head);
@@ -523,7 +523,7 @@ static void srcu_torture_synchronize(void)
}
static void srcu_torture_call(struct rcu_head *head,
- void (*func)(struct rcu_head *head))
+ rcu_callback_t func)
{
call_srcu(srcu_ctlp, head, func);
}
diff --git a/kernel/rcu/srcu.c b/kernel/rcu/srcu.c
index d3fcb2ec8536..9e6122540d28 100644
--- a/kernel/rcu/srcu.c
+++ b/kernel/rcu/srcu.c
@@ -387,7 +387,7 @@ static void srcu_flip(struct srcu_struct *sp)
* srcu_struct structure.
*/
void call_srcu(struct srcu_struct *sp, struct rcu_head *head,
- void (*func)(struct rcu_head *head))
+ rcu_callback_t func)
{
unsigned long flags;
diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c
index d0471056d0af..944b1b491ed8 100644
--- a/kernel/rcu/tiny.c
+++ b/kernel/rcu/tiny.c
@@ -44,7 +44,7 @@ struct rcu_ctrlblk;
static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp);
static void rcu_process_callbacks(struct softirq_action *unused);
static void __call_rcu(struct rcu_head *head,
- void (*func)(struct rcu_head *rcu),
+ rcu_callback_t func,
struct rcu_ctrlblk *rcp);
#include "tiny_plugin.h"
@@ -203,7 +203,7 @@ EXPORT_SYMBOL_GPL(synchronize_sched);
* Helper function for call_rcu() and call_rcu_bh().
*/
static void __call_rcu(struct rcu_head *head,
- void (*func)(struct rcu_head *rcu),
+ rcu_callback_t func,
struct rcu_ctrlblk *rcp)
{
unsigned long flags;
@@ -229,7 +229,7 @@ static void __call_rcu(struct rcu_head *head,
* period. But since we have but one CPU, that would be after any
* quiescent state.
*/
-void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
+void call_rcu_sched(struct rcu_head *head, rcu_callback_t func)
{
__call_rcu(head, func, &rcu_sched_ctrlblk);
}
@@ -239,7 +239,7 @@ EXPORT_SYMBOL_GPL(call_rcu_sched);
* Post an RCU bottom-half callback to be invoked after any subsequent
* quiescent state.
*/
-void call_rcu_bh(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
+void call_rcu_bh(struct rcu_head *head, rcu_callback_t func)
{
__call_rcu(head, func, &rcu_bh_ctrlblk);
}
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 775d36cc0050..b9d9e0249e2f 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3017,7 +3017,7 @@ static void rcu_leak_callback(struct rcu_head *rhp)
* is expected to specify a CPU.
*/
static void
-__call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu),
+__call_rcu(struct rcu_head *head, rcu_callback_t func,
struct rcu_state *rsp, int cpu, bool lazy)
{
unsigned long flags;
@@ -3088,7 +3088,7 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu),
/*
* Queue an RCU-sched callback for invocation after a grace period.
*/
-void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
+void call_rcu_sched(struct rcu_head *head, rcu_callback_t func)
{
__call_rcu(head, func, &rcu_sched_state, -1, 0);
}
@@ -3097,7 +3097,7 @@ EXPORT_SYMBOL_GPL(call_rcu_sched);
/*
* Queue an RCU callback for invocation after a quicker grace period.
*/
-void call_rcu_bh(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
+void call_rcu_bh(struct rcu_head *head, rcu_callback_t func)
{
__call_rcu(head, func, &rcu_bh_state, -1, 0);
}
@@ -3111,7 +3111,7 @@ EXPORT_SYMBOL_GPL(call_rcu_bh);
* function may only be called from __kfree_rcu().
*/
void kfree_call_rcu(struct rcu_head *head,
- void (*func)(struct rcu_head *rcu))
+ rcu_callback_t func)
{
__call_rcu(head, func, rcu_state_p, -1, 1);
}
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 2e991f8361e4..ad11529375cc 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -584,7 +584,7 @@ static void rcu_print_detail_task_stall(struct rcu_state *rsp);
static int rcu_print_task_stall(struct rcu_node *rnp);
static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp);
static void rcu_preempt_check_callbacks(void);
-void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
+void call_rcu(struct rcu_head *head, rcu_callback_t func);
static void __init __rcu_init_preempt(void);
static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags);
static void rcu_preempt_boost_start_gp(struct rcu_node *rnp);
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index b2bf3963a0ae..06116ae6dfd7 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -500,7 +500,7 @@ static void rcu_preempt_do_callbacks(void)
/*
* Queue a preemptible-RCU callback for invocation after a grace period.
*/
-void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
+void call_rcu(struct rcu_head *head, rcu_callback_t func)
{
__call_rcu(head, func, rcu_state_p, -1, 0);
}
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index 7a0b3bc7c5ed..5f748c5a40f0 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -534,7 +534,7 @@ static void rcu_spawn_tasks_kthread(void);
* Post an RCU-tasks callback. First call must be from process context
* after the scheduler if fully operational.
*/
-void call_rcu_tasks(struct rcu_head *rhp, void (*func)(struct rcu_head *rhp))
+void call_rcu_tasks(struct rcu_head *rhp, rcu_callback_t func)
{
unsigned long flags;
bool needwake;
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 12/13] rcu: Remove deprecated rcu_lockdep_assert() |
| Message-ID | <qgD87-2O1-67@gated-at.bofh.it> |
| In reply to | #1240644 |
The old rcu_lockdep_assert() was retained to ease handling of incoming
patches, but any use will result in deprecated warnings. However, its
replacement, RCU_LOCKDEP_WARN(), is now upstream. It is therefore
time to remove rcu_lockdep_assert(), which this commit does.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
include/linux/rcupdate.h | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 587eb057e2fa..a0189ba67fde 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -537,29 +537,9 @@ static inline int rcu_read_lock_sched_held(void)
#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
-/* Deprecate rcu_lockdep_assert(): Use RCU_LOCKDEP_WARN() instead. */
-static inline void __attribute((deprecated)) deprecate_rcu_lockdep_assert(void)
-{
-}
-
#ifdef CONFIG_PROVE_RCU
/**
- * rcu_lockdep_assert - emit lockdep splat if specified condition not met
- * @c: condition to check
- * @s: informative message
- */
-#define rcu_lockdep_assert(c, s) \
- do { \
- static bool __section(.data.unlikely) __warned; \
- deprecate_rcu_lockdep_assert(); \
- if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \
- __warned = true; \
- lockdep_rcu_suspicious(__FILE__, __LINE__, s); \
- } \
- } while (0)
-
-/**
* RCU_LOCKDEP_WARN - emit lockdep splat if specified condition is met
* @c: condition to check
* @s: informative message
@@ -596,7 +576,6 @@ static inline void rcu_preempt_sleep_check(void)
#else /* #ifdef CONFIG_PROVE_RCU */
-#define rcu_lockdep_assert(c, s) deprecate_rcu_lockdep_assert()
#define RCU_LOCKDEP_WARN(c, s) do { } while (0)
#define rcu_sleep_check() do { } while (0)
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 18:20 +0200 |
| Subject | [PATCH tip/core/rcu 06/13] rcu: Add online/offline info to stall warning message |
| Message-ID | <qgD87-2O1-71@gated-at.bofh.it> |
| In reply to | #1240644 |
This commit makes the RCU CPU stall warning message print online/offline
indications immediately after the CPU number. A "?" indicates global
offline, a "," global online, and a "!" indicates RCU believes that the
CPU is offline and "." otherwise, both right after the CPU number.
So for CPU 10, you would normally see "10,.:" indicating that everything
believes that the CPU is online.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree_plugin.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 06116ae6dfd7..57ed9c13ae5a 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1702,8 +1702,12 @@ static void print_cpu_stall_info(struct rcu_state *rsp, int cpu)
ticks_value = rsp->gpnum - rdp->gpnum;
}
print_cpu_stall_fast_no_hz(fast_no_hz, cpu);
- pr_err("\t%d: (%lu %s) idle=%03x/%llx/%d softirq=%u/%u fqs=%ld %s\n",
- cpu, ticks_value, ticks_title,
+ pr_err("\t%d-%c%c%c: (%lu %s) idle=%03x/%llx/%d softirq=%u/%u fqs=%ld %s\n",
+ cpu,
+ "O."[!!cpu_online(cpu)],
+ "o."[!!(rdp->grpmask & rdp->mynode->qsmaskinit)],
+ "N."[!!(rdp->grpmask & rdp->mynode->qsmaskinitnext)],
+ ticks_value, ticks_title,
atomic_read(&rdtp->dynticks) & 0xfff,
rdtp->dynticks_nesting, rdtp->dynticks_nmi_nesting,
rdp->softirq_snap, kstat_softirqs_cpu(RCU_SOFTIRQ, cpu),
--
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/
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web