Skip to content

Commit e73dfe3

Browse files
Zhen Leipaulmckrcu
authored andcommitted
sched/debug: Try trigger_single_cpu_backtrace(cpu) in dump_cpu_task()
The trigger_all_cpu_backtrace() function attempts to send an NMI to the target CPU, which usually provides much better stack traces than the dump_cpu_task() function's approach of dumping that stack from some other CPU. So much so that most calls to dump_cpu_task() only happen after a call to trigger_all_cpu_backtrace() has failed. And the exception to this rule really should attempt to use trigger_all_cpu_backtrace() first. Therefore, move the trigger_all_cpu_backtrace() invocation into dump_cpu_task(). Signed-off-by: Zhen Lei <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Vincent Guittot <[email protected]> Cc: Dietmar Eggemann <[email protected]> Cc: Ben Segall <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Daniel Bristot de Oliveira <[email protected]> Cc: Valentin Schneider <[email protected]>
1 parent d8f3f58 commit e73dfe3

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

kernel/rcu/tree_stall.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ static void rcu_dump_cpu_stacks(void)
368368
if (rnp->qsmask & leaf_node_cpu_bit(rnp, cpu)) {
369369
if (cpu_is_offline(cpu))
370370
pr_err("Offline CPU %d blocking current GP.\n", cpu);
371-
else if (!trigger_single_cpu_backtrace(cpu))
371+
else
372372
dump_cpu_task(cpu);
373373
}
374374
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
@@ -511,8 +511,7 @@ static void rcu_check_gp_kthread_starvation(void)
511511
pr_err("RCU GP kthread last ran on offline CPU %d.\n", cpu);
512512
} else {
513513
pr_err("Stack dump where RCU GP kthread last ran:\n");
514-
if (!trigger_single_cpu_backtrace(cpu))
515-
dump_cpu_task(cpu);
514+
dump_cpu_task(cpu);
516515
}
517516
}
518517
wake_up_process(gpk);

kernel/sched/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11183,6 +11183,9 @@ struct cgroup_subsys cpu_cgrp_subsys = {
1118311183

1118411184
void dump_cpu_task(int cpu)
1118511185
{
11186+
if (trigger_single_cpu_backtrace(cpu))
11187+
return;
11188+
1118611189
pr_info("Task dump for CPU %d:\n", cpu);
1118711190
sched_show_task(cpu_curr(cpu));
1118811191
}

kernel/smp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,7 @@ static bool csd_lock_wait_toolong(struct __call_single_data *csd, u64 ts0, u64 *
370370
if (cpu >= 0) {
371371
if (static_branch_unlikely(&csdlock_debug_extended))
372372
csd_lock_print_extended(csd, cpu);
373-
if (!trigger_single_cpu_backtrace(cpu))
374-
dump_cpu_task(cpu);
373+
dump_cpu_task(cpu);
375374
if (!cpu_cur_csd) {
376375
pr_alert("csd: Re-sending CSD lock (#%d) IPI from CPU#%02d to CPU#%02d\n", *bug_id, raw_smp_processor_id(), cpu);
377376
arch_send_call_function_single_ipi(cpu);

0 commit comments

Comments
 (0)