rcu: trace_rcu_utilization() paired
PATCH 3/7 rcu: trace_rcu_utilization() paired
The notations include "Start" and "End", it is better when there are paired.
--- kernel/rcu/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/rcu/tree.c +2 -1
@@ -2484,8 +2484,8 @@ static void rcu_cpu_kthread(unsigned int cpu)char work, *workp =this_cpu_ptr (&rcu_data.rcu_cpu_has_work);int spincnt; +trace_rcu_utilization (TPS ("Start CPU kthread@rcu_run" ));for (spincnt =0 ; spincnt <10 ; spincnt++) { -trace_rcu_utilization (TPS ("Start CPU kthread@rcu_run" ));local_bh_disable (); *statusp =RCU_KTHREAD_RUNNING ;local_irq_disable ();
@@ -2501,6 +2501,7 @@ static void rcu_cpu_kthread(unsigned int cpu)return ; } } +trace_rcu_utilization (TPS ("End CPU kthread@rcu_run" )); *statusp =RCU_KTHREAD_YIELDING ;trace_rcu_utilization (TPS ("Start CPU kthread@rcu_yield" ));schedule_timeout_interruptible (2 );
Signature · 1 line
2.20.1
PATCH 4/7 rcu: remove the declaration of call_rcu() in tree.h
call_rcu() is external RCU API declared in include/linux/, and doesn't need to be (re-)declared in internal files again.
--- kernel/rcu/tree.h | 1 - 1 file changed, 1 deletion(-)
kernel/rcu/tree.h +0 -1
@@ -412,7 +412,6 @@ static bool rcu_preempt_has_tasks(struct rcu_node *rnp);static int rcu_print_task_exp_stall (struct rcu_node *rnp);static void rcu_preempt_check_blocked_tasks (struct rcu_node *rnp);static void rcu_flavor_sched_clock_irq (int user); -void call_rcu (struct rcu_head *head,rcu_callback_t func);static void dump_blkd_tasks (struct rcu_node *rnp,int ncheck);static void rcu_initiate_boost (struct rcu_node *rnp,unsigned long flags);static void rcu_preempt_boost_start_gp (struct rcu_node *rnp);
Signature · 1 line
2.20.1
Paul E. McKenney
maintainerRe: [PATCH 4/7] rcu: remove the declaration of call_rcu() in tree.h
Quoted 5 lines · Lai Jiangshan
call_rcu()is external RCU API declared ininclude/linux/, and doesn't need to be (re-)declared in internal files again.Signed-off-by Lai Jiangshan <[email protected]>Signed-off-by Lai Jiangshan <[email protected]>
Good catch!
Queued for testing and review, thank you!
Thanx, Paul
Quoted 19 lines
--- kernel/rcu/tree.h | 1 - 1 file changed, 1 deletion(-)kernel/rcu/tree.h +0
-1@@ -412,7 +412,6 @@ static bool rcu_preempt_has_tasks(struct rcu_node *rnp);static int rcu_print_task_exp_stall (struct rcu_node *rnp);static void rcu_preempt_check_blocked_tasks (struct rcu_node *rnp);static void rcu_flavor_sched_clock_irq (int user); -void call_rcu (struct rcu_head *head,rcu_callback_t func);static void dump_blkd_tasks (struct rcu_node *rnp,int ncheck);static void rcu_initiate_boost (struct rcu_node *rnp,unsigned long flags);static void rcu_preempt_boost_start_gp (struct rcu_node *rnp);Signature · 1 line
2.20.1
PATCH 5/7 rcu: move gp_state_names[] and gp_state_getname() to tree_stall.h
In reply to Lai JiangshanOnly tree_stall.h needs to get name from GP state.
--- kernel/rcu/tree.c | 10 ---------- kernel/rcu/tree.h | 12 ------------ kernel/rcu/tree_stall.h | 22 ++++++++++++++++++++++ 3 files changed, 22 insertions(+), 22 deletions(-)
kernel/rcu/tree.c +0 -10
@@ -529,16 +529,6 @@ static struct rcu_node *rcu_get_root(void)return &rcu_state.node[0 ]; } -/* -* Convert a ->gp_state value to a character string. -*/ -static const char *gp_state_getname (short gs) -{ -if (gs <0 || gs >=ARRAY_SIZE (gp_state_names)) -return "???" ; -return gp_state_names[gs]; -} -/* * Send along grace-period-related data for rcutorture diagnostics. */
kernel/rcu/tree.h +0 -12
@@ -367,18 +367,6 @@ struct rcu_state {#define RCU_GP_CLEANUP 7/* Grace-period cleanup started. */ #define RCU_GP_CLEANED 8/* Grace-period cleanup complete. */ -static const char *const gp_state_names[] = { -"RCU_GP_IDLE" , -"RCU_GP_WAIT_GPS" , -"RCU_GP_DONE_GPS" , -"RCU_GP_ONOFF" , -"RCU_GP_INIT" , -"RCU_GP_WAIT_FQS" , -"RCU_GP_DOING_FQS" , -"RCU_GP_CLEANUP" , -"RCU_GP_CLEANED" , -}; -/* * In order to export the rcu_state name to the tracing tools, it * needs to be added in the __tracepoint_string section.
kernel/rcu/tree_stall.h +22 -0
@@ -277,6 +277,28 @@ static void print_cpu_stall_fast_no_hz(char *cp, int cpu)#endif /* #else #ifdef CONFIG_RCU_FAST_NO_HZ */ +static const char *const gp_state_names[] = { + [RCU_GP_IDLE ] ="RCU_GP_IDLE" , + [RCU_GP_WAIT_GPS ] ="RCU_GP_WAIT_GPS" , + [RCU_GP_DONE_GPS ] ="RCU_GP_DONE_GPS" , + [RCU_GP_ONOFF ] ="RCU_GP_ONOFF" , + [RCU_GP_INIT ] ="RCU_GP_INIT" , + [RCU_GP_WAIT_FQS ] ="RCU_GP_WAIT_FQS" , + [RCU_GP_DOING_FQS ] ="RCU_GP_DOING_FQS" , + [RCU_GP_CLEANUP ] ="RCU_GP_CLEANUP" , + [RCU_GP_CLEANED ] ="RCU_GP_CLEANED" , +}; + +/* +* Convert a ->gp_state value to a character string. +*/ +static const char *gp_state_getname (short gs) +{ +if (gs <0 || gs >=ARRAY_SIZE (gp_state_names)) +return "???" ; +return gp_state_names[gs]; +} +/* * Print out diagnostic information for the specified stalled CPU. *
Signature · 1 line
2.20.1
PATCH 6/7 rcu: rename some CONFIG_PREEMPTION to CONFIG_PREEMPT_RCU
In reply to Lai JiangshanCONFIG_PREEMPTION and CONFIG_PREEMPT_RCU are always identical, but some code depends on CONFIG_PREEMPTION to access to rcu_preempt functionalitis. This patch changes CONFIG_PREEMPTION to CONFIG_PREEMPT_RCU in these cases.
--- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree_stall.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
kernel/rcu/tree.c +2 -2
@@ -1926,7 +1926,7 @@ rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)struct rcu_node *rnp_p;raw_lockdep_assert_held_rcu_node (rnp); -if (WARN_ON_ONCE (!IS_ENABLED (CONFIG_PREEMPTION )) || +if (WARN_ON_ONCE (!IS_ENABLED (CONFIG_PREEMPT_RCU )) ||WARN_ON_ONCE (rcu_preempt_blocked_readers_cgp (rnp)) || rnp->qsmask !=0 ) {raw_spin_unlock_irqrestore_rcu_node (rnp, flags);
@@ -2294,7 +2294,7 @@ static void force_qs_rnp(int (*f)(struct rcu_data *rdp)) mask =0 ;raw_spin_lock_irqsave_rcu_node (rnp, flags);if (rnp->qsmask ==0 ) { -if (!IS_ENABLED (CONFIG_PREEMPTION ) || +if (!IS_ENABLED (CONFIG_PREEMPT_RCU ) ||rcu_preempt_blocked_readers_cgp (rnp)) {/* * No point in scanning bits because they
kernel/rcu/tree_stall.h +3 -3
@@ -163,7 +163,7 @@ static void rcu_iw_handler(struct irq_work *iwp)// // Printing RCU CPU stall warnings -#ifdef CONFIG_PREEMPTION +#ifdef CONFIG_PREEMPT_RCU /* * Dump detailed information for all tasks blocking the current RCU
@@ -215,7 +215,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp) return ndetected; } -#else /* #ifdef CONFIG_PREEMPTION */ +#else /* #ifdef CONFIG_PREEMPT_RCU */ /* * Because preemptible RCU does not exist, we never have to check for
@@ -233,7 +233,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp) {return 0 ; } -#endif /* #else #ifdef CONFIG_PREEMPTION */ +#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ /* * Dump stacks of all tasks running on stalled CPUs. First try using
Signature · 1 line
2.20.1
Paul E. McKenney
maintainerRe: [PATCH 6/7] rcu: rename some CONFIG_PREEMPTION to CONFIG_PREEMPT_RCU
Quoted 7 lines · Lai Jiangshan
CONFIG_PREEMPTIONandCONFIG_PREEMPT_RCUare always identical, but some code depends onCONFIG_PREEMPTIONto access torcu_preemptfunctionalitis. This patch changesCONFIG_PREEMPTIONtoCONFIG_PREEMPT_RCUin these cases.Signed-off-by Lai Jiangshan <[email protected]>Signed-off-by Lai Jiangshan <[email protected]>
I believe that this does not cause problems with Sebastian's patch "[PATCH 27/34] rcu: Use CONFIG_PREEMPTION where appropriate", but could you please check?
Thanx, Paul
Quoted 61 lines
--- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree_stall.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)kernel/rcu/tree.c +2
-2@@ -1926,7 +1926,7 @@ rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)struct rcu_node *rnp_p;raw_lockdep_assert_held_rcu_node (rnp); -if (WARN_ON_ONCE (!IS_ENABLED (CONFIG_PREEMPTION )) || +if (WARN_ON_ONCE (!IS_ENABLED (CONFIG_PREEMPT_RCU )) ||WARN_ON_ONCE (rcu_preempt_blocked_readers_cgp (rnp)) || rnp->qsmask !=0 ) {raw_spin_unlock_irqrestore_rcu_node (rnp, flags);@@ -2294,7 +2294,7 @@ static void force_qs_rnp(int (*f)(struct rcu_data *rdp)) mask =0 ;raw_spin_lock_irqsave_rcu_node (rnp, flags);if (rnp->qsmask ==0 ) { -if (!IS_ENABLED (CONFIG_PREEMPTION ) || +if (!IS_ENABLED (CONFIG_PREEMPT_RCU ) ||rcu_preempt_blocked_readers_cgp (rnp)) {/* * No point in scanning bits because they kernel/rcu/tree_stall.h +3
-3@@ -163,7 +163,7 @@ static void rcu_iw_handler(struct irq_work *iwp)// // Printing RCU CPU stall warnings -#ifdef CONFIG_PREEMPTION +#ifdef CONFIG_PREEMPT_RCU /* * Dump detailed information for all tasks blocking the current RCU @@ -215,7 +215,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp) return ndetected; } -#else /* #ifdef CONFIG_PREEMPTION */ +#else /* #ifdef CONFIG_PREEMPT_RCU */ /* * Because preemptible RCU does not exist, we never have to check for @@ -233,7 +233,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp) {return 0 ; } -#endif /* #else #ifdef CONFIG_PREEMPTION */ +#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ /* * Dump stacks of all tasks running on stalled CPUs. First try using Signature · 1 line
2.20.1
Re: [PATCH 6/7] rcu: rename some CONFIG_PREEMPTION to CONFIG_PREEMPT_RCU
Quoted 6 lines · Paul E. McKenney
Quoted 5 lines · Lai Jiangshan
CONFIG_PREEMPTIONandCONFIG_PREEMPT_RCUare always identical, but some code depends onCONFIG_PREEMPTIONto access torcu_preemptfunctionalitis. This patch changesCONFIG_PREEMPTIONtoCONFIG_PREEMPT_RCUin these cases.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Lai Jiangshan <[email protected]>Signed-off-by Lai Jiangshan <[email protected]>I believe that this does not cause problems with Sebastian's patch "[PATCH 27/34] rcu: Use
CONFIG_PREEMPTIONwhere appropriate", but could you please check?
I don't know for which commit the patch "[PATCH 27/34] rcu: Use CONFIG_PREEMPTION where appropriate" should be applied against after several tries. But I don't think there will be any conflicts which this patch by "eye" applying.
Thanks,
Lai
Quoted 64 lines
Thanx, Paul
Quoted 61 lines
--- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree_stall.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)kernel/rcu/tree.c +2
-2@@ -1926,7 +1926,7 @@ rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)struct rcu_node *rnp_p;raw_lockdep_assert_held_rcu_node (rnp); -if (WARN_ON_ONCE (!IS_ENABLED (CONFIG_PREEMPTION )) || +if (WARN_ON_ONCE (!IS_ENABLED (CONFIG_PREEMPT_RCU )) ||WARN_ON_ONCE (rcu_preempt_blocked_readers_cgp (rnp)) || rnp->qsmask !=0 ) {raw_spin_unlock_irqrestore_rcu_node (rnp, flags);@@ -2294,7 +2294,7 @@ static void force_qs_rnp(int (*f)(struct rcu_data *rdp)) mask =0 ;raw_spin_lock_irqsave_rcu_node (rnp, flags);if (rnp->qsmask ==0 ) { -if (!IS_ENABLED (CONFIG_PREEMPTION ) || +if (!IS_ENABLED (CONFIG_PREEMPT_RCU ) ||rcu_preempt_blocked_readers_cgp (rnp)) {/* * No point in scanning bits because they kernel/rcu/tree_stall.h +3
-3@@ -163,7 +163,7 @@ static void rcu_iw_handler(struct irq_work *iwp)// // Printing RCU CPU stall warnings -#ifdef CONFIG_PREEMPTION +#ifdef CONFIG_PREEMPT_RCU /* * Dump detailed information for all tasks blocking the current RCU @@ -215,7 +215,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp) return ndetected; } -#else /* #ifdef CONFIG_PREEMPTION */ +#else /* #ifdef CONFIG_PREEMPT_RCU */ /* * Because preemptible RCU does not exist, we never have to check for @@ -233,7 +233,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp) {return 0 ; } -#endif /* #else #ifdef CONFIG_PREEMPTION */ +#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ /* * Dump stacks of all tasks running on stalled CPUs. First try using Signature · 1 line
2.20.1
Paul E. McKenney
maintainerRe: [PATCH 6/7] rcu: rename some CONFIG_PREEMPTION to CONFIG_PREEMPT_RCU
Quoted 12 lines · Lai Jiangshan
Quoted 9 lines · Paul E. McKenney
Quoted 7 lines · Lai Jiangshan
CONFIG_PREEMPTIONandCONFIG_PREEMPT_RCUare always identical, but some code depends onCONFIG_PREEMPTIONto access torcu_preemptfunctionalitis. This patch changesCONFIG_PREEMPTIONtoCONFIG_PREEMPT_RCUin these cases.Signed-off-by Lai Jiangshan <[email protected]>Signed-off-by Lai Jiangshan <[email protected]>
Quoted 8 lines
Quoted 3 lines
I believe that this does not cause problems with Sebastian's patch "[PATCH 27/34] rcu: Use
CONFIG_PREEMPTIONwhere appropriate", but could you please check?I don't know for which commit the patch "[PATCH 27/34] rcu: Use
CONFIG_PREEMPTIONwhere appropriate" should be applied against after several tries. But I don't think there will be any conflicts which this patch by "eye" applying.
Well, git didn't see any either, so it is now applied for review and testing. Thank you!
Thanx, Paul
Quoted 63 lines
Thanks,
LaiQuoted 58 lines
Thanx, Paul
Quoted 55 lines
--- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree_stall.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)kernel/rcu/tree.c +2
-2@@ -1926,7 +1926,7 @@ rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)struct rcu_node *rnp_p;raw_lockdep_assert_held_rcu_node (rnp); -if (WARN_ON_ONCE (!IS_ENABLED (CONFIG_PREEMPTION )) || +if (WARN_ON_ONCE (!IS_ENABLED (CONFIG_PREEMPT_RCU )) ||WARN_ON_ONCE (rcu_preempt_blocked_readers_cgp (rnp)) || rnp->qsmask !=0 ) {raw_spin_unlock_irqrestore_rcu_node (rnp, flags);@@ -2294,7 +2294,7 @@ static void force_qs_rnp(int (*f)(struct rcu_data *rdp)) mask =0 ;raw_spin_lock_irqsave_rcu_node (rnp, flags);if (rnp->qsmask ==0 ) { -if (!IS_ENABLED (CONFIG_PREEMPTION ) || +if (!IS_ENABLED (CONFIG_PREEMPT_RCU ) ||rcu_preempt_blocked_readers_cgp (rnp)) {/* * No point in scanning bits because they kernel/rcu/tree_stall.h +3
-3@@ -163,7 +163,7 @@ static void rcu_iw_handler(struct irq_work *iwp)// // Printing RCU CPU stall warnings -#ifdef CONFIG_PREEMPTION +#ifdef CONFIG_PREEMPT_RCU /* * Dump detailed information for all tasks blocking the current RCU @@ -215,7 +215,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp) return ndetected; } -#else /* #ifdef CONFIG_PREEMPTION */ +#else /* #ifdef CONFIG_PREEMPT_RCU */ /* * Because preemptible RCU does not exist, we never have to check for @@ -233,7 +233,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp) {return 0 ; } -#endif /* #else #ifdef CONFIG_PREEMPTION */ +#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ /* * Dump stacks of all tasks running on stalled CPUs. First try using Signature · 1 line
2.20.1
PATCH 7/7 rcu: splite tasks_rcu to tasks.c
In reply to Lai Jiangshantree_plugin.h is all about TREE_RCU&PREEMPT_RCU, where TASKS_RCU is a quite different flavor which ought to be in its own file.
The big '#ifdef CONFIG_TASKS_RCU' code block is moved to tasks.c unchanged along with about 40 lines in the head of the file and the function rcu_tasks_bootup_oddness() whose declaration and call-site are also (forced) changed. Nothing else is changed.
./scripts/checkpatch.pl gives four warnings, but they don't need to be fixed.
--- kernel/rcu/Makefile | 1 + kernel/rcu/tasks.c | 395 +++++++++++++++++++++++++++++++++++++++ kernel/rcu/tree.h | 2 + kernel/rcu/tree_plugin.h | 1 + kernel/rcu/update.c | 365 ------------------------------------ 5 files changed, 399 insertions(+), 365 deletions(-) create mode 100644 kernel/rcu/tasks.c
kernel/rcu/Makefile +1 -0
@@ -10,4 +10,5 @@ obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o obj-$(CONFIG_RCU_PERF_TEST) += rcuperf.o obj-$(CONFIG_TREE_RCU) += tree.o obj-$(CONFIG_TINY_RCU) += tiny.o +obj-$(CONFIG_TASKS_RCU) += tasks.o obj-$(CONFIG_RCU_NEED_SEGCBLIST) += rcu_segcblist.o
kernel/rcu/tasks.c new file +395 -0
395 lines not on this page · raw message
kernel/rcu/tree.h +2 -0
@@ -390,6 +390,8 @@ static const char *tp_rcu_varname __used __tracepoint_string = rcu_name;#define RCU_NAME rcu_name#endif /* #else #ifdef CONFIG_TRACING */ +extern void rcu_tasks_bootup_oddness (void ); +/* Forward declarations for tree_plugin.h */ static void rcu_bootup_announce (void );static void rcu_qs (void );
kernel/rcu/tree_plugin.h +1 -0
@@ -77,6 +77,7 @@ static void __init rcu_bootup_announce_oddness(void)if (IS_ENABLED (CONFIG_RCU_EQS_DEBUG ))pr_info ("\tRCU debug extended QS entry/exit.\n" );rcupdate_announce_bootup_oddness (); +rcu_tasks_bootup_oddness (); }#ifdef CONFIG_PREEMPT_RCU
kernel/rcu/update.c +0 -365
377 lines not on this page · raw message
Signature · 1 line
2.20.1
Paul E. McKenney
maintainerQuoted 14 lines · Lai Jiangshan
The notations include "Start" and "End", it is better when there are paired.
Signed-off-by Lai Jiangshan <[email protected]>Signed-off-by Lai Jiangshan <[email protected]>--- kernel/rcu/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kernel/rcu/tree.c +0
-0
kernel/rcu/tree.c static void rcu_cpu_kthread(unsigned int cpu) · line 2491
Quoted 9 lines
kernel/rcu/tree.c +1
-1@@ -2484,8 +2484,8 @@ static void rcu_cpu_kthread(unsigned int cpu)char work, *workp =this_cpu_ptr (&rcu_data.rcu_cpu_has_work);int spincnt; +trace_rcu_utilization (TPS ("Start CPU kthread@rcu_run" ));for (spincnt =0 ; spincnt <10 ; spincnt++) { -trace_rcu_utilization (TPS ("Start CPU kthread@rcu_run" ));local_bh_disable (); *statusp =RCU_KTHREAD_RUNNING ;local_irq_disable ();
This one is good -- great catch, by the way!
kernel/rcu/tree.c static void rcu_cpu_kthread(unsigned int cpu) · line 2506
Quoted 7 lines
kernel/rcu/tree.c +1
-0@@ -2501,6 +2501,7 @@ static void rcu_cpu_kthread(unsigned int cpu)return ; } } +trace_rcu_utilization (TPS ("End CPU kthread@rcu_run" )); *statusp =RCU_KTHREAD_YIELDING ;trace_rcu_utilization (TPS ("Start CPU kthread@rcu_yield" ));
But here the addition of "rcu_run" is redundant with the pre-existing rcu_yield.
So I folded the first hunk into the previous patch and dropped this one.
As always, please let me know if I am missing something.
Thanx, Paul
Quoted 4 lines
kernel/rcu/tree.c +0
-0schedule_timeout_interruptible (2 );Signature · 1 line
2.20.1