Linux driver-core infrastructure
 help / color / mirror / Atom feed
* [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability
@ 2026-06-11  2:12 Tzung-Bi Shih
  2026-06-11  2:12 ` [PATCH v4 1/2] PM: sleep: Rename module parameters prefix to "pm_sleep" Tzung-Bi Shih
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-06-11  2:12 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 "pm_sleep".

Patch 2 introduces the "dpm_watchdog_enabled" module parameter to allow
enabling/disabling the watchdog at boot time and runtime.  It also adds
CONFIG_DPM_WATCHDOG_ENABLED to set default value of the module parameter
at compile time.

---
v4:
- Address review comments.
- Patch 3 in v3 has applied separately.

v3: https://lore.kernel.org/all/20260608021526.1023248-1-tzungbi@kernel.org
- 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 (2):
  PM: sleep: Rename module parameters prefix to "pm_sleep"
  PM: dpm_watchdog: Allow disabling DPM watchdog by default

 Documentation/admin-guide/kernel-parameters.txt |  7 +++++++
 drivers/base/power/main.c                       | 14 ++++++++++++++
 kernel/power/Kconfig                            | 10 ++++++++++
 3 files changed, 31 insertions(+)

-- 
2.54.0.1099.g489fc7bff1-goog


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

* [PATCH v4 1/2] PM: sleep: Rename module parameters prefix to "pm_sleep"
  2026-06-11  2:12 [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
@ 2026-06-11  2:12 ` Tzung-Bi Shih
  2026-06-11  2:12 ` [PATCH v4 2/2] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
  2026-06-24  9:31 ` [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
  2 siblings, 0 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-06-11  2:12 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
is too generic and non-descriptive.

Redefine MODULE_PARAM_PREFIX to "pm_sleep." to group the module
parameters under the namespace instead.  This makes the parameters more
descriptive.

---
v4:
- "power" -> "pm_sleep".

v3: https://lore.kernel.org/all/20260608021526.1023248-2-tzungbi@kernel.org
- No changes.

v2: https://lore.kernel.org/all/20260604090756.2884671-2-tzungbi@kernel.org
- New to the series.

v1: Doesn't exist.

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 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 f71467f6ada4..c6a3300cfb7a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -41,6 +41,9 @@
 #include "../base.h"
 #include "power.h"
 
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "pm_sleep."
+
 typedef int (*pm_callback_t)(struct device *);
 
 /*
-- 
2.54.0.1099.g489fc7bff1-goog


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

* [PATCH v4 2/2] PM: dpm_watchdog: Allow disabling DPM watchdog by default
  2026-06-11  2:12 [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
  2026-06-11  2:12 ` [PATCH v4 1/2] PM: sleep: Rename module parameters prefix to "pm_sleep" Tzung-Bi Shih
@ 2026-06-11  2:12 ` Tzung-Bi Shih
  2026-06-24  9:31 ` [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
  2 siblings, 0 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-06-11  2:12 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 "dpm_watchdog_enabled" module parameter to allow the DPM
watchdog to be enabled or disabled at boot time and runtime.

Additionally, introduce the CONFIG_DPM_WATCHDOG_ENABLED Kconfig option
to set default value of the module parameter at compile time.

This provides flexibility for systems that want the watchdog code
compiled in but inactive by default, allowing it to be enabled only when
needed.

---
v4:
- Rewrite the commit message to indicate the module parameter is the
  main change in the patch.
- DPM_WATCHDOG_DEFAULT_ENABLED -> DPM_WATCHDOG_ENABLED.

v3: https://lore.kernel.org/all/20260608021526.1023248-3-tzungbi@kernel.org
- 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

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 Documentation/admin-guide/kernel-parameters.txt |  7 +++++++
 drivers/base/power/main.c                       | 11 +++++++++++
 kernel/power/Kconfig                            | 10 ++++++++++
 3 files changed, 28 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 1abdb31fa126..718ea16ffaff 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -49,6 +49,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.
@@ -5365,6 +5366,12 @@ Kernel parameters
 	pm_debug_messages	[SUSPEND,KNL]
 			Enable suspend/resume debug messages during boot up.
 
+	pm_sleep.dpm_watchdog_enabled=
+			[PM] Enable or disable the DPM watchdog.  Requires
+			CONFIG_PM_SLEEP and CONFIG_DPM_WATCHDOG enabled.
+			Format: <bool>
+			Default value is set by CONFIG_DPM_WATCHDOG_ENABLED.
+
 	pnp.debug=1	[PNP]
 			Enable PNP debug messages (depends on the
 			CONFIG_PNP_DEBUG_MESSAGES option).  Change at run-time
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index c6a3300cfb7a..f58945758868 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -535,6 +535,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_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;
@@ -630,6 +635,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 = dpm_watchdog_timeout == dpm_watchdog_warning_timeout;
@@ -648,6 +656,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..508ceabc4d2e 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_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 "pm_sleep.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] 4+ messages in thread

* Re: [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability
  2026-06-11  2:12 [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
  2026-06-11  2:12 ` [PATCH v4 1/2] PM: sleep: Rename module parameters prefix to "pm_sleep" Tzung-Bi Shih
  2026-06-11  2:12 ` [PATCH v4 2/2] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
@ 2026-06-24  9:31 ` Tzung-Bi Shih
  2 siblings, 0 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-06-24  9:31 UTC (permalink / raw)
  To: 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, Randy Dunlap

On Thu, Jun 11, 2026 at 02:12:16AM +0000, Tzung-Bi Shih wrote:
> 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 "pm_sleep".
> 
> Patch 2 introduces the "dpm_watchdog_enabled" module parameter to allow
> enabling/disabling the watchdog at boot time and runtime.  It also adds
> CONFIG_DPM_WATCHDOG_ENABLED to set default value of the module parameter
> at compile time.

Just realized I messed up the Signed-off-by lines for the patches, so they
haven't been added correctly to the commit messages.  Please disregard this
series.  I'll fix and resend the series after v7.2-rc1 is out.

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

end of thread, other threads:[~2026-06-24  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11  2:12 [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih
2026-06-11  2:12 ` [PATCH v4 1/2] PM: sleep: Rename module parameters prefix to "pm_sleep" Tzung-Bi Shih
2026-06-11  2:12 ` [PATCH v4 2/2] PM: dpm_watchdog: Allow disabling DPM watchdog by default Tzung-Bi Shih
2026-06-24  9:31 ` [PATCH v4 0/2] PM: dpm_watchdog: Improve DPM watchdog configurability Tzung-Bi Shih

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