Linux Documentation
 help / color / mirror / Atom feed
* [PATCH v3 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability
@ 2026-06-08  2:15 Tzung-Bi Shih
  2026-06-08  2:15 ` [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-06-08  2:15 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,
	Randy Dunlap

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.

---
v3:
- Address review comments on patch 2.

v2: https://lore.kernel.org/all/20260604090756.2884671-1-tzungbi@kernel.org
- 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                          | 10 +++
 3 files changed, 89 insertions(+), 4 deletions(-)

-- 
2.54.0.1099.g489fc7bff1-goog


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

* [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power"
  2026-06-08  2:15 [PATCH v3 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
@ 2026-06-08  2:15 ` Tzung-Bi Shih
  2026-06-08 14:11   ` Rafael J. Wysocki
  2026-06-08  2:15 ` [PATCH v3 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
  2026-06-08  2:15 ` [PATCH v3 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Tzung-Bi Shih
  2 siblings, 1 reply; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-06-08  2:15 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,
	Randy Dunlap

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>
---
v3:
- No changes.

v2: https://lore.kernel.org/all/20260604090756.2884671-2-tzungbi@kernel.org
- 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.1099.g489fc7bff1-goog


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

* [PATCH v3 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default
  2026-06-08  2:15 [PATCH v3 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
  2026-06-08  2:15 ` [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
@ 2026-06-08  2:15 ` Tzung-Bi Shih
  2026-06-08 14:14   ` Rafael J. Wysocki
  2026-06-08  2:15 ` [PATCH v3 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Tzung-Bi Shih
  2 siblings, 1 reply; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-06-08  2:15 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,
	Randy Dunlap

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>
---
v3:
- Add "PM" tag (was missing).
- Update the format and specify dependencies in kernel-parameters.txt.
- Update the help message in Kconfig to reflect that dpm_watchdog_enabled
  can be set at runtime as well.

v2: https://lore.kernel.org/all/20260604090756.2884671-3-tzungbi@kernel.org
- 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                            | 10 ++++++++++
 3 files changed, 29 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 00375193bd26..f2620764c28e 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -47,6 +47,7 @@
 	PCI	PCI bus support is enabled.
 	PCIE	PCI Express support is enabled.
 	PCMCIA	The PCMCIA subsystem is enabled.
+	PM	Power Management support is enabled.
 	PNP	Plug & Play support is enabled.
 	PPC	PowerPC architecture is enabled.
 	PPT	Parallel port support is enabled.
@@ -5399,6 +5400,13 @@ Kernel parameters
 			function to NULL. On Idle the CPU just reduces
 			execution priority.
 
+	power.dpm_watchdog_enabled=
+			[PM] Enable or disable the device suspend/resume
+			watchdog (DPM watchdog).  Requires CONFIG_PM_SLEEP and
+			CONFIG_DPM_WATCHDOG enabled.
+			Format: <bool>
+			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..b16bd159074a 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -268,6 +268,16 @@ 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.  It can be
+	  enabled at boot time via the "power.dpm_watchdog_enabled" kernel
+	  parameter or at runtime via sysfs.
+
 config DPM_WATCHDOG_TIMEOUT
 	int "Watchdog timeout to panic in seconds"
 	range 1 120
-- 
2.54.0.1099.g489fc7bff1-goog


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

* [PATCH v3 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts
  2026-06-08  2:15 [PATCH v3 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
  2026-06-08  2:15 ` [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
  2026-06-08  2:15 ` [PATCH v3 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
@ 2026-06-08  2:15 ` Tzung-Bi Shih
  2026-06-08 14:22   ` Rafael J. Wysocki
  2 siblings, 1 reply; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-06-08  2:15 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,
	Randy Dunlap

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>
---
v3:
- No changes.

v2: https://lore.kernel.org/all/20260604090756.2884671-4-tzungbi@kernel.org
- 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.1099.g489fc7bff1-goog


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

* Re: [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power"
  2026-06-08  2:15 ` [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
@ 2026-06-08 14:11   ` Rafael J. Wysocki
  2026-06-09  9:02     ` Tzung-Bi Shih
  0 siblings, 1 reply; 15+ messages in thread
From: Rafael J. Wysocki @ 2026-06-08 14:11 UTC (permalink / raw)
  To: Tzung-Bi Shih
  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,
	Randy Dunlap

On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> 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>
> ---
> v3:
> - No changes.
>
> v2: https://lore.kernel.org/all/20260604090756.2884671-2-tzungbi@kernel.org
> - 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."

"power" may be confused with the power supply support, so I'd rather
use "pm" or even "pm_sleep" (in which case the "dpm_" prefix could be
dropped from the new module param name in the next patch).

> +
>  typedef int (*pm_callback_t)(struct device *);
>
>  /*
> --

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

* Re: [PATCH v3 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default
  2026-06-08  2:15 ` [PATCH v3 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
@ 2026-06-08 14:14   ` Rafael J. Wysocki
  2026-06-09  9:04     ` Tzung-Bi Shih
  0 siblings, 1 reply; 15+ messages in thread
From: Rafael J. Wysocki @ 2026-06-08 14:14 UTC (permalink / raw)
  To: Tzung-Bi Shih
  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,
	Randy Dunlap

On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> 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).

I think that the new module param is more important because the new
config option is just its default value, so I'd rearrange the
changelog.

Also, I think that the "DEFAULT_" part of the new config option name
doesn't provide any additional value, so I'd just drop it.

> 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>
> ---
> v3:
> - Add "PM" tag (was missing).
> - Update the format and specify dependencies in kernel-parameters.txt.
> - Update the help message in Kconfig to reflect that dpm_watchdog_enabled
>   can be set at runtime as well.
>
> v2: https://lore.kernel.org/all/20260604090756.2884671-3-tzungbi@kernel.org
> - 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                            | 10 ++++++++++
>  3 files changed, 29 insertions(+)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 00375193bd26..f2620764c28e 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -47,6 +47,7 @@
>         PCI     PCI bus support is enabled.
>         PCIE    PCI Express support is enabled.
>         PCMCIA  The PCMCIA subsystem is enabled.
> +       PM      Power Management support is enabled.
>         PNP     Plug & Play support is enabled.
>         PPC     PowerPC architecture is enabled.
>         PPT     Parallel port support is enabled.
> @@ -5399,6 +5400,13 @@ Kernel parameters
>                         function to NULL. On Idle the CPU just reduces
>                         execution priority.
>
> +       power.dpm_watchdog_enabled=
> +                       [PM] Enable or disable the device suspend/resume
> +                       watchdog (DPM watchdog).  Requires CONFIG_PM_SLEEP and
> +                       CONFIG_DPM_WATCHDOG enabled.
> +                       Format: <bool>
> +                       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..b16bd159074a 100644
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -268,6 +268,16 @@ 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.  It can be
> +         enabled at boot time via the "power.dpm_watchdog_enabled" kernel
> +         parameter or at runtime via sysfs.
> +
>  config DPM_WATCHDOG_TIMEOUT
>         int "Watchdog timeout to panic in seconds"
>         range 1 120
> --
> 2.54.0.1099.g489fc7bff1-goog
>

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

* Re: [PATCH v3 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts
  2026-06-08  2:15 ` [PATCH v3 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Tzung-Bi Shih
@ 2026-06-08 14:22   ` Rafael J. Wysocki
  2026-06-09  9:02     ` Tzung-Bi Shih
  0 siblings, 1 reply; 15+ messages in thread
From: Rafael J. Wysocki @ 2026-06-08 14:22 UTC (permalink / raw)
  To: Tzung-Bi Shih
  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,
	Randy Dunlap

On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> 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>
> ---
> v3:
> - No changes.
>
> v2: https://lore.kernel.org/all/20260604090756.2884671-4-tzungbi@kernel.org
> - 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);
>  }
>
> --

I think that this can be applied without the other two patches in the
series, so please let me know if you want me to apply it separately.

Thanks!

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

* Re: [PATCH v3 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts
  2026-06-08 14:22   ` Rafael J. Wysocki
@ 2026-06-09  9:02     ` Tzung-Bi Shih
  2026-06-09 11:08       ` Rafael J. Wysocki
  0 siblings, 1 reply; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-06-09  9:02 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jonathan Corbet, Greg Kroah-Hartman, Danilo Krummrich, Shuah Khan,
	Pavel Machek, Len Brown, linux-doc, linux-kernel, linux-pm,
	driver-core, tfiga, senozhatsky, Randy Dunlap

On Mon, Jun 08, 2026 at 04:22:35PM +0200, Rafael J. Wysocki wrote:
> On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> >
> > 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>
> > ---
> > v3:
> > - No changes.
> >
> > v2: https://lore.kernel.org/all/20260604090756.2884671-4-tzungbi@kernel.org
> > - 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);
> >  }
> >
> > --
> 
> I think that this can be applied without the other two patches in the
> series, so please let me know if you want me to apply it separately.

Ack.  The patch does have adjacent hunks with the preceding patch, which
might cause minor contextual conflicts if applied independently.

Would you want me to reorder the series in the next version to make this
the first patch?  In case the rest two patches may still take some time
to review.

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

* Re: [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power"
  2026-06-08 14:11   ` Rafael J. Wysocki
@ 2026-06-09  9:02     ` Tzung-Bi Shih
  2026-06-09 11:10       ` Rafael J. Wysocki
  0 siblings, 1 reply; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-06-09  9:02 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jonathan Corbet, Greg Kroah-Hartman, Danilo Krummrich, Shuah Khan,
	Pavel Machek, Len Brown, linux-doc, linux-kernel, linux-pm,
	driver-core, tfiga, senozhatsky, Randy Dunlap

On Mon, Jun 08, 2026 at 04:11:30PM +0200, Rafael J. Wysocki wrote:
> On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> >
> > 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>
> > ---
> > v3:
> > - No changes.
> >
> > v2: https://lore.kernel.org/all/20260604090756.2884671-2-tzungbi@kernel.org
> > - 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."
> 
> "power" may be confused with the power supply support, so I'd rather
> use "pm" or even "pm_sleep" (in which case the "dpm_" prefix could be
> dropped from the new module param name in the next patch).

Ack, will use "pm_sleep" in the next version.

Regarding dropping the "dpm_" prefix, should this also apply to the existing
dpm_watchdog_all_cpu_backtrace parameter?  Or should we leave it as-is to
avoid breaking existing configurations?

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

* Re: [PATCH v3 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default
  2026-06-08 14:14   ` Rafael J. Wysocki
@ 2026-06-09  9:04     ` Tzung-Bi Shih
  0 siblings, 0 replies; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-06-09  9:04 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jonathan Corbet, Greg Kroah-Hartman, Danilo Krummrich, Shuah Khan,
	Pavel Machek, Len Brown, linux-doc, linux-kernel, linux-pm,
	driver-core, tfiga, senozhatsky, Randy Dunlap

On Mon, Jun 08, 2026 at 04:14:09PM +0200, Rafael J. Wysocki wrote:
> On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> 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).
> 
> I think that the new module param is more important because the new
> config option is just its default value, so I'd rearrange the
> changelog.
> 
> Also, I think that the "DEFAULT_" part of the new config option name
> doesn't provide any additional value, so I'd just drop it.

Will fix them in the next version.

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

* Re: [PATCH v3 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts
  2026-06-09  9:02     ` Tzung-Bi Shih
@ 2026-06-09 11:08       ` Rafael J. Wysocki
  0 siblings, 0 replies; 15+ messages in thread
From: Rafael J. Wysocki @ 2026-06-09 11:08 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Rafael J. Wysocki, Jonathan Corbet, Greg Kroah-Hartman,
	Danilo Krummrich, Shuah Khan, Pavel Machek, Len Brown, linux-doc,
	linux-kernel, linux-pm, driver-core, tfiga, senozhatsky,
	Randy Dunlap

On Tue, Jun 9, 2026 at 11:02 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> On Mon, Jun 08, 2026 at 04:22:35PM +0200, Rafael J. Wysocki wrote:
> > On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> > >
> > > 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>
> > > ---
> > > v3:
> > > - No changes.
> > >
> > > v2: https://lore.kernel.org/all/20260604090756.2884671-4-tzungbi@kernel.org
> > > - 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);
> > >  }
> > >
> > > --
> >
> > I think that this can be applied without the other two patches in the
> > series, so please let me know if you want me to apply it separately.
>
> Ack.  The patch does have adjacent hunks with the preceding patch, which
> might cause minor contextual conflicts if applied independently.

That's not a problem.

> Would you want me to reorder the series in the next version to make this
> the first patch?  In case the rest two patches may still take some time
> to review.

I'll pick it up as is, so it can make it into 7.2.

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

* Re: [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power"
  2026-06-09  9:02     ` Tzung-Bi Shih
@ 2026-06-09 11:10       ` Rafael J. Wysocki
  2026-06-09 11:17         ` Tomasz Figa
  0 siblings, 1 reply; 15+ messages in thread
From: Rafael J. Wysocki @ 2026-06-09 11:10 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Rafael J. Wysocki, Jonathan Corbet, Greg Kroah-Hartman,
	Danilo Krummrich, Shuah Khan, Pavel Machek, Len Brown, linux-doc,
	linux-kernel, linux-pm, driver-core, tfiga, senozhatsky,
	Randy Dunlap

On Tue, Jun 9, 2026 at 11:03 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> On Mon, Jun 08, 2026 at 04:11:30PM +0200, Rafael J. Wysocki wrote:
> > On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> > >
> > > 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>
> > > ---
> > > v3:
> > > - No changes.
> > >
> > > v2: https://lore.kernel.org/all/20260604090756.2884671-2-tzungbi@kernel.org
> > > - 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."
> >
> > "power" may be confused with the power supply support, so I'd rather
> > use "pm" or even "pm_sleep" (in which case the "dpm_" prefix could be
> > dropped from the new module param name in the next patch).
>
> Ack, will use "pm_sleep" in the next version.
>
> Regarding dropping the "dpm_" prefix, should this also apply to the existing
> dpm_watchdog_all_cpu_backtrace parameter?  Or should we leave it as-is to
> avoid breaking existing configurations?

Breaking things for someone would be unfortunate.

For consistency, let's retain the "dpm_watchdog" part in this name and
use it in the new one.

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

* Re: [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power"
  2026-06-09 11:10       ` Rafael J. Wysocki
@ 2026-06-09 11:17         ` Tomasz Figa
  2026-06-09 13:03           ` Tzung-Bi Shih
  0 siblings, 1 reply; 15+ messages in thread
From: Tomasz Figa @ 2026-06-09 11:17 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Tzung-Bi Shih, Jonathan Corbet, Greg Kroah-Hartman,
	Danilo Krummrich, Shuah Khan, Pavel Machek, Len Brown, linux-doc,
	linux-kernel, linux-pm, driver-core, senozhatsky, Randy Dunlap

On Tue, Jun 9, 2026 at 8:10 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Tue, Jun 9, 2026 at 11:03 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> >
> > On Mon, Jun 08, 2026 at 04:11:30PM +0200, Rafael J. Wysocki wrote:
> > > On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> > > >
> > > > 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>
> > > > ---
> > > > v3:
> > > > - No changes.
> > > >
> > > > v2: https://lore.kernel.org/all/20260604090756.2884671-2-tzungbi@kernel.org
> > > > - 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."
> > >
> > > "power" may be confused with the power supply support, so I'd rather
> > > use "pm" or even "pm_sleep" (in which case the "dpm_" prefix could be
> > > dropped from the new module param name in the next patch).
> >
> > Ack, will use "pm_sleep" in the next version.
> >
> > Regarding dropping the "dpm_" prefix, should this also apply to the existing
> > dpm_watchdog_all_cpu_backtrace parameter?  Or should we leave it as-is to
> > avoid breaking existing configurations?
>
> Breaking things for someone would be unfortunate.
>
> For consistency, let's retain the "dpm_watchdog" part in this name and
> use it in the new one.

Hmm, doesn't the prefix change already break things?

Best,
Tomasz

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

* Re: [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power"
  2026-06-09 11:17         ` Tomasz Figa
@ 2026-06-09 13:03           ` Tzung-Bi Shih
  2026-06-09 13:40             ` Rafael J. Wysocki
  0 siblings, 1 reply; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-06-09 13:03 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Rafael J. Wysocki, Jonathan Corbet, Greg Kroah-Hartman,
	Danilo Krummrich, Shuah Khan, Pavel Machek, Len Brown, linux-doc,
	linux-kernel, linux-pm, driver-core, senozhatsky, Randy Dunlap

On Tue, Jun 09, 2026 at 08:17:03PM +0900, Tomasz Figa wrote:
> On Tue, Jun 9, 2026 at 8:10 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > On Tue, Jun 9, 2026 at 11:03 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> > >
> > > On Mon, Jun 08, 2026 at 04:11:30PM +0200, Rafael J. Wysocki wrote:
> > > > On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> > > > >
> > > > > 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>
> > > > > ---
> > > > > v3:
> > > > > - No changes.
> > > > >
> > > > > v2: https://lore.kernel.org/all/20260604090756.2884671-2-tzungbi@kernel.org
> > > > > - 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."
> > > >
> > > > "power" may be confused with the power supply support, so I'd rather
> > > > use "pm" or even "pm_sleep" (in which case the "dpm_" prefix could be
> > > > dropped from the new module param name in the next patch).
> > >
> > > Ack, will use "pm_sleep" in the next version.
> > >
> > > Regarding dropping the "dpm_" prefix, should this also apply to the existing
> > > dpm_watchdog_all_cpu_backtrace parameter?  Or should we leave it as-is to
> > > avoid breaking existing configurations?
> >
> > Breaking things for someone would be unfortunate.
> >
> > For consistency, let's retain the "dpm_watchdog" part in this name and
> > use it in the new one.
> 
> Hmm, doesn't the prefix change already break things?

Theoretically yes, though it's worth noting that this parameter is
relatively new.  It was introduced in v6.19 (Oct 2025) via commit
a67818f74512 ("PM: dpm_watchdog: add module param to backtrace all CPUs").

To my knowledge, the flag was originally introduced for ChromeOS [1], which
doesn't actually rely on this module parameter in its production
configuration yet [2].

That said, I can't know the status of all other Linux distributions.  If we
want to be 100% safe against breaking existing setups, retaining the "main"
prefix is definitely the safest.

Given its recent introduction and limited known usage, this might be the
best window to rename the prefix before it gains wider adoption.

What are your thoughts?

[1] https://chromium-review.git.corp.google.com/c/chromiumos/third_party/kernel/+/7414781
[2] https://chromium-review.git.corp.google.com/c/chromiumos/third_party/kernel/+/7414721

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

* Re: [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power"
  2026-06-09 13:03           ` Tzung-Bi Shih
@ 2026-06-09 13:40             ` Rafael J. Wysocki
  0 siblings, 0 replies; 15+ messages in thread
From: Rafael J. Wysocki @ 2026-06-09 13:40 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Tomasz Figa, Rafael J. Wysocki, Jonathan Corbet,
	Greg Kroah-Hartman, Danilo Krummrich, Shuah Khan, Pavel Machek,
	Len Brown, linux-doc, linux-kernel, linux-pm, driver-core,
	senozhatsky, Randy Dunlap

On Tue, Jun 9, 2026 at 3:03 PM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> On Tue, Jun 09, 2026 at 08:17:03PM +0900, Tomasz Figa wrote:
> > On Tue, Jun 9, 2026 at 8:10 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > >
> > > On Tue, Jun 9, 2026 at 11:03 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> > > >
> > > > On Mon, Jun 08, 2026 at 04:11:30PM +0200, Rafael J. Wysocki wrote:
> > > > > On Mon, Jun 8, 2026 at 4:16 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> > > > > >
> > > > > > 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>
> > > > > > ---
> > > > > > v3:
> > > > > > - No changes.
> > > > > >
> > > > > > v2: https://lore.kernel.org/all/20260604090756.2884671-2-tzungbi@kernel.org
> > > > > > - 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."
> > > > >
> > > > > "power" may be confused with the power supply support, so I'd rather
> > > > > use "pm" or even "pm_sleep" (in which case the "dpm_" prefix could be
> > > > > dropped from the new module param name in the next patch).
> > > >
> > > > Ack, will use "pm_sleep" in the next version.
> > > >
> > > > Regarding dropping the "dpm_" prefix, should this also apply to the existing
> > > > dpm_watchdog_all_cpu_backtrace parameter?  Or should we leave it as-is to
> > > > avoid breaking existing configurations?
> > >
> > > Breaking things for someone would be unfortunate.
> > >
> > > For consistency, let's retain the "dpm_watchdog" part in this name and
> > > use it in the new one.
> >
> > Hmm, doesn't the prefix change already break things?
>
> Theoretically yes, though it's worth noting that this parameter is
> relatively new.  It was introduced in v6.19 (Oct 2025) via commit
> a67818f74512 ("PM: dpm_watchdog: add module param to backtrace all CPUs").
>
> To my knowledge, the flag was originally introduced for ChromeOS [1], which
> doesn't actually rely on this module parameter in its production
> configuration yet [2].
>
> That said, I can't know the status of all other Linux distributions.  If we
> want to be 100% safe against breaking existing setups, retaining the "main"
> prefix is definitely the safest.
>
> Given its recent introduction and limited known usage, this might be the
> best window to rename the prefix before it gains wider adoption.
>
> What are your thoughts?

If somebody complains about it, we can reconsider, but using "main" as
a prefix for power management module parameters is definitely
confusing.

> [1] https://chromium-review.git.corp.google.com/c/chromiumos/third_party/kernel/+/7414781
> [2] https://chromium-review.git.corp.google.com/c/chromiumos/third_party/kernel/+/7414721

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

end of thread, other threads:[~2026-06-09 13:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08  2:15 [PATCH v3 0/3] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
2026-06-08  2:15 ` [PATCH v3 1/3] PM: core: Rename module parameters prefix to "power" Tzung-Bi Shih
2026-06-08 14:11   ` Rafael J. Wysocki
2026-06-09  9:02     ` Tzung-Bi Shih
2026-06-09 11:10       ` Rafael J. Wysocki
2026-06-09 11:17         ` Tomasz Figa
2026-06-09 13:03           ` Tzung-Bi Shih
2026-06-09 13:40             ` Rafael J. Wysocki
2026-06-08  2:15 ` [PATCH v3 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
2026-06-08 14:14   ` Rafael J. Wysocki
2026-06-09  9:04     ` Tzung-Bi Shih
2026-06-08  2:15 ` [PATCH v3 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Tzung-Bi Shih
2026-06-08 14:22   ` Rafael J. Wysocki
2026-06-09  9:02     ` Tzung-Bi Shih
2026-06-09 11:08       ` Rafael J. Wysocki

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