Commit afea227fd4acf4f097a9e77bbc2f07d4856ebd01
1 parent
945fa9c631
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
rcutorture: Export RCU grace-period kthread wait state to rcutorture
This commit allows rcutorture to print additional state for the RCU grace-period kthreads in cases where RCU seems reluctant to start a new grace period. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Showing 5 changed files with 30 additions and 1 deletions Side-by-side Diff
include/linux/rcutiny.h
include/linux/rcutree.h
kernel/rcu/rcutorture.c
kernel/rcu/tree.c
... | ... | @@ -280,6 +280,21 @@ |
280 | 280 | EXPORT_SYMBOL_GPL(rcu_bh_force_quiescent_state); |
281 | 281 | |
282 | 282 | /* |
283 | + * Show the state of the grace-period kthreads. | |
284 | + */ | |
285 | +void show_rcu_gp_kthreads(void) | |
286 | +{ | |
287 | + struct rcu_state *rsp; | |
288 | + | |
289 | + for_each_rcu_flavor(rsp) { | |
290 | + pr_info("%s: wait state: %d ->state: %#lx\n", | |
291 | + rsp->name, rsp->gp_state, rsp->gp_kthread->state); | |
292 | + /* sched_show_task(rsp->gp_kthread); */ | |
293 | + } | |
294 | +} | |
295 | +EXPORT_SYMBOL_GPL(show_rcu_gp_kthreads); | |
296 | + | |
297 | +/* | |
283 | 298 | * Record the number of times rcutorture tests have been initiated and |
284 | 299 | * terminated. This information allows the debugfs tracing stats to be |
285 | 300 | * correlated to the rcutorture messages, even when the rcutorture module |
... | ... | @@ -1626,6 +1641,7 @@ |
1626 | 1641 | trace_rcu_grace_period(rsp->name, |
1627 | 1642 | ACCESS_ONCE(rsp->gpnum), |
1628 | 1643 | TPS("reqwait")); |
1644 | + rsp->gp_state = RCU_GP_WAIT_GPS; | |
1629 | 1645 | wait_event_interruptible(rsp->gp_wq, |
1630 | 1646 | ACCESS_ONCE(rsp->gp_flags) & |
1631 | 1647 | RCU_GP_FLAG_INIT); |
... | ... | @@ -1653,6 +1669,7 @@ |
1653 | 1669 | trace_rcu_grace_period(rsp->name, |
1654 | 1670 | ACCESS_ONCE(rsp->gpnum), |
1655 | 1671 | TPS("fqswait")); |
1672 | + rsp->gp_state = RCU_GP_WAIT_FQS; | |
1656 | 1673 | ret = wait_event_interruptible_timeout(rsp->gp_wq, |
1657 | 1674 | ((gf = ACCESS_ONCE(rsp->gp_flags)) & |
1658 | 1675 | RCU_GP_FLAG_FQS) || |
kernel/rcu/tree.h
... | ... | @@ -406,7 +406,8 @@ |
406 | 406 | unsigned long completed; /* # of last completed gp. */ |
407 | 407 | struct task_struct *gp_kthread; /* Task for grace periods. */ |
408 | 408 | wait_queue_head_t gp_wq; /* Where GP task waits. */ |
409 | - int gp_flags; /* Commands for GP task. */ | |
409 | + short gp_flags; /* Commands for GP task. */ | |
410 | + short gp_state; /* GP kthread sleep state. */ | |
410 | 411 | |
411 | 412 | /* End of fields guarded by root rcu_node's lock. */ |
412 | 413 | |
... | ... | @@ -468,6 +469,11 @@ |
468 | 469 | /* Values for rcu_state structure's gp_flags field. */ |
469 | 470 | #define RCU_GP_FLAG_INIT 0x1 /* Need grace-period initialization. */ |
470 | 471 | #define RCU_GP_FLAG_FQS 0x2 /* Need grace-period quiescent-state forcing. */ |
472 | + | |
473 | +/* Values for rcu_state structure's gp_flags field. */ | |
474 | +#define RCU_GP_WAIT_INIT 0 /* Initial state. */ | |
475 | +#define RCU_GP_WAIT_GPS 1 /* Wait for grace-period start. */ | |
476 | +#define RCU_GP_WAIT_FQS 2 /* Wait for force-quiescent-state time. */ | |
471 | 477 | |
472 | 478 | extern struct list_head rcu_struct_flavors; |
473 | 479 |