linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	fweisbec@gmail.com, oleg@redhat.com,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 17/20] rcu: Add more tracing of expedited grace periods
Date: Mon, 26 Feb 2018 13:53:07 -0800	[thread overview]
Message-ID: <1519681990-31349-17-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180226215219.GA27379@linux.vnet.ibm.com>

This commit adds more tracing of expedited grace periods to enable
improved debugging of slowdowns.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/trace/events/rcu.h |  3 +++
 kernel/rcu/rcu.h           |  8 +++++++-
 kernel/rcu/tree_exp.h      | 12 ++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 0b50fda80db0..e56a618f2a59 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -179,6 +179,9 @@ TRACE_EVENT(rcu_grace_period_init,
  *
  *	"snap": Captured snapshot of expedited grace period sequence number.
  *	"start": Started a real expedited grace period.
+ *	"reset": Started resetting the tree
+ *	"select": Started selecting the CPUs to wait on.
+ *	"startwait": Started waiting on selected CPUs.
  *	"end": Ended a real expedited grace period.
  *	"endwake": Woke piggybackers up.
  *	"done": Someone else did the expedited grace period for us.
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index 5d13f651cf08..507a0802c717 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -77,12 +77,18 @@ static inline void rcu_seq_start(unsigned long *sp)
 	WARN_ON_ONCE(rcu_seq_state(*sp) != 1);
 }
 
+/* Compute the end-of-grace-period value for the specified sequence number. */
+static inline unsigned long rcu_seq_endval(unsigned long *sp)
+{
+	return (*sp | RCU_SEQ_STATE_MASK) + 1;
+}
+
 /* Adjust sequence number for end of update-side operation. */
 static inline void rcu_seq_end(unsigned long *sp)
 {
 	smp_mb(); /* Ensure update-side operation before counter increment. */
 	WARN_ON_ONCE(!rcu_seq_state(*sp));
-	WRITE_ONCE(*sp, (*sp | RCU_SEQ_STATE_MASK) + 1);
+	WRITE_ONCE(*sp, rcu_seq_endval(sp));
 }
 
 /* Take a snapshot of the update side's sequence number. */
diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index 46d61b597731..70ad12abde36 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -29,6 +29,15 @@ static void rcu_exp_gp_seq_start(struct rcu_state *rsp)
 }
 
 /*
+ * Return then value that expedited-grace-period counter will have
+ * at the end of the current grace period.
+ */
+static unsigned long rcu_exp_gp_seq_endval(struct rcu_state *rsp)
+{
+	return rcu_seq_endval(&rsp->expedited_sequence);
+}
+
+/*
  * Record the end of an expedited grace period.
  */
 static void rcu_exp_gp_seq_end(struct rcu_state *rsp)
@@ -366,7 +375,9 @@ static void sync_rcu_exp_select_cpus(struct rcu_state *rsp,
 	int ret;
 	struct rcu_node *rnp;
 
+	trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("reset"));
 	sync_exp_reset_tree(rsp);
+	trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("select"));
 	rcu_for_each_leaf_node(rsp, rnp) {
 		raw_spin_lock_irqsave_rcu_node(rnp, flags);
 
@@ -443,6 +454,7 @@ static void synchronize_sched_expedited_wait(struct rcu_state *rsp)
 	struct rcu_node *rnp_root = rcu_get_root(rsp);
 	int ret;
 
+	trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("startwait"));
 	jiffies_stall = rcu_jiffies_till_stall_check();
 	jiffies_start = jiffies;
 
-- 
2.5.2

  parent reply	other threads:[~2018-02-26 21:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 21:52 [PATCH tip/core/rcu 0/20] Miscellaneous fixes Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 01/20] rcu: Remove unnecessary spinlock in rcu_boot_init_percpu_data() Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 02/20] sched/isolation: Eliminate NO_HZ_FULL_ALL Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 03/20] rcu: Fix CPU offload boot message when no CPUs are offloaded Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 04/20] doc: Fix typo in rcutorture documentation Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 05/20] doc: Fix typo in rcu_head comments Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 06/20] rcu: Call touch_nmi_watchdog() while printing stall warnings Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 07/20] rcu: Remove obsolete boost statistics for debugfs Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 08/20] rcu: Remove obsolete callback-invocation " Paul E. McKenney
2018-02-26 21:52 ` [PATCH tip/core/rcu 09/20] rcu: Remove obsolete __rcu_pending() " Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 10/20] rcu: Remove obsolete force-quiescent-state " Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 11/20] rcu: More clearly identify grace-period kthread stack dump Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 12/20] rcu: Consolidate rcu.h #ifdefs Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 13/20] rcu: Remove redundant nxttail index macro define Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 14/20] rcu: Use wrapper for lockdep asserts Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 15/20] rcu: Fix init_rcu_head() comment Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 16/20] rcu: Fix misprint in srcu_funnel_exp_start Paul E. McKenney
2018-02-26 21:53 ` Paul E. McKenney [this message]
2018-02-26 21:53 ` [PATCH tip/core/rcu 18/20] rcu: Trace expedited GP delays due to transitioning CPUs Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 19/20] rcu: Make expedited RCU CPU selection avoid unnecessary stores Paul E. McKenney
2018-02-26 21:53 ` [PATCH tip/core/rcu 20/20] rcu: Create RCU-specific workqueues with rescuers Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1519681990-31349-17-git-send-email-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).