* [PATCH v2 1/3] PM: core: Rename module parameters prefix to "power"
2026-06-04 9:07 [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
@ 2026-06-04 9:07 ` Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Tzung-Bi Shih @ 2026-06-04 9:07 UTC (permalink / raw)
To: Jonathan Corbet, Rafael J. Wysocki, Greg Kroah-Hartman,
Danilo Krummrich
Cc: Shuah Khan, Pavel Machek, Len Brown, tzungbi, linux-doc,
linux-kernel, linux-pm, driver-core, tfiga, senozhatsky
Currently, the module parameters defined in drivers/base/power/main.c
use the default prefix "main" (derived from the filename). The prefix
"main" is too generic and non-descriptive for power management
parameters.
Redefine MODULE_PARAM_PREFIX to "power." at the beginning of the file
to group the module parameters under the "power" namespace instead.
This makes the parameters more descriptive.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v2:
- New to the series.
v1: Doesn't exist.
drivers/base/power/main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index ed48c292f575..cd864f3a2799 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -40,6 +40,9 @@
#include "../base.h"
#include "power.h"
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "power."
+
typedef int (*pm_callback_t)(struct device *);
/*
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default
2026-06-04 9:07 [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
@ 2026-06-04 9:07 ` Tzung-Bi Shih
2026-06-05 4:53 ` Randy Dunlap
2026-06-04 9:07 ` [PATCH v2 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Tzung-Bi Shih
` (4 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Tzung-Bi Shih @ 2026-06-04 9:07 UTC (permalink / raw)
To: Jonathan Corbet, Rafael J. Wysocki, Greg Kroah-Hartman,
Danilo Krummrich
Cc: Shuah Khan, Pavel Machek, Len Brown, tzungbi, linux-doc,
linux-kernel, linux-pm, driver-core, tfiga, senozhatsky
Introduce the CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED Kconfig option to
allow the device suspend/resume watchdog (DPM watchdog) to be disabled
by default at compile time.
Additionally, introduce the "dpm_watchdog_enabled" module parameter to
allow the watchdog to be enabled or disabled at boot time (via
"power.dpm_watchdog_enabled") and at runtime (via sysfs).
This provides flexibility for systems that want the watchdog code
compiled in but inactive by default, allowing it to be enabled only when
needed.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v2:
- Use module parameter and bool for dpm_watchdog_enabled.
- Use IS_ENABLED().
v1: https://lore.kernel.org/all/20260528103215.505795-1-tzungbi@kernel.org
Documentation/admin-guide/kernel-parameters.txt | 8 ++++++++
drivers/base/power/main.c | 11 +++++++++++
kernel/power/Kconfig | 9 +++++++++
3 files changed, 28 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 00375193bd26..0a0d5340b0c7 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5399,6 +5399,14 @@ Kernel parameters
function to NULL. On Idle the CPU just reduces
execution priority.
+ power.dpm_watchdog_enabled=
+ [KNL] Enable or disable the device suspend/resume
+ watchdog (DPM watchdog).
+ Format: {"0" | "1"}
+ 0: disable
+ 1: enable
+ Default value is set by CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED.
+
ppc_strict_facility_enable
[PPC,ENABLE] This option catches any kernel floating point,
Altivec, VSX and SPE outside of regions specifically
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index cd864f3a2799..7822c29b7c8d 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -534,6 +534,11 @@ module_param(dpm_watchdog_all_cpu_backtrace, bool, 0644);
MODULE_PARM_DESC(dpm_watchdog_all_cpu_backtrace,
"Backtrace all CPUs on DPM watchdog timeout");
+static bool __read_mostly dpm_watchdog_enabled =
+ IS_ENABLED(CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED);
+module_param(dpm_watchdog_enabled, bool, 0644);
+MODULE_PARM_DESC(dpm_watchdog_enabled, "Enable DPM watchdog");
+
/**
* dpm_watchdog_handler - Driver suspend / resume watchdog handler.
* @t: The timer that PM watchdog depends on.
@@ -577,6 +582,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
{
struct timer_list *timer = &wd->timer;
+ if (!dpm_watchdog_enabled)
+ return;
+
wd->dev = dev;
wd->tsk = current;
wd->fatal = CONFIG_DPM_WATCHDOG_TIMEOUT == CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
@@ -595,6 +603,9 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd)
{
struct timer_list *timer = &wd->timer;
+ if (!dpm_watchdog_enabled)
+ return;
+
timer_delete_sync(timer);
timer_destroy_on_stack(timer);
}
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 530c897311d4..12a4a66d48d4 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -268,6 +268,15 @@ config DPM_WATCHDOG
captured in pstore device for inspection in subsequent
boot session.
+config DPM_WATCHDOG_DEFAULT_ENABLED
+ bool "Enable DPM watchdog by default"
+ depends on DPM_WATCHDOG
+ default y
+ help
+ If you say Y here, the DPM watchdog will be enabled by default.
+ If you say N, it will be compiled in but disabled, requiring a
+ boot parameter to activate.
+
config DPM_WATCHDOG_TIMEOUT
int "Watchdog timeout to panic in seconds"
range 1 120
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default
2026-06-04 9:07 ` [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
@ 2026-06-05 4:53 ` Randy Dunlap
2026-06-05 7:10 ` Tzung-Bi Shih
0 siblings, 1 reply; 10+ messages in thread
From: Randy Dunlap @ 2026-06-05 4:53 UTC (permalink / raw)
To: Tzung-Bi Shih, Jonathan Corbet, Rafael J. Wysocki,
Greg Kroah-Hartman, Danilo Krummrich
Cc: Shuah Khan, Pavel Machek, Len Brown, linux-doc, linux-kernel,
linux-pm, driver-core, tfiga, senozhatsky
Hi--
On 6/4/26 2:07 AM, Tzung-Bi Shih wrote:
> Introduce the CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED Kconfig option to
> allow the device suspend/resume watchdog (DPM watchdog) to be disabled
> by default at compile time.
>
> Additionally, introduce the "dpm_watchdog_enabled" module parameter to
> allow the watchdog to be enabled or disabled at boot time (via
> "power.dpm_watchdog_enabled") and at runtime (via sysfs).
>
> This provides flexibility for systems that want the watchdog code
> compiled in but inactive by default, allowing it to be enabled only when
> needed.
>
> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
> ---
> v2:
> - Use module parameter and bool for dpm_watchdog_enabled.
> - Use IS_ENABLED().
>
> v1: https://lore.kernel.org/all/20260528103215.505795-1-tzungbi@kernel.org
>
> Documentation/admin-guide/kernel-parameters.txt | 8 ++++++++
> drivers/base/power/main.c | 11 +++++++++++
> kernel/power/Kconfig | 9 +++++++++
> 3 files changed, 28 insertions(+)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 00375193bd26..0a0d5340b0c7 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5399,6 +5399,14 @@ Kernel parameters
> function to NULL. On Idle the CPU just reduces
> execution priority.
>
> + power.dpm_watchdog_enabled=
> + [KNL] Enable or disable the device suspend/resume
I think that [KNL] isn't very useful here (nor in many of its uses in
kernel-parameters.txt).
What is required to use this option are:
CONFIG_PM_SLEEP, CONFIG_DPM_WATCHDOG
You should convey that information somehow.
Also, in kernel-parameters.txt, "pm_async=" is only valid when [PM]
is enabled, but "PM" is not defined/described anywhere.
That should be added near the beginning of kernel-parameters.txt (in
alphabetical order).
> + watchdog (DPM watchdog).
> + Format: {"0" | "1"}
> + 0: disable
> + 1: enable
> + Default value is set by CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED.
> +
> ppc_strict_facility_enable
> [PPC,ENABLE] This option catches any kernel floating point,
> Altivec, VSX and SPE outside of regions specifically
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index cd864f3a2799..7822c29b7c8d 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -534,6 +534,11 @@ module_param(dpm_watchdog_all_cpu_backtrace, bool, 0644);
> MODULE_PARM_DESC(dpm_watchdog_all_cpu_backtrace,
> "Backtrace all CPUs on DPM watchdog timeout");
>
> +static bool __read_mostly dpm_watchdog_enabled =
> + IS_ENABLED(CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED);
> +module_param(dpm_watchdog_enabled, bool, 0644);
> +MODULE_PARM_DESC(dpm_watchdog_enabled, "Enable DPM watchdog");
> +
> /**
> * dpm_watchdog_handler - Driver suspend / resume watchdog handler.
> * @t: The timer that PM watchdog depends on.
> @@ -577,6 +582,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
> {
> struct timer_list *timer = &wd->timer;
>
> + if (!dpm_watchdog_enabled)
> + return;
> +
> wd->dev = dev;
> wd->tsk = current;
> wd->fatal = CONFIG_DPM_WATCHDOG_TIMEOUT == CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
> @@ -595,6 +603,9 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd)
> {
> struct timer_list *timer = &wd->timer;
>
> + if (!dpm_watchdog_enabled)
> + return;
> +
> timer_delete_sync(timer);
> timer_destroy_on_stack(timer);
> }
> diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> index 530c897311d4..12a4a66d48d4 100644
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -268,6 +268,15 @@ config DPM_WATCHDOG
> captured in pstore device for inspection in subsequent
> boot session.
>
> +config DPM_WATCHDOG_DEFAULT_ENABLED
> + bool "Enable DPM watchdog by default"
> + depends on DPM_WATCHDOG
> + default y
> + help
> + If you say Y here, the DPM watchdog will be enabled by default.
> + If you say N, it will be compiled in but disabled, requiring a
> + boot parameter to activate.
> +
> config DPM_WATCHDOG_TIMEOUT
> int "Watchdog timeout to panic in seconds"
> range 1 120
--
~Randy
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default
2026-06-05 4:53 ` Randy Dunlap
@ 2026-06-05 7:10 ` Tzung-Bi Shih
0 siblings, 0 replies; 10+ messages in thread
From: Tzung-Bi Shih @ 2026-06-05 7:10 UTC (permalink / raw)
To: Randy Dunlap
Cc: Jonathan Corbet, Rafael J. Wysocki, Greg Kroah-Hartman,
Danilo Krummrich, Shuah Khan, Pavel Machek, Len Brown, linux-doc,
linux-kernel, linux-pm, driver-core, tfiga, senozhatsky
On Thu, Jun 04, 2026 at 09:53:11PM -0700, Randy Dunlap wrote:
> On 6/4/26 2:07 AM, Tzung-Bi Shih wrote:
> > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> > index 00375193bd26..0a0d5340b0c7 100644
> > --- a/Documentation/admin-guide/kernel-parameters.txt
> > +++ b/Documentation/admin-guide/kernel-parameters.txt
> > @@ -5399,6 +5399,14 @@ Kernel parameters
> > function to NULL. On Idle the CPU just reduces
> > execution priority.
> >
> > + power.dpm_watchdog_enabled=
> > + [KNL] Enable or disable the device suspend/resume
>
> I think that [KNL] isn't very useful here (nor in many of its uses in
> kernel-parameters.txt).
> What is required to use this option are:
> CONFIG_PM_SLEEP, CONFIG_DPM_WATCHDOG
> You should convey that information somehow.
>
> Also, in kernel-parameters.txt, "pm_async=" is only valid when [PM]
> is enabled, but "PM" is not defined/described anywhere.
> That should be added near the beginning of kernel-parameters.txt (in
> alphabetical order).
Thank you for your review. Will fix them in the next version.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts
2026-06-04 9:07 [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
@ 2026-06-04 9:07 ` Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Tzung-Bi Shih @ 2026-06-04 9:07 UTC (permalink / raw)
To: Jonathan Corbet, Rafael J. Wysocki, Greg Kroah-Hartman,
Danilo Krummrich
Cc: Shuah Khan, Pavel Machek, Len Brown, tzungbi, linux-doc,
linux-kernel, linux-pm, driver-core, tfiga, senozhatsky
Introduce sysctl knobs to allow configuring DPM watchdog timeouts at
runtime.
Currently, these timeouts are fixed at compile time via
CONFIG_DPM_WATCHDOG_TIMEOUT and CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT.
This limits flexibility if the timeouts need to be adjusted for
different testing scenarios or hardware behaviors without rebuilding
the kernel.
Add the following sysctl files under /proc/sys/kernel/:
- dpm_watchdog_timeout_secs: The total timeout before panic. The
maximum value is capped at CONFIG_DPM_WATCHDOG_TIMEOUT to prevent
unreasonably large timeouts.
- dpm_watchdog_warning_timeout_secs: The warning timeout. The maximum
value is capped at the current dpm_watchdog_timeout_secs.
Both sysctls have a minimum value of 1.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v2:
- New to the series.
v1: Doesn't exist.
drivers/base/power/main.c | 61 ++++++++++++++++++++++++++++++++++++---
1 file changed, 57 insertions(+), 4 deletions(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 7822c29b7c8d..c1a4b30fafb2 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -28,6 +28,7 @@
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
+#include <linux/sysctl.h>
#include <linux/async.h>
#include <linux/suspend.h>
#include <trace/events/power.h>
@@ -539,6 +540,58 @@ static bool __read_mostly dpm_watchdog_enabled =
module_param(dpm_watchdog_enabled, bool, 0644);
MODULE_PARM_DESC(dpm_watchdog_enabled, "Enable DPM watchdog");
+static unsigned int __read_mostly dpm_watchdog_timeout = CONFIG_DPM_WATCHDOG_TIMEOUT;
+static unsigned int __read_mostly dpm_watchdog_warning_timeout =
+ CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
+static const unsigned int dpm_watchdog_timeout_max = CONFIG_DPM_WATCHDOG_TIMEOUT;
+
+static int proc_dodpm_watchdog_timeout_secs(const struct ctl_table *table,
+ int write, void *buffer,
+ size_t *lenp, loff_t *ppos)
+{
+ struct ctl_table ctl = *table;
+ unsigned int val = dpm_watchdog_timeout;
+ int ret;
+
+ ctl.data = &val;
+ ret = proc_douintvec_minmax(&ctl, write, buffer, lenp, ppos);
+ if (ret || !write)
+ return ret;
+
+ if (val < dpm_watchdog_warning_timeout)
+ dpm_watchdog_warning_timeout = val;
+ dpm_watchdog_timeout = val;
+
+ return 0;
+}
+
+static const struct ctl_table dpm_watchdog_sysctls[] = {
+ {
+ .procname = "dpm_watchdog_timeout_secs",
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_dodpm_watchdog_timeout_secs,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = (void *)&dpm_watchdog_timeout_max,
+ },
+ {
+ .procname = "dpm_watchdog_warning_timeout_secs",
+ .data = &dpm_watchdog_warning_timeout,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_douintvec_minmax,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = (void *)&dpm_watchdog_timeout,
+ },
+};
+
+static int __init dpm_watchdog_sysctl_init(void)
+{
+ register_sysctl_init("kernel", dpm_watchdog_sysctls);
+ return 0;
+}
+subsys_initcall(dpm_watchdog_sysctl_init);
+
/**
* dpm_watchdog_handler - Driver suspend / resume watchdog handler.
* @t: The timer that PM watchdog depends on.
@@ -564,9 +617,9 @@ static void dpm_watchdog_handler(struct timer_list *t)
dev_driver_string(wd->dev), dev_name(wd->dev));
}
- time_left = CONFIG_DPM_WATCHDOG_TIMEOUT - CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
+ time_left = dpm_watchdog_timeout - dpm_watchdog_warning_timeout;
dev_warn(wd->dev, "**** DPM device timeout after %u seconds; %u seconds until panic ****\n",
- CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT, time_left);
+ dpm_watchdog_warning_timeout, time_left);
show_stack(wd->tsk, NULL, KERN_WARNING);
wd->fatal = true;
@@ -587,11 +640,11 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
wd->dev = dev;
wd->tsk = current;
- wd->fatal = CONFIG_DPM_WATCHDOG_TIMEOUT == CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
+ wd->fatal = dpm_watchdog_timeout == dpm_watchdog_warning_timeout;
timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
/* use same timeout value for both suspend and resume */
- timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
+ timer->expires = jiffies + HZ * dpm_watchdog_warning_timeout;
add_timer(timer);
}
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability
2026-06-04 9:07 [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
` (2 preceding siblings ...)
2026-06-04 9:07 ` [PATCH v2 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Tzung-Bi Shih
@ 2026-06-04 9:07 ` Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Tzung-Bi Shih @ 2026-06-04 9:07 UTC (permalink / raw)
To: Jonathan Corbet, Rafael J. Wysocki, Greg Kroah-Hartman,
Danilo Krummrich
Cc: Shuah Khan, Pavel Machek, Len Brown, tzungbi, linux-doc,
linux-kernel, linux-pm, driver-core, tfiga, senozhatsky
This series improves the configurability of the DPM watchdog.
Currently, the DPM watchdog timeouts are fixed at compile time, and the
watchdog is always enabled if compiled in. Also, the module parameters
defined in drivers/base/power/main.c use the generic and non-descriptive
"main" prefix.
This series addresses these limitations.
Patch 1 renames the module parameter prefix for drivers/base/power/main.c
from "main" to "power".
Patch 2 introduces the CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED to allow the DPM
watchdog to be disabled by default at compile time. It also exposes the
"power.dpm_watchdog_enabled" module parameter to allow enabling/disabling
the watchdog at boot time and runtime.
Patch 3 introduces sysctl knobs under /proc/sys/kernel/ to allow
configuring the DPM watchdog timeouts at runtime.
---
v2:
- Form a new series.
v1: Doesn't exist.
Tzung-Bi Shih (3):
PM: core: Rename module parameters prefix to "power"
PM: dpm_watchdog: Allow disabling DPM watchdog by default
PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts
.../admin-guide/kernel-parameters.txt | 8 ++
drivers/base/power/main.c | 75 ++++++++++++++++++-
kernel/power/Kconfig | 9 +++
3 files changed, 88 insertions(+), 4 deletions(-)
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 1/3] PM: core: Rename module parameters prefix to "power"
2026-06-04 9:07 [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
` (3 preceding siblings ...)
2026-06-04 9:07 ` [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
@ 2026-06-04 9:07 ` Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Tzung-Bi Shih
6 siblings, 0 replies; 10+ messages in thread
From: Tzung-Bi Shih @ 2026-06-04 9:07 UTC (permalink / raw)
To: Jonathan Corbet, Rafael J. Wysocki, Greg Kroah-Hartman,
Danilo Krummrich
Cc: Shuah Khan, Pavel Machek, Len Brown, tzungbi, linux-doc,
linux-kernel, linux-pm, driver-core, tfiga, senozhatsky
Currently, the module parameters defined in drivers/base/power/main.c
use the default prefix "main" (derived from the filename). The prefix
"main" is too generic and non-descriptive for power management
parameters.
Redefine MODULE_PARAM_PREFIX to "power." at the beginning of the file
to group the module parameters under the "power" namespace instead.
This makes the parameters more descriptive.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v2:
- New to the series.
v1: Doesn't exist.
drivers/base/power/main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index ed48c292f575..cd864f3a2799 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -40,6 +40,9 @@
#include "../base.h"
#include "power.h"
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "power."
+
typedef int (*pm_callback_t)(struct device *);
/*
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default
2026-06-04 9:07 [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
` (4 preceding siblings ...)
2026-06-04 9:07 ` [PATCH v2 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
@ 2026-06-04 9:07 ` Tzung-Bi Shih
2026-06-04 9:07 ` [PATCH v2 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Tzung-Bi Shih
6 siblings, 0 replies; 10+ messages in thread
From: Tzung-Bi Shih @ 2026-06-04 9:07 UTC (permalink / raw)
To: Jonathan Corbet, Rafael J. Wysocki, Greg Kroah-Hartman,
Danilo Krummrich
Cc: Shuah Khan, Pavel Machek, Len Brown, tzungbi, linux-doc,
linux-kernel, linux-pm, driver-core, tfiga, senozhatsky
Introduce the CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED Kconfig option to
allow the device suspend/resume watchdog (DPM watchdog) to be disabled
by default at compile time.
Additionally, introduce the "dpm_watchdog_enabled" module parameter to
allow the watchdog to be enabled or disabled at boot time (via
"power.dpm_watchdog_enabled") and at runtime (via sysfs).
This provides flexibility for systems that want the watchdog code
compiled in but inactive by default, allowing it to be enabled only when
needed.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v2:
- Use module parameter and bool for dpm_watchdog_enabled.
- Use IS_ENABLED().
v1: https://lore.kernel.org/all/20260528103215.505795-1-tzungbi@kernel.org
Documentation/admin-guide/kernel-parameters.txt | 8 ++++++++
drivers/base/power/main.c | 11 +++++++++++
kernel/power/Kconfig | 9 +++++++++
3 files changed, 28 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 00375193bd26..0a0d5340b0c7 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5399,6 +5399,14 @@ Kernel parameters
function to NULL. On Idle the CPU just reduces
execution priority.
+ power.dpm_watchdog_enabled=
+ [KNL] Enable or disable the device suspend/resume
+ watchdog (DPM watchdog).
+ Format: {"0" | "1"}
+ 0: disable
+ 1: enable
+ Default value is set by CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED.
+
ppc_strict_facility_enable
[PPC,ENABLE] This option catches any kernel floating point,
Altivec, VSX and SPE outside of regions specifically
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index cd864f3a2799..7822c29b7c8d 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -534,6 +534,11 @@ module_param(dpm_watchdog_all_cpu_backtrace, bool, 0644);
MODULE_PARM_DESC(dpm_watchdog_all_cpu_backtrace,
"Backtrace all CPUs on DPM watchdog timeout");
+static bool __read_mostly dpm_watchdog_enabled =
+ IS_ENABLED(CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED);
+module_param(dpm_watchdog_enabled, bool, 0644);
+MODULE_PARM_DESC(dpm_watchdog_enabled, "Enable DPM watchdog");
+
/**
* dpm_watchdog_handler - Driver suspend / resume watchdog handler.
* @t: The timer that PM watchdog depends on.
@@ -577,6 +582,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
{
struct timer_list *timer = &wd->timer;
+ if (!dpm_watchdog_enabled)
+ return;
+
wd->dev = dev;
wd->tsk = current;
wd->fatal = CONFIG_DPM_WATCHDOG_TIMEOUT == CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
@@ -595,6 +603,9 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd)
{
struct timer_list *timer = &wd->timer;
+ if (!dpm_watchdog_enabled)
+ return;
+
timer_delete_sync(timer);
timer_destroy_on_stack(timer);
}
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 530c897311d4..12a4a66d48d4 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -268,6 +268,15 @@ config DPM_WATCHDOG
captured in pstore device for inspection in subsequent
boot session.
+config DPM_WATCHDOG_DEFAULT_ENABLED
+ bool "Enable DPM watchdog by default"
+ depends on DPM_WATCHDOG
+ default y
+ help
+ If you say Y here, the DPM watchdog will be enabled by default.
+ If you say N, it will be compiled in but disabled, requiring a
+ boot parameter to activate.
+
config DPM_WATCHDOG_TIMEOUT
int "Watchdog timeout to panic in seconds"
range 1 120
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts
2026-06-04 9:07 [PATCH v2 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
` (5 preceding siblings ...)
2026-06-04 9:07 ` [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
@ 2026-06-04 9:07 ` Tzung-Bi Shih
6 siblings, 0 replies; 10+ messages in thread
From: Tzung-Bi Shih @ 2026-06-04 9:07 UTC (permalink / raw)
To: Jonathan Corbet, Rafael J. Wysocki, Greg Kroah-Hartman,
Danilo Krummrich
Cc: Shuah Khan, Pavel Machek, Len Brown, tzungbi, linux-doc,
linux-kernel, linux-pm, driver-core, tfiga, senozhatsky
Introduce sysctl knobs to allow configuring DPM watchdog timeouts at
runtime.
Currently, these timeouts are fixed at compile time via
CONFIG_DPM_WATCHDOG_TIMEOUT and CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT.
This limits flexibility if the timeouts need to be adjusted for
different testing scenarios or hardware behaviors without rebuilding
the kernel.
Add the following sysctl files under /proc/sys/kernel/:
- dpm_watchdog_timeout_secs: The total timeout before panic. The
maximum value is capped at CONFIG_DPM_WATCHDOG_TIMEOUT to prevent
unreasonably large timeouts.
- dpm_watchdog_warning_timeout_secs: The warning timeout. The maximum
value is capped at the current dpm_watchdog_timeout_secs.
Both sysctls have a minimum value of 1.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v2:
- New to the series.
v1: Doesn't exist.
drivers/base/power/main.c | 61 ++++++++++++++++++++++++++++++++++++---
1 file changed, 57 insertions(+), 4 deletions(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 7822c29b7c8d..c1a4b30fafb2 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -28,6 +28,7 @@
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
+#include <linux/sysctl.h>
#include <linux/async.h>
#include <linux/suspend.h>
#include <trace/events/power.h>
@@ -539,6 +540,58 @@ static bool __read_mostly dpm_watchdog_enabled =
module_param(dpm_watchdog_enabled, bool, 0644);
MODULE_PARM_DESC(dpm_watchdog_enabled, "Enable DPM watchdog");
+static unsigned int __read_mostly dpm_watchdog_timeout = CONFIG_DPM_WATCHDOG_TIMEOUT;
+static unsigned int __read_mostly dpm_watchdog_warning_timeout =
+ CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
+static const unsigned int dpm_watchdog_timeout_max = CONFIG_DPM_WATCHDOG_TIMEOUT;
+
+static int proc_dodpm_watchdog_timeout_secs(const struct ctl_table *table,
+ int write, void *buffer,
+ size_t *lenp, loff_t *ppos)
+{
+ struct ctl_table ctl = *table;
+ unsigned int val = dpm_watchdog_timeout;
+ int ret;
+
+ ctl.data = &val;
+ ret = proc_douintvec_minmax(&ctl, write, buffer, lenp, ppos);
+ if (ret || !write)
+ return ret;
+
+ if (val < dpm_watchdog_warning_timeout)
+ dpm_watchdog_warning_timeout = val;
+ dpm_watchdog_timeout = val;
+
+ return 0;
+}
+
+static const struct ctl_table dpm_watchdog_sysctls[] = {
+ {
+ .procname = "dpm_watchdog_timeout_secs",
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_dodpm_watchdog_timeout_secs,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = (void *)&dpm_watchdog_timeout_max,
+ },
+ {
+ .procname = "dpm_watchdog_warning_timeout_secs",
+ .data = &dpm_watchdog_warning_timeout,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_douintvec_minmax,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = (void *)&dpm_watchdog_timeout,
+ },
+};
+
+static int __init dpm_watchdog_sysctl_init(void)
+{
+ register_sysctl_init("kernel", dpm_watchdog_sysctls);
+ return 0;
+}
+subsys_initcall(dpm_watchdog_sysctl_init);
+
/**
* dpm_watchdog_handler - Driver suspend / resume watchdog handler.
* @t: The timer that PM watchdog depends on.
@@ -564,9 +617,9 @@ static void dpm_watchdog_handler(struct timer_list *t)
dev_driver_string(wd->dev), dev_name(wd->dev));
}
- time_left = CONFIG_DPM_WATCHDOG_TIMEOUT - CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
+ time_left = dpm_watchdog_timeout - dpm_watchdog_warning_timeout;
dev_warn(wd->dev, "**** DPM device timeout after %u seconds; %u seconds until panic ****\n",
- CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT, time_left);
+ dpm_watchdog_warning_timeout, time_left);
show_stack(wd->tsk, NULL, KERN_WARNING);
wd->fatal = true;
@@ -587,11 +640,11 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
wd->dev = dev;
wd->tsk = current;
- wd->fatal = CONFIG_DPM_WATCHDOG_TIMEOUT == CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
+ wd->fatal = dpm_watchdog_timeout == dpm_watchdog_warning_timeout;
timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
/* use same timeout value for both suspend and resume */
- timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
+ timer->expires = jiffies + HZ * dpm_watchdog_warning_timeout;
add_timer(timer);
}
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread