Skip to content

Commit a67818f

Browse files
sergey-senozhatskyrafaeljw
authored andcommitted
PM: dpm_watchdog: add module param to backtrace all CPUs
Add dpm_watchdog_all_cpu_backtrace module parameter which controls all CPU backtrace dump before the DPM watchdog panics the system. This is expected to help understand what might have caused device timeout. Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Dhruva Gole <d-gole@ti.com> Link: https://patch.msgid.link/20251007063551.3147937-1-senozhatsky@chromium.org [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 5a151c2 commit a67818f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/base/power/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <linux/cpufreq.h>
3535
#include <linux/devfreq.h>
3636
#include <linux/timer.h>
37+
#include <linux/nmi.h>
3738

3839
#include "../base.h"
3940
#include "power.h"
@@ -515,6 +516,11 @@ struct dpm_watchdog {
515516
#define DECLARE_DPM_WATCHDOG_ON_STACK(wd) \
516517
struct dpm_watchdog wd
517518

519+
static bool __read_mostly dpm_watchdog_all_cpu_backtrace;
520+
module_param(dpm_watchdog_all_cpu_backtrace, bool, 0644);
521+
MODULE_PARM_DESC(dpm_watchdog_all_cpu_backtrace,
522+
"Backtrace all CPUs on DPM watchdog timeout");
523+
518524
/**
519525
* dpm_watchdog_handler - Driver suspend / resume watchdog handler.
520526
* @t: The timer that PM watchdog depends on.
@@ -530,8 +536,12 @@ static void dpm_watchdog_handler(struct timer_list *t)
530536
unsigned int time_left;
531537

532538
if (wd->fatal) {
539+
unsigned int this_cpu = smp_processor_id();
540+
533541
dev_emerg(wd->dev, "**** DPM device timeout ****\n");
534542
show_stack(wd->tsk, NULL, KERN_EMERG);
543+
if (dpm_watchdog_all_cpu_backtrace)
544+
trigger_allbutcpu_cpu_backtrace(this_cpu);
535545
panic("%s %s: unrecoverable failure\n",
536546
dev_driver_string(wd->dev), dev_name(wd->dev));
537547
}

0 commit comments

Comments
 (0)