PM: dpm_watchdog: Improve DPM watchdog configurability
Subsystems (5)
v4 cover PM: dpm_watchdog: Improve DPM watchdog configurability
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/[email protected]
- Address review comments on patch 2.
v2: https://lore.kernel.org/all/[email protected]
- 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(+)
Signature · 1 line
2.54.0.1099.g489fc7bff1-goog
PATCH v4 1/2 PM: sleep: Rename module parameters prefix to "pm_sleep"
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/[email protected]
- No changes.
v2: https://lore.kernel.org/all/[email protected]
- New to the series.
v1: Doesn't exist.
--- drivers/base/power/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/power/main.c +3 -0
@@ -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 *);/*
Signature · 1 line
2.54.0.1099.g489fc7bff1-goog
PATCH v4 2/2 PM: dpm_watchdog: Allow disabling DPM watchdog by default
In reply to Tzung-Bi ShihIntroduce 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/[email protected]
- 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/[email protected]
- Use module parameter and bool for dpm_watchdog_enabled.
- Use IS_ENABLED().
v1: https://lore.kernel.org/all/[email protected]
--- Documentation/admin-guide/kernel-parameters.txt | 7 +++++++ drivers/base/power/main.c | 11 +++++++++++ kernel/power/Kconfig | 10 ++++++++++ 3 files changed, 28 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +7 -0
@@ -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
drivers/base/power/main.c +11 -0
@@ -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); }
kernel/power/Kconfig +10 -0
@@ -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
Signature · 1 line
2.54.0.1099.g489fc7bff1-goog
Quoted 9 lines · Tzung-Bi Shih
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.cuse the generic and non-descriptive "main" prefix.This series addresses these limitations.
Quoted 7 lines
Patch 1 renames the module parameter prefix for
drivers/base/power/main.cfrom "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 addsCONFIG_DPM_WATCHDOG_ENABLEDto 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.