Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63c4db78 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

rcu: Add tracing to rcu_gp_kthread()



This commit adds tracing to the rcu_gp_kthread() function in order to
help trace down hangs potentially involving this kthread.

Reported-by: default avatarClark Williams <williams@redhat.com>
Reported-by: default avatarCarsten Emde <C.Emde@osadl.org>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
parent 591c6d17
Loading
Loading
Loading
Loading
+19 −9
Original line number Original line Diff line number Diff line
@@ -39,15 +39,25 @@ TRACE_EVENT(rcu_utilization,
#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)


/*
/*
 * Tracepoint for grace-period events: starting and ending a grace
 * Tracepoint for grace-period events.  Takes a string identifying the
 * period ("start" and "end", respectively), a CPU noting the start
 * RCU flavor, the grace-period number, and a string identifying the
 * of a new grace period or the end of an old grace period ("cpustart"
 * grace-period-related event as follows:
 * and "cpuend", respectively), a CPU passing through a quiescent
 *
 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl"
 *	"AccReadyCB": CPU acclerates new callbacks to RCU_NEXT_READY_TAIL.
 * and "cpuofl", respectively), a CPU being kicked for being too
 *	"AccWaitCB": CPU accelerates new callbacks to RCU_WAIT_TAIL.
 * long in dyntick-idle mode ("kick"), a CPU accelerating its new
 *	"start": Start a grace period.
 * callbacks to RCU_NEXT_READY_TAIL ("AccReadyCB"), and a CPU
 *	"cpustart": CPU first notices a grace-period start.
 * accelerating its new callbacks to RCU_WAIT_TAIL ("AccWaitCB").
 *	"cpuqs": CPU passes through a quiescent state.
 *	"cpuonl": CPU comes online.
 *	"cpuofl": CPU goes offline.
 *	"reqwait": GP kthread sleeps waiting for grace-period request.
 *	"reqwaitsig": GP kthread awakened by signal from reqwait state.
 *	"fqswait": GP kthread waiting until time to force quiescent states.
 *	"fqsstart": GP kthread starts forcing quiescent states.
 *	"fqsend": GP kthread done forcing quiescent states.
 *	"fqswaitsig": GP kthread awakened by signal from fqswait state.
 *	"end": End a grace period.
 *	"cpuend": CPU first notices a grace-period end.
 */
 */
TRACE_EVENT(rcu_grace_period,
TRACE_EVENT(rcu_grace_period,


+18 −0
Original line number Original line Diff line number Diff line
@@ -1480,6 +1480,9 @@ static int __noreturn rcu_gp_kthread(void *arg)


		/* Handle grace-period start. */
		/* Handle grace-period start. */
		for (;;) {
		for (;;) {
			trace_rcu_grace_period(rsp->name,
					       ACCESS_ONCE(rsp->gpnum),
					       TPS("reqwait"));
			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);
@@ -1487,6 +1490,9 @@ static int __noreturn rcu_gp_kthread(void *arg)
				break;
				break;
			cond_resched();
			cond_resched();
			flush_signals(current);
			flush_signals(current);
			trace_rcu_grace_period(rsp->name,
					       ACCESS_ONCE(rsp->gpnum),
					       TPS("reqwaitsig"));
		}
		}


		/* Handle quiescent-state forcing. */
		/* Handle quiescent-state forcing. */
@@ -1500,6 +1506,9 @@ static int __noreturn rcu_gp_kthread(void *arg)
		for (;;) {
		for (;;) {
			if (!ret)
			if (!ret)
				rsp->jiffies_force_qs = jiffies + j;
				rsp->jiffies_force_qs = jiffies + j;
			trace_rcu_grace_period(rsp->name,
					       ACCESS_ONCE(rsp->gpnum),
					       TPS("fqswait"));
			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) ||
@@ -1513,12 +1522,21 @@ static int __noreturn rcu_gp_kthread(void *arg)
			/* If time for quiescent-state forcing, do it. */
			/* If time for quiescent-state forcing, do it. */
			if (ULONG_CMP_GE(jiffies, rsp->jiffies_force_qs) ||
			if (ULONG_CMP_GE(jiffies, rsp->jiffies_force_qs) ||
			    (gf & RCU_GP_FLAG_FQS)) {
			    (gf & RCU_GP_FLAG_FQS)) {
				trace_rcu_grace_period(rsp->name,
						       ACCESS_ONCE(rsp->gpnum),
						       TPS("fqsstart"));
				fqs_state = rcu_gp_fqs(rsp, fqs_state);
				fqs_state = rcu_gp_fqs(rsp, fqs_state);
				trace_rcu_grace_period(rsp->name,
						       ACCESS_ONCE(rsp->gpnum),
						       TPS("fqsend"));
				cond_resched();
				cond_resched();
			} else {
			} else {
				/* Deal with stray signal. */
				/* Deal with stray signal. */
				cond_resched();
				cond_resched();
				flush_signals(current);
				flush_signals(current);
				trace_rcu_grace_period(rsp->name,
						       ACCESS_ONCE(rsp->gpnum),
						       TPS("fqswaitsig"));
			}
			}
			j = jiffies_till_next_fqs;
			j = jiffies_till_next_fqs;
			if (j > HZ) {
			if (j > HZ) {