Skip to content

Commit e21408c

Browse files
committed
rcu-tasks: Add RCU tasks to rcutorture writer stall output
This commit adds state for each RCU-tasks flavor to the rcutorture writer stall output. The initial state is minimal, but you have to start somewhere. Signed-off-by: Paul E. McKenney <[email protected]> [ paulmck: Fixes based on feedback from kbuild test robot. ]
1 parent 8fd8ca3 commit e21408c

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

kernel/rcu/rcu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ bool rcu_gp_is_expedited(void); /* Internal RCU use. */
431431
void rcu_expedite_gp(void);
432432
void rcu_unexpedite_gp(void);
433433
void rcupdate_announce_bootup_oddness(void);
434+
void show_rcu_tasks_gp_kthreads(void);
434435
void rcu_request_urgent_qs_task(struct task_struct *t);
435436
#endif /* #else #ifdef CONFIG_TINY_RCU */
436437

kernel/rcu/tasks.h

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,16 @@ static void __init rcu_tasks_bootup_oddness(void)
219219

220220
#endif /* #ifndef CONFIG_TINY_RCU */
221221

222+
/* Dump out rcutorture-relevant state common to all RCU-tasks flavors. */
223+
static void show_rcu_tasks_generic_gp_kthread(struct rcu_tasks *rtp, char *s)
224+
{
225+
pr_info("%s %c%c %s\n",
226+
rtp->kname,
227+
".k"[!!data_race(rtp->kthread_ptr)],
228+
".C"[!!data_race(rtp->cbs_head)],
229+
s);
230+
}
231+
222232
#ifdef CONFIG_TASKS_RCU
223233

224234
////////////////////////////////////////////////////////////////////////
@@ -482,7 +492,14 @@ static int __init rcu_spawn_tasks_kthread(void)
482492
}
483493
core_initcall(rcu_spawn_tasks_kthread);
484494

485-
#endif /* #ifdef CONFIG_TASKS_RCU */
495+
static void show_rcu_tasks_classic_gp_kthread(void)
496+
{
497+
show_rcu_tasks_generic_gp_kthread(&rcu_tasks, "");
498+
}
499+
500+
#else /* #ifdef CONFIG_TASKS_RCU */
501+
static void show_rcu_tasks_classic_gp_kthread(void) { }
502+
#endif /* #else #ifdef CONFIG_TASKS_RCU */
486503

487504
#ifdef CONFIG_TASKS_RUDE_RCU
488505

@@ -578,7 +595,14 @@ static int __init rcu_spawn_tasks_rude_kthread(void)
578595
}
579596
core_initcall(rcu_spawn_tasks_rude_kthread);
580597

581-
#endif /* #ifdef CONFIG_TASKS_RUDE_RCU */
598+
static void show_rcu_tasks_rude_gp_kthread(void)
599+
{
600+
show_rcu_tasks_generic_gp_kthread(&rcu_tasks_rude, "");
601+
}
602+
603+
#else /* #ifdef CONFIG_TASKS_RUDE_RCU */
604+
static void show_rcu_tasks_rude_gp_kthread(void) {}
605+
#endif /* #else #ifdef CONFIG_TASKS_RUDE_RCU */
582606

583607
////////////////////////////////////////////////////////////////////////
584608
//
@@ -982,10 +1006,27 @@ static int __init rcu_spawn_tasks_trace_kthread(void)
9821006
}
9831007
core_initcall(rcu_spawn_tasks_trace_kthread);
9841008

1009+
static void show_rcu_tasks_trace_gp_kthread(void)
1010+
{
1011+
char buf[32];
1012+
1013+
sprintf(buf, "N%d", atomic_read(&trc_n_readers_need_end));
1014+
show_rcu_tasks_generic_gp_kthread(&rcu_tasks_trace, buf);
1015+
}
1016+
9851017
#else /* #ifdef CONFIG_TASKS_TRACE_RCU */
9861018
void exit_tasks_rcu_finish_trace(struct task_struct *t) { }
1019+
static inline void show_rcu_tasks_trace_gp_kthread(void) {}
9871020
#endif /* #else #ifdef CONFIG_TASKS_TRACE_RCU */
9881021

1022+
void show_rcu_tasks_gp_kthreads(void)
1023+
{
1024+
show_rcu_tasks_classic_gp_kthread();
1025+
show_rcu_tasks_rude_gp_kthread();
1026+
show_rcu_tasks_trace_gp_kthread();
1027+
}
1028+
9891029
#else /* #ifdef CONFIG_TASKS_RCU_GENERIC */
9901030
static inline void rcu_tasks_bootup_oddness(void) {}
1031+
void show_rcu_tasks_gp_kthreads(void) {}
9911032
#endif /* #else #ifdef CONFIG_TASKS_RCU_GENERIC */

kernel/rcu/tree_stall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ void show_rcu_gp_kthreads(void)
649649
if (rcu_segcblist_is_offloaded(&rdp->cblist))
650650
show_rcu_nocb_state(rdp);
651651
}
652-
/* sched_show_task(rcu_state.gp_kthread); */
652+
show_rcu_tasks_gp_kthreads();
653653
}
654654
EXPORT_SYMBOL_GPL(show_rcu_gp_kthreads);
655655

0 commit comments

Comments
 (0)