Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+30 -1
+4
include/linux/rcutiny.h
··· 119 119 { 120 120 } 121 121 122 + static inline void show_rcu_gp_kthreads(void) 123 + { 124 + } 125 + 122 126 static inline void rcu_cpu_stall_reset(void) 123 127 { 124 128 }
+1
include/linux/rcutree.h
··· 84 84 long rcu_batches_completed(void); 85 85 long rcu_batches_completed_bh(void); 86 86 long rcu_batches_completed_sched(void); 87 + void show_rcu_gp_kthreads(void); 87 88 88 89 void rcu_force_quiescent_state(void); 89 90 void rcu_bh_force_quiescent_state(void);
+1
kernel/rcu/rcutorture.c
··· 1034 1034 "??? Writer stall state %d g%lu c%lu f%#x\n", 1035 1035 rcu_torture_writer_state, 1036 1036 gpnum, completed, flags); 1037 + show_rcu_gp_kthreads(); 1037 1038 rcutorture_trace_dump(); 1038 1039 } 1039 1040 rtcv_snap = rcu_torture_current_version;
+17
kernel/rcu/tree.c
··· 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 ··· 1641 1626 trace_rcu_grace_period(rsp->name, 1642 1627 ACCESS_ONCE(rsp->gpnum), 1643 1628 TPS("reqwait")); 1629 + rsp->gp_state = RCU_GP_WAIT_GPS; 1644 1630 wait_event_interruptible(rsp->gp_wq, 1645 1631 ACCESS_ONCE(rsp->gp_flags) & 1646 1632 RCU_GP_FLAG_INIT); ··· 1669 1653 trace_rcu_grace_period(rsp->name, 1670 1654 ACCESS_ONCE(rsp->gpnum), 1671 1655 TPS("fqswait")); 1656 + rsp->gp_state = RCU_GP_WAIT_FQS; 1672 1657 ret = wait_event_interruptible_timeout(rsp->gp_wq, 1673 1658 ((gf = ACCESS_ONCE(rsp->gp_flags)) & 1674 1659 RCU_GP_FLAG_FQS) ||
+7 -1
kernel/rcu/tree.h
··· 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 ··· 469 468 /* Values for rcu_state structure's gp_flags field. */ 470 469 #define RCU_GP_FLAG_INIT 0x1 /* Need grace-period initialization. */ 471 470 #define RCU_GP_FLAG_FQS 0x2 /* Need grace-period quiescent-state forcing. */ 471 + 472 + /* Values for rcu_state structure's gp_flags field. */ 473 + #define RCU_GP_WAIT_INIT 0 /* Initial state. */ 474 + #define RCU_GP_WAIT_GPS 1 /* Wait for grace-period start. */ 475 + #define RCU_GP_WAIT_FQS 2 /* Wait for force-quiescent-state time. */ 472 476 473 477 extern struct list_head rcu_struct_flavors; 474 478