PM: dpm_watchdog: Improve DPM watchdog configurability
Subsystems (5)
v6 cover PM: dpm_watchdog: Improve DPM watchdog configurability
This series improves the configurability of the DPM watchdog.
Currently, the DPM 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 fordrivers/base/power/main.c from "main" to "pm".
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 the default value of the module parameter at compile time.
The primary motivation for this configurability revolves around Android GKI (Generic Kernel Image). We want to enable CONFIG_DPM_WATCHDOG in the GKI so the feature is available. However, because the GKI is shared across many different devices, we don't want to inadvertently affect devices that are unaware of this feature. This provides a way to compile it in, but keep it disabled by default for those devices via the kernel command line or module parameters.
To maintain backward compatibility, CONFIG_DPM_WATCHDOG_ENABLED relies on default y. Previously, the DPM watchdog was always active if CONFIG_DPM_WATCHDOG was set. Defaulting this new option to 'y' ensures that the behavior remains unchanged for existing users and defconfigs when they upgrade.
---
v6:
- Change the prefix "pm_sleep" -> "pm".
v5: https://lore.kernel.org/all/[email protected]
- Rebase to v7.2-rc1.
- Fix Signed-off-by lines.
v4: https://lore.kernel.org/all/[email protected]
- 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"
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.55.0.795.g602f6c329a-goog
PATCH v6 1/2 PM: sleep: Rename module parameters prefix to "pm"
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." to group the module parameters under the namespace instead. This makes the parameters more descriptive.
---
v6:
- Change the prefix "pm_sleep" -> "pm".
v5: https://lore.kernel.org/all/[email protected]
- No changes.
v4: https://lore.kernel.org/all/[email protected]
- "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." +typedef int (*pm_callback_t )(struct device *);/*
Signature · 1 line
2.55.0.795.g602f6c329a-goog
PATCH v6 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 the default value of the module parameter at compile time.
The primary motivation for this configurability resolves around Android GKI (Generic Kernel Image). We want to enable CONFIG_DPM_WATCHDOG in the GKI so the feature is available. However, because the GKI is shared across many different devices, we don't want to inadvertently affect devices that are unaware of this feature. This provides a way to compile it in, but keep it disabled by default for those devices via the kernel command line or module parameters.
To maintain backward compatibility, CONFIG_DPM_WATCHDOG_ENABLED relies on default y. Previously, the DPM watchdog was always active if CONFIG_DPM_WATCHDOG was set. Defaulting this new option to 'y' ensures that the behavior remains unchanged for existing users and defconfigs when they upgrade.
---
v6:
- Change the prefix "pm_sleep" -> "pm".
v5: https://lore.kernel.org/all/[email protected]
- No changes.
v4: https://lore.kernel.org/all/[email protected]
- 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
@@ -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.
@@ -5354,6 +5355,12 @@ Kernel parameters pm_debug_messages [SUSPEND,KNL] Enable suspend/resume debug messages during boot up. + pm.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.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.55.0.795.g602f6c329a-goog
Quoted 33 lines · Tzung-Bi Shih
This series improves the configurability of the DPM watchdog.
Currently, the DPM 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.
Patch 1 renames the module parameter prefix for
drivers/base/power/main.cfrom "main" to "pm".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 the default value of the module parameter at compile time.The primary motivation for this configurability revolves around Android GKI (Generic Kernel Image). We want to enable
CONFIG_DPM_WATCHDOGin the GKI so the feature is available. However, because the GKI is shared across many different devices, we don't want to inadvertently affect devices that are unaware of this feature. This provides a way to compile it in, but keep it disabled by default for those devices via the kernel command line or module parameters.To maintain backward compatibility,
CONFIG_DPM_WATCHDOG_ENABLEDrelies ondefault y. Previously, the DPM watchdog was always active ifCONFIG_DPM_WATCHDOGwas set. Defaulting this new option to 'y' ensures that the behavior remains unchanged for existing users and defconfigs when they upgrade.
---
v6:
- Change the prefix "pm_sleep" -> "pm".
Quoted 3 lines
v5: https://lore.kernel.org/all/[email protected]
- Rebase to v7.2-rc1.
- Fix Signed-off-by lines.
Since there was no further feedback on v5, I'm sending out v6. Any feedback would be appreciated.