From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Danilo Krummrich <dakr@kernel.org>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
Pavel Machek <pavel@kernel.org>, Len Brown <lenb@kernel.org>,
tzungbi@kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
driver-core@lists.linux.dev
Subject: [PATCH] PM: sleep: Allow disabling DPM watchdog by default
Date: Thu, 28 May 2026 10:32:15 +0000 [thread overview]
Message-ID: <20260528103215.505795-1-tzungbi@kernel.org> (raw)
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" boot parameter to
enable or disable the watchdog at boot 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.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
.../admin-guide/kernel-parameters.txt | 8 ++++++++
drivers/base/power/main.c | 20 +++++++++++++++++++
kernel/power/Kconfig | 9 +++++++++
3 files changed, 37 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 85936e48cf9a..3a919e660137 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1344,6 +1344,14 @@ Kernel parameters
it becomes active and is searched during signature
verification.
+ 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.
+
driver_async_probe= [KNL]
List of driver names to be probed asynchronously. *
matches with all driver names. If * is specified, the
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index e1b550664bab..4f92905f3edf 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -527,6 +527,20 @@ module_param(dpm_watchdog_all_cpu_backtrace, bool, 0644);
MODULE_PARM_DESC(dpm_watchdog_all_cpu_backtrace,
"Backtrace all CPUs on DPM watchdog timeout");
+#ifdef CONFIG_DPM_WATCHDOG_DEFAULT_ENABLED
+static unsigned int __read_mostly dpm_watchdog_enabled = 1;
+#else
+static unsigned int __read_mostly dpm_watchdog_enabled;
+#endif
+
+static int __init dpm_watchdog_setup(char *str)
+{
+ if (kstrtouint(str, 0, &dpm_watchdog_enabled) == 0)
+ return 1;
+ return 0;
+}
+__setup("dpm_watchdog_enabled=", dpm_watchdog_setup);
+
/**
* dpm_watchdog_handler - Driver suspend / resume watchdog handler.
* @t: The timer that PM watchdog depends on.
@@ -570,6 +584,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;
@@ -588,6 +605,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 05337f437cca..d4cecdb8575e 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -267,6 +267,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.929.g9b7fa37559-goog
next reply other threads:[~2026-05-28 10:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 10:32 Tzung-Bi Shih [this message]
2026-06-01 18:39 ` Rafael J. Wysocki
2026-06-02 2:08 ` Tzung-Bi Shih
2026-06-02 8:37 ` Tomasz Figa
2026-06-02 10:48 ` Tzung-Bi Shih
2026-06-02 12:57 ` Tomasz Figa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260528103215.505795-1-tzungbi@kernel.org \
--to=tzungbi@kernel.org \
--cc=corbet@lwn.net \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=lenb@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®