Commit afea227f authored by Paul E. McKenney's avatar Paul E. McKenney

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: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
parent 945fa9c6
...@@ -119,6 +119,10 @@ static inline void rcu_sched_force_quiescent_state(void) ...@@ -119,6 +119,10 @@ static inline void rcu_sched_force_quiescent_state(void)
{ {
} }
static inline void show_rcu_gp_kthreads(void)
{
}
static inline void rcu_cpu_stall_reset(void) static inline void rcu_cpu_stall_reset(void)
{ {
} }
......
...@@ -84,6 +84,7 @@ extern unsigned long rcutorture_vernum; ...@@ -84,6 +84,7 @@ extern unsigned long rcutorture_vernum;
long rcu_batches_completed(void); long rcu_batches_completed(void);
long rcu_batches_completed_bh(void); long rcu_batches_completed_bh(void);
long rcu_batches_completed_sched(void); long rcu_batches_completed_sched(void);
void show_rcu_gp_kthreads(void);
void rcu_force_quiescent_state(void); void rcu_force_quiescent_state(void);
void rcu_bh_force_quiescent_state(void); void rcu_bh_force_quiescent_state(void);
......
...@@ -1034,6 +1034,7 @@ rcu_torture_printk(char *page) ...@@ -1034,6 +1034,7 @@ rcu_torture_printk(char *page)
"??? Writer stall state %d g%lu c%lu f%#x\n", "??? Writer stall state %d g%lu c%lu f%#x\n",
rcu_torture_writer_state, rcu_torture_writer_state,
gpnum, completed, flags); gpnum, completed, flags);
show_rcu_gp_kthreads();
rcutorture_trace_dump(); rcutorture_trace_dump();
} }
rtcv_snap = rcu_torture_current_version; rtcv_snap = rcu_torture_current_version;
......
...@@ -279,6 +279,21 @@ void rcu_bh_force_quiescent_state(void) ...@@ -279,6 +279,21 @@ void rcu_bh_force_quiescent_state(void)
} }
EXPORT_SYMBOL_GPL(rcu_bh_force_quiescent_state); EXPORT_SYMBOL_GPL(rcu_bh_force_quiescent_state);
/*
* Show the state of the grace-period kthreads.
*/
void show_rcu_gp_kthreads(void)
{
struct rcu_state *rsp;
for_each_rcu_flavor(rsp) {
pr_info("%s: wait state: %d ->state: %#lx\n",
rsp->name, rsp->gp_state, rsp->gp_kthread->state);
/* sched_show_task(rsp->gp_kthread); */
}
}
EXPORT_SYMBOL_GPL(show_rcu_gp_kthreads);
/* /*
* Record the number of times rcutorture tests have been initiated and * Record the number of times rcutorture tests have been initiated and
* terminated. This information allows the debugfs tracing stats to be * terminated. This information allows the debugfs tracing stats to be
...@@ -1626,6 +1641,7 @@ static int __noreturn rcu_gp_kthread(void *arg) ...@@ -1626,6 +1641,7 @@ static int __noreturn rcu_gp_kthread(void *arg)
trace_rcu_grace_period(rsp->name, trace_rcu_grace_period(rsp->name,
ACCESS_ONCE(rsp->gpnum), ACCESS_ONCE(rsp->gpnum),
TPS("reqwait")); TPS("reqwait"));
rsp->gp_state = RCU_GP_WAIT_GPS;
wait_event_interruptible(rsp->gp_wq, wait_event_interruptible(rsp->gp_wq,
ACCESS_ONCE(rsp->gp_flags) & ACCESS_ONCE(rsp->gp_flags) &
RCU_GP_FLAG_INIT); RCU_GP_FLAG_INIT);
...@@ -1653,6 +1669,7 @@ static int __noreturn rcu_gp_kthread(void *arg) ...@@ -1653,6 +1669,7 @@ static int __noreturn rcu_gp_kthread(void *arg)
trace_rcu_grace_period(rsp->name, trace_rcu_grace_period(rsp->name,
ACCESS_ONCE(rsp->gpnum), ACCESS_ONCE(rsp->gpnum),
TPS("fqswait")); TPS("fqswait"));
rsp->gp_state = RCU_GP_WAIT_FQS;
ret = wait_event_interruptible_timeout(rsp->gp_wq, ret = wait_event_interruptible_timeout(rsp->gp_wq,
((gf = ACCESS_ONCE(rsp->gp_flags)) & ((gf = ACCESS_ONCE(rsp->gp_flags)) &
RCU_GP_FLAG_FQS) || RCU_GP_FLAG_FQS) ||
......
...@@ -406,7 +406,8 @@ struct rcu_state { ...@@ -406,7 +406,8 @@ struct rcu_state {
unsigned long completed; /* # of last completed gp. */ unsigned long completed; /* # of last completed gp. */
struct task_struct *gp_kthread; /* Task for grace periods. */ struct task_struct *gp_kthread; /* Task for grace periods. */
wait_queue_head_t gp_wq; /* Where GP task waits. */ wait_queue_head_t gp_wq; /* Where GP task waits. */
int gp_flags; /* Commands for GP task. */ short gp_flags; /* Commands for GP task. */
short gp_state; /* GP kthread sleep state. */
/* End of fields guarded by root rcu_node's lock. */ /* End of fields guarded by root rcu_node's lock. */
...@@ -469,6 +470,11 @@ struct rcu_state { ...@@ -469,6 +470,11 @@ struct rcu_state {
#define RCU_GP_FLAG_INIT 0x1 /* Need grace-period initialization. */ #define RCU_GP_FLAG_INIT 0x1 /* Need grace-period initialization. */
#define RCU_GP_FLAG_FQS 0x2 /* Need grace-period quiescent-state forcing. */ #define RCU_GP_FLAG_FQS 0x2 /* Need grace-period quiescent-state forcing. */
/* Values for rcu_state structure's gp_flags field. */
#define RCU_GP_WAIT_INIT 0 /* Initial state. */
#define RCU_GP_WAIT_GPS 1 /* Wait for grace-period start. */
#define RCU_GP_WAIT_FQS 2 /* Wait for force-quiescent-state time. */
extern struct list_head rcu_struct_flavors; extern struct list_head rcu_struct_flavors;
/* Sequence through rcu_state structures for each RCU flavor. */ /* Sequence through rcu_state structures for each RCU flavor. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment