lkml.org 
[lkml]   [2020]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC tip/core/rcu 16/16] rcu-tasks: Add stall warnings for RCU Tasks Trace
Date
From: "Paul E. McKenney" <paulmck@kernel.org>

This commit adds RCU CPU stall warnings for RCU Tasks Trace. These
dump out any tasks blocking the current grace period, as well as any
CPUs that have not responded to an IPI request.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tasks.h | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 5d7bd48..8cffc1c 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -788,8 +788,9 @@ static void rcu_tasks_trace_postscan(void)

/* Do one scan of the holdout list. */
static void check_all_holdout_tasks_trace(struct list_head *hop,
- bool ndrpt, bool *frptp)
+ bool needreport, bool *firstreport)
{
+ int cpu;
struct task_struct *g, *t;

list_for_each_entry_safe(t, g, hop, trc_holdout_list) {
@@ -799,9 +800,32 @@ static void check_all_holdout_tasks_trace(struct list_head *hop,
trc_wait_for_one_reader(t, hop);

// If check succeeded, remove this task from the list.
- if (READ_ONCE(t->trc_reader_checked))
+ if (READ_ONCE(t->trc_reader_checked)) {
trc_del_holdout(t);
+ continue;
+ } else if (!needreport) {
+ continue;
+ }
+ if (*firstreport) {
+ pr_err("INFO: rcu_tasks_trace detected stalls on tasks:\n");
+ *firstreport = false;
+ }
+ cpu = task_cpu(t);
+ pr_alert("%p: %c%c%c nesting: %d%c cpu: %d\n",
+ t,
+ ".I"[READ_ONCE(t->trc_ipi_to_cpu) > 0],
+ ".i"[is_idle_task(t)],
+ "N."[cpu < 0 || !tick_nohz_full_cpu(cpu)],
+ t->trc_reader_nesting,
+ " N"[!!t->trc_reader_need_end],
+ cpu);
+ sched_show_task(t);
}
+ if (!needreport)
+ return;
+ for_each_possible_cpu(cpu)
+ if (per_cpu(trc_ipi_to_cpu, cpu))
+ pr_alert("\tIPI outstanding to CPU %d\n", cpu);
}

/* Wait for grace period to complete and provide ordering. */
--
2.9.5
\
 
 \ /
  Last update: 2020-03-12 19:17    [W:0.426 / U:2.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site