public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] rcu: RCU CPU stall patches backported to 2.6.33-rc8
@ 2010-02-23  1:46 Paul E. McKenney
  2010-02-23  1:47 ` [PATCH RFC 1/2] rcu: fix deadlock in TREE_PREEMPT_RCU CPU stall detection Paul E. McKenney
  2010-02-23  1:47 ` [PATCH RFC 2/2] rcu: add RCU_CPU_STALL_VERBOSE to dump detailed per-task information Paul E. McKenney
  0 siblings, 2 replies; 3+ messages in thread
From: Paul E. McKenney @ 2010-02-23  1:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, jkacur

Hello!

This set backports a couple of RCU CPU stall detection patches from the
earlier series (http://lkml.org/lkml/2010/2/22/384) to 2.6.33-rc8 to
help track down some NMI issues.

These two patches fix an embarrassing deadlock that can affect
TREE_PREEMPT_RCU and add additional per-task output when tasks stall the
RCU grace period.

 b/kernel/rcutree.c        |    2 +
 b/kernel/rcutree.h        |    1 
 b/kernel/rcutree_plugin.h |    4 ---
 b/lib/Kconfig.debug       |   13 ++++++++++-
 kernel/rcutree.c          |    4 +++
 kernel/rcutree_plugin.h   |   52 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 71 insertions(+), 5 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH RFC 1/2] rcu: fix deadlock in TREE_PREEMPT_RCU CPU stall detection
  2010-02-23  1:46 [PATCH RFC] rcu: RCU CPU stall patches backported to 2.6.33-rc8 Paul E. McKenney
@ 2010-02-23  1:47 ` Paul E. McKenney
  2010-02-23  1:47 ` [PATCH RFC 2/2] rcu: add RCU_CPU_STALL_VERBOSE to dump detailed per-task information Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2010-02-23  1:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, jkacur, Paul E. McKenney

Under TREE_PREEMPT_RCU, print_other_cpu_stall() invokes
rcu_print_task_stall() with the root rcu_node structure's ->lock held,
and rcu_print_task_stall() acquires that same lock for self-deadlock.
Fix this by removing the lock acquisition from rcu_print_task_stall(),
and making all callers acquire the lock instead.

Tested-by: John Kacur <jkacur@redhat.com>
Tested-by: Thomas Gleixner <tglx@linutronix.de>
Located-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c        |    2 ++
 kernel/rcutree_plugin.h |    3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 53ae959..6f652f1 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -458,7 +458,9 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
 
 	printk(KERN_ERR "INFO: RCU detected CPU stalls:");
 	rcu_for_each_leaf_node(rsp, rnp) {
+		raw_spin_lock_irqsave(&rnp->lock, flags);
 		rcu_print_task_stall(rnp);
+		raw_spin_unlock_irqrestore(&rnp->lock, flags);
 		if (rnp->qsmask == 0)
 			continue;
 		for (cpu = 0; cpu <= rnp->grphi - rnp->grplo; cpu++)
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 37fbccd..e31cda7 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -306,18 +306,15 @@ EXPORT_SYMBOL_GPL(__rcu_read_unlock);
  */
 static void rcu_print_task_stall(struct rcu_node *rnp)
 {
-	unsigned long flags;
 	struct list_head *lp;
 	int phase;
 	struct task_struct *t;
 
 	if (rcu_preempted_readers(rnp)) {
-		spin_lock_irqsave(&rnp->lock, flags);
 		phase = rnp->gpnum & 0x1;
 		lp = &rnp->blocked_tasks[phase];
 		list_for_each_entry(t, lp, rcu_node_entry)
 			printk(" P%d", t->pid);
-		spin_unlock_irqrestore(&rnp->lock, flags);
 	}
 }
 
-- 
1.6.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RFC 2/2] rcu: add RCU_CPU_STALL_VERBOSE to dump detailed per-task information
  2010-02-23  1:46 [PATCH RFC] rcu: RCU CPU stall patches backported to 2.6.33-rc8 Paul E. McKenney
  2010-02-23  1:47 ` [PATCH RFC 1/2] rcu: fix deadlock in TREE_PREEMPT_RCU CPU stall detection Paul E. McKenney
@ 2010-02-23  1:47 ` Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2010-02-23  1:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, jkacur, Paul E. McKenney

When RCU detects a grace-period stall, it currently just prints out the
PID of any tasks doing the stalling.  This patch adds RCU_CPU_STALL_VERBOSE,
which enables the more-verbose reporting from sched_show_task().

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c        |    4 +++
 kernel/rcutree.h        |    1 +
 kernel/rcutree_plugin.h |   52 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/Kconfig.debug       |   12 ++++++++++
 4 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 6f652f1..ce642e2 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -471,6 +471,10 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
 	       smp_processor_id(), (long)(jiffies - rsp->gp_start));
 	trigger_all_cpu_backtrace();
 
+	/* If so configured, complain about tasks blocking the grace period. */
+
+	rcu_print_detail_task_stall(rsp);
+
 	force_quiescent_state(rsp, 0);  /* Kick them all. */
 }
 
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index d2a0046..458c047 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -347,6 +347,7 @@ static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp,
 				      unsigned long flags);
 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
+static void rcu_print_detail_task_stall(struct rcu_state *rsp);
 static void rcu_print_task_stall(struct rcu_node *rnp);
 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
 static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp);
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index e31cda7..7021fde 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -300,6 +300,50 @@ EXPORT_SYMBOL_GPL(__rcu_read_unlock);
 
 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
 
+#ifdef CONFIG_RCU_CPU_STALL_VERBOSE
+
+/*
+ * Dump detailed information for all tasks blocking the current RCU
+ * grace period on the specified rcu_node structure.
+ */
+static void rcu_print_detail_task_stall_rnp(struct rcu_node *rnp)
+{
+	unsigned long flags;
+	struct list_head *lp;
+	int phase;
+	struct task_struct *t;
+
+	if (rcu_preempted_readers(rnp)) {
+		raw_spin_lock_irqsave(&rnp->lock, flags);
+		phase = rnp->gpnum & 0x1;
+		lp = &rnp->blocked_tasks[phase];
+		list_for_each_entry(t, lp, rcu_node_entry)
+			sched_show_task(t);
+		raw_spin_unlock_irqrestore(&rnp->lock, flags);
+	}
+}
+
+/*
+ * Dump detailed information for all tasks blocking the current RCU
+ * grace period.
+ */
+static void rcu_print_detail_task_stall(struct rcu_state *rsp)
+{
+	struct rcu_node *rnp = rcu_get_root(rsp);
+
+	rcu_print_detail_task_stall_rnp(rnp);
+	rcu_for_each_leaf_node(rsp, rnp)
+		rcu_print_detail_task_stall_rnp(rnp);
+}
+
+#else /* #ifdef CONFIG_RCU_CPU_STALL_VERBOSE */
+
+static void rcu_print_detail_task_stall(struct rcu_state *rsp)
+{
+}
+
+#endif /* #else #ifdef CONFIG_RCU_CPU_STALL_VERBOSE */
+
 /*
  * Scan the current list of tasks blocked within RCU read-side critical
  * sections, printing out the tid of each.
@@ -742,6 +786,14 @@ static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)
  * Because preemptable RCU does not exist, we never have to check for
  * tasks blocked within RCU read-side critical sections.
  */
+static void rcu_print_detail_task_stall(struct rcu_state *rsp)
+{
+}
+
+/*
+ * Because preemptable RCU does not exist, we never have to check for
+ * tasks blocked within RCU read-side critical sections.
+ */
 static void rcu_print_task_stall(struct rcu_node *rnp)
 {
 }
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 25c3ed5..7500988 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -769,6 +769,18 @@ config RCU_CPU_STALL_DETECTOR
 
 	  Say N if you are unsure.
 
+config RCU_CPU_STALL_VERBOSE
+	bool "Print additional per-task information for RCU_CPU_STALL_DETECTOR"
+	depends on RCU_CPU_STALL_DETECTOR && TREE_PREEMPT_RCU
+	default n
+	help
+	  This option causes RCU to printk detailed per-task information
+	  for any tasks that are stalling the current RCU grace period.
+
+	  Say N if you are unsure.
+
+	  Say Y if you want to enable such checks.
+
 config KPROBES_SANITY_TEST
 	bool "Kprobes sanity tests"
 	depends on DEBUG_KERNEL
-- 
1.6.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-23  1:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-23  1:46 [PATCH RFC] rcu: RCU CPU stall patches backported to 2.6.33-rc8 Paul E. McKenney
2010-02-23  1:47 ` [PATCH RFC 1/2] rcu: fix deadlock in TREE_PREEMPT_RCU CPU stall detection Paul E. McKenney
2010-02-23  1:47 ` [PATCH RFC 2/2] rcu: add RCU_CPU_STALL_VERBOSE to dump detailed per-task information Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox