From nobody Mon Jun 8 09:48:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 030C33FE371; Thu, 4 Jun 2026 09:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564120; cv=none; b=fY7Cj0JJ6LUEWDS6cbhB5RYlxyrhIriTCOcph72Cs0IduaA/YpLEA0xv9MulqAA1XRsvj5mVbqO0Zqx4hzpAJyuyNoDl+IxD09lE7veuu52AcJ5aCK2ZfjkMAKi06tlbRF5TP1ACdPoFwnENr9Hr5pZmxyeKKM1cqHXi8f+9Ho4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564120; c=relaxed/simple; bh=FCXKfyK3R7amxWftCypNVPwpWp03jMbMSnB/igxBliw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KnMIEslcOeR4J/zuyJz1roHmNzQy7lKyjEHeZIUtfJttDyrN1d82zGjhitlPCMq1HESrcv6jWA9iqFFZeqcV1JPKxYfHAHh2v26HrgjoGLSHxu03E3gDLxdPUxkYecSDMB9+hRj3j+s72ex62Jg+M/+FNmrCbDycCmtCwUYatjI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l7qL07e3; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l7qL07e3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7723B1F00899; Thu, 4 Jun 2026 09:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780564119; bh=LpfiuMeakI0p1/O+txo784HcmLdX0vSFzINtraQdAVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=l7qL07e3iQ1+gfuH+MVn0bVSjMRq3fXIcrWZISnHpPiAzl0WN5CVKdaj1vtKoTI9H /kMc23h2MR/LIROwCqSS3QL5BmYQ7BGWE0aGxNLaGhlPfNrjlYpdKqBuvHrYls/f3t uV0aan1arHJtw6fsgOxnltASh8rJj2gFJAWOhxToAMfOSGalgYmV7ANaQXKfj2nbj1 cMzkSXqle657c0lizK9W3VMN9XKsCiSMztje2WPlBp4GRknZdqIskVZJan6eTISQj/ 1QfwwnBrleyCDH8pFF/2S9MSbEbJbX5/tlwIIsnmnVBBSu33AaEYoP/zOWiWO3RvfA +ugcqCI/AasxQ== From: Tzung-Bi Shih To: Jonathan Corbet , "Rafael J. Wysocki" , Greg Kroah-Hartman , Danilo Krummrich Cc: Shuah Khan , Pavel Machek , Len Brown , tzungbi@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, tfiga@chromium.org, senozhatsky@chromium.org Subject: [PATCH v2 1/3] PM: core: Rename module parameters prefix to "power" Date: Thu, 4 Jun 2026 09:07:49 +0000 Message-ID: <20260604090756.2884671-2-tzungbi@kernel.org> X-Mailer: git-send-email 2.54.0.1032.g2f8565e1d1-goog In-Reply-To: <20260604090756.2884671-1-tzungbi@kernel.org> References: <20260604090756.2884671-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- v2: - 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" =20 +#undef MODULE_PARAM_PREFIX +#define MODULE_PARAM_PREFIX "power." + typedef int (*pm_callback_t)(struct device *); =20 /* --=20 2.54.0.1032.g2f8565e1d1-goog From nobody Mon Jun 8 09:48:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B7B241B346; Thu, 4 Jun 2026 09:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564131; cv=none; b=GPY8k6BmAQjaz/5Q0C3817QpRwm5zAtaAHKEDu9Y473fY2uCoM8rvTaLwKNOD+wJT6TDnC6ybWLprAOlV1edl5FuwNd8qMQFLTKxSsVxDex8LOzlVODkpxPrAwAb424m9hH8y3qO3cp6e7EUpaNANtyM05J/oimLwiGmx9bEp3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564131; c=relaxed/simple; bh=FCXKfyK3R7amxWftCypNVPwpWp03jMbMSnB/igxBliw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XLXoe/IYfU+bSPyek1MHDuSpdMIM7+h5zh6JcBLFu26mpBtEFCMGokOfqSWgwZRQ55Dj0GCQ8VOf2uunzsMn7878uN73BTD0pwHDw6iQh+sHPcDda0c3mKfQjzUp8/fwEGR0Lx59K6irvLYNa/Wrd/tH0X8oVLaSwogEj5bout4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oNTjpFTr; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oNTjpFTr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE0091F0089A; Thu, 4 Jun 2026 09:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780564129; bh=LpfiuMeakI0p1/O+txo784HcmLdX0vSFzINtraQdAVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oNTjpFTr3W5Geviv38LQcfRC3tim7YexwUgI+AQw84a/lCubsNEbkF5/iZ7wOqvVI 5dhycnqcpS3IUnlsIemnTMEuevlcUkdG8JASkKWCCGDRcuDTZQie8a5FxZf9H5G7U8 vhntUwzjqvracFCzfhzZpmkyH53hYWezsr0aaI/d0CYskZcQCCeZgg2qTHHsSkl9dv ZLHM+vHkW99G3itevJw6c9YQNY4bMZdTpVW1Q5n/YS6fKo0w0cZj6tLFtMTLtEzAGf foS4D+Y1/nHa7jvD+L4J3CL/aGFomVyfo/nG+dXXBNzR6IsS04etp0KAC3AtUqxQ9s rIDqq3JP5N7mw== From: Tzung-Bi Shih To: Jonathan Corbet , "Rafael J. Wysocki" , Greg Kroah-Hartman , Danilo Krummrich Cc: Shuah Khan , Pavel Machek , Len Brown , tzungbi@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, tfiga@chromium.org, senozhatsky@chromium.org Subject: [PATCH v2 1/3] PM: core: Rename module parameters prefix to "power" Date: Thu, 4 Jun 2026 09:07:53 +0000 Message-ID: <20260604090756.2884671-6-tzungbi@kernel.org> X-Mailer: git-send-email 2.54.0.1032.g2f8565e1d1-goog In-Reply-To: <20260604090756.2884671-1-tzungbi@kernel.org> References: <20260604090756.2884671-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- v2: - 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" =20 +#undef MODULE_PARAM_PREFIX +#define MODULE_PARAM_PREFIX "power." + typedef int (*pm_callback_t)(struct device *); =20 /* --=20 2.54.0.1032.g2f8565e1d1-goog From nobody Mon Jun 8 09:48:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81EF43FA5C3; Thu, 4 Jun 2026 09:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564123; cv=none; b=h2LmEgSrDQ+nJWMm85cMOpqzY/87wiW8MIjUjXMdUUW6EYLB7yq7eAFEPDk96EFJG7+scsxyPFaUMpLWUXcobnahsgjNwpZLiKHc8q8rMTHws++SuOAZ/q10/efg9teX9jZjL7xzIeTfZtnVmeW/9WM8j5J4WRRCxMdJELDPF7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564123; c=relaxed/simple; bh=1nUCbBcG/ceajNb/U0e4uaBC+wh2nb/tdEkyFINrWac=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LPa7sathG2GL/AhPQxxqWi8MzcEA4AbpdSLwmdJ2Y0GPZ7aSVB3E4LEVRXqGSqqgSfd/ia/BYyqE1FC7u4nuLWRbGZp38+6OJs0cuYe9XDqUuktLC1ODmfUKyRfYegNonPbUVZIsqwsKDz+YFfuzmGaE4qe8a5mI4cFe2auOlvY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KLp2A4Hd; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KLp2A4Hd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC0F1F00898; Thu, 4 Jun 2026 09:08:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780564122; bh=qajQS6K4sEG7dCirtHqQn3VxJX58YgefzvtwF+eYZ04=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KLp2A4HdXtS0+KB4ncOBHLw3JmZTTRBC8/a0d2meE0ApmGnGe94bwAXG7OaagAWyu voMuPtgQSE8CpP1/uoig8niOc6KAYoYj8TVheR1CNcs1r8ky2p4peKr4pY59B0F2iH oUJ9EimPn4cRb8TdiYA+jH4CII28H9rr+B78TSn9DphF2Rau3BD0AM0VAbZ1jyloAK 7HdDrmA9ztl4vWWcjhmLrcODKzGEoGk1sphZlDjaUKFN7RyvHmDUbuGbBfzMUBoKsw m1oeFLB7SlC9Z/0DNFT/43TpBoJ9ZT+rad/qm1455Iqkbs1lijHCzz+zzJXbmv8Dh6 5ke7vdFhf++aQ== From: Tzung-Bi Shih To: Jonathan Corbet , "Rafael J. Wysocki" , Greg Kroah-Hartman , Danilo Krummrich Cc: Shuah Khan , Pavel Machek , Len Brown , tzungbi@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, tfiga@chromium.org, senozhatsky@chromium.org Subject: [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Date: Thu, 4 Jun 2026 09:07:50 +0000 Message-ID: <20260604090756.2884671-3-tzungbi@kernel.org> X-Mailer: git-send-email 2.54.0.1032.g2f8565e1d1-goog In-Reply-To: <20260604090756.2884671-1-tzungbi@kernel.org> References: <20260604090756.2884671-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- v2: - 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 | 9 +++++++++ 3 files changed, 28 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index 00375193bd26..0a0d5340b0c7 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5399,6 +5399,14 @@ Kernel parameters function to NULL. On Idle the CPU just reduces execution priority. =20 + power.dpm_watchdog_enabled=3D + [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. + 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, 064= 4); MODULE_PARM_DESC(dpm_watchdog_all_cpu_backtrace, "Backtrace all CPUs on DPM watchdog timeout"); =20 +static bool __read_mostly dpm_watchdog_enabled =3D + 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, s= truct device *dev) { struct timer_list *timer =3D &wd->timer; =20 + if (!dpm_watchdog_enabled) + return; + wd->dev =3D dev; wd->tsk =3D current; wd->fatal =3D CONFIG_DPM_WATCHDOG_TIMEOUT =3D=3D CONFIG_DPM_WATCHDOG_WARN= ING_TIMEOUT; @@ -595,6 +603,9 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd) { struct timer_list *timer =3D &wd->timer; =20 + 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..12a4a66d48d4 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -268,6 +268,15 @@ config DPM_WATCHDOG captured in pstore device for inspection in subsequent boot session. =20 +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 --=20 2.54.0.1032.g2f8565e1d1-goog From nobody Mon Jun 8 09:48:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD76B421880; Thu, 4 Jun 2026 09:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564133; cv=none; b=gf5cd+qyfz8pYGUeL/DU0TCM7TVGMoCEq1UKAsl7W8MeWd/wau9zZlxco6FoGPP/AqSZf82VsE9LzMhyf2jHLwgk68KP2KR/mZMQKfn0IAKJzxvdk7LUFQS3TFSmGB6YhsUjBPt7tXDxs6O053bbRgHUuRfP53fFtp+sA5Qfyrg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564133; c=relaxed/simple; bh=1nUCbBcG/ceajNb/U0e4uaBC+wh2nb/tdEkyFINrWac=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g4mnbBPZYmMS8cZwBaJUb5rkS3uc0JQ32w23qoRt42H/HhoFTPsnIKkAUNT+yxf7YBsHz4DN2Nk3jbgSQqdTMXtWHq5BmMzl8/aZO9wvpfl9uty9r78vStUlPYZnQVSt83Xx20q4h9rE8zSfZDOXGbyqrBS8A5TIbl816sZhAf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=huR4jhXs; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="huR4jhXs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 411A61F00893; Thu, 4 Jun 2026 09:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780564132; bh=qajQS6K4sEG7dCirtHqQn3VxJX58YgefzvtwF+eYZ04=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=huR4jhXs9nDMNUpNG3E1F2KYxuyQSphOyGE9F92NH3vHXQQ6VjNRyalt7P8MezOL3 Fjj6/w9asb93qxGDMOyj9aNzkrHSRUUYnie4r1sjYtTMvpDQz/p1a5Gm/pQNoR6dHC 2B1TwXUWkvblhEn62cMTD4uKe0Tuz2uhBTn5QnKcl1eapFVPegwUAGGbo0EDOvY0cn Li+gXr/ow83R7GqO7BUJOP1Xse2RK+cxiPC6S1P+ONhlE3EyBfDzzyeWks1pPFP0LO zkrysR/FJWTJ9s1h+o3C0U2RZs0AAhBg4fKNbBs+wMAGaUwVRlVUzzbggH0lUNZRXT BeLD/dtPfGLMA== From: Tzung-Bi Shih To: Jonathan Corbet , "Rafael J. Wysocki" , Greg Kroah-Hartman , Danilo Krummrich Cc: Shuah Khan , Pavel Machek , Len Brown , tzungbi@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, tfiga@chromium.org, senozhatsky@chromium.org Subject: [PATCH v2 2/3] PM: dpm_watchdog: Allow disabling DPM watchdog by default Date: Thu, 4 Jun 2026 09:07:54 +0000 Message-ID: <20260604090756.2884671-7-tzungbi@kernel.org> X-Mailer: git-send-email 2.54.0.1032.g2f8565e1d1-goog In-Reply-To: <20260604090756.2884671-1-tzungbi@kernel.org> References: <20260604090756.2884671-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- v2: - 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 | 9 +++++++++ 3 files changed, 28 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index 00375193bd26..0a0d5340b0c7 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5399,6 +5399,14 @@ Kernel parameters function to NULL. On Idle the CPU just reduces execution priority. =20 + power.dpm_watchdog_enabled=3D + [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. + 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, 064= 4); MODULE_PARM_DESC(dpm_watchdog_all_cpu_backtrace, "Backtrace all CPUs on DPM watchdog timeout"); =20 +static bool __read_mostly dpm_watchdog_enabled =3D + 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, s= truct device *dev) { struct timer_list *timer =3D &wd->timer; =20 + if (!dpm_watchdog_enabled) + return; + wd->dev =3D dev; wd->tsk =3D current; wd->fatal =3D CONFIG_DPM_WATCHDOG_TIMEOUT =3D=3D CONFIG_DPM_WATCHDOG_WARN= ING_TIMEOUT; @@ -595,6 +603,9 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd) { struct timer_list *timer =3D &wd->timer; =20 + 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..12a4a66d48d4 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -268,6 +268,15 @@ config DPM_WATCHDOG captured in pstore device for inspection in subsequent boot session. =20 +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 --=20 2.54.0.1032.g2f8565e1d1-goog From nobody Mon Jun 8 09:48:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AD133FF8B1; Thu, 4 Jun 2026 09:08:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564126; cv=none; b=SNgtbEA3jFYJ97AK/RPqNDH7BlJJI+/OqFFpJrdmDfF7EKDQRTHFQo5VUP0TmCXAXBu4w866Gw69ZOq7Ep/OjLzTzXHGaQKqdJCeb7AW6nPruee8XfUcQ5ydeMQfdYC3VOKoSW3DasItqNTH9P3vqHOQJII1GdW8KCKaoZlx0zk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564126; c=relaxed/simple; bh=1NKFWL2NyVxy6Y6uj2DWwKX9cpfJCoivyYZ47AVpgy8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hb8kLtZtruqjVjsDr+HoYuZZwDXteGKnDzK8XexJCKfR8KHXBrqAwYncmqjFbcjzKiqEPmUNAuhuHUnQlVtInLqWiXbudesH4hg7++zitNemY102J6zO3kxxo9pABNGkigyqCA9CLDL16MxLmEJYsNIlYpnguPNY11U19wBKfQ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WlbTav/o; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WlbTav/o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92B3E1F00893; Thu, 4 Jun 2026 09:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780564124; bh=FFTwwbkj61o3Y4O9YgiQkwjXl0EBdIaAq8zyegWIOt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WlbTav/oWR3Y6aYPEt4Qkua8cgeLxpxCofHpp0/VCk4Mu3Ti1qSSVqYcRiiiyH5GR kifiWrEfos9iX0eWHig4g7ftPzd+m5vKCK0KFl5OnlXvArAa1k8wx/uGtgj+b8CD5j EWAOZnK53Caq2YtDg3J5Qs/xLW+gQLwizq9u8V13ZqO+Q68HYBBmsO5ByCG4iJRQgY ysrBRtELNJ7OfuMz20M8gqIrAPm8KwMymXQodg/J7X+PY6exO2IhCahac/1RJj7TFQ tSd5oX5njjpTWy/U7eroVnGNU8dn79xZZDWQiWUE6YL9cK9IyrOLM+eYWMAX9GSG+J fstaaD04OwYZw== From: Tzung-Bi Shih To: Jonathan Corbet , "Rafael J. Wysocki" , Greg Kroah-Hartman , Danilo Krummrich Cc: Shuah Khan , Pavel Machek , Len Brown , tzungbi@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, tfiga@chromium.org, senozhatsky@chromium.org Subject: [PATCH v2 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Date: Thu, 4 Jun 2026 09:07:51 +0000 Message-ID: <20260604090756.2884671-4-tzungbi@kernel.org> X-Mailer: git-send-email 2.54.0.1032.g2f8565e1d1-goog In-Reply-To: <20260604090756.2884671-1-tzungbi@kernel.org> References: <20260604090756.2884671-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- v2: - 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 #include #include +#include #include #include #include @@ -539,6 +540,58 @@ static bool __read_mostly dpm_watchdog_enabled =3D module_param(dpm_watchdog_enabled, bool, 0644); MODULE_PARM_DESC(dpm_watchdog_enabled, "Enable DPM watchdog"); =20 +static unsigned int __read_mostly dpm_watchdog_timeout =3D CONFIG_DPM_WATC= HDOG_TIMEOUT; +static unsigned int __read_mostly dpm_watchdog_warning_timeout =3D + CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT; +static const unsigned int dpm_watchdog_timeout_max =3D 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 =3D *table; + unsigned int val =3D dpm_watchdog_timeout; + int ret; + + ctl.data =3D &val; + ret =3D proc_douintvec_minmax(&ctl, write, buffer, lenp, ppos); + if (ret || !write) + return ret; + + if (val < dpm_watchdog_warning_timeout) + dpm_watchdog_warning_timeout =3D val; + dpm_watchdog_timeout =3D val; + + return 0; +} + +static const struct ctl_table dpm_watchdog_sysctls[] =3D { + { + .procname =3D "dpm_watchdog_timeout_secs", + .maxlen =3D sizeof(unsigned int), + .mode =3D 0644, + .proc_handler =3D proc_dodpm_watchdog_timeout_secs, + .extra1 =3D SYSCTL_ONE, + .extra2 =3D (void *)&dpm_watchdog_timeout_max, + }, + { + .procname =3D "dpm_watchdog_warning_timeout_secs", + .data =3D &dpm_watchdog_warning_timeout, + .maxlen =3D sizeof(unsigned int), + .mode =3D 0644, + .proc_handler =3D proc_douintvec_minmax, + .extra1 =3D SYSCTL_ONE, + .extra2 =3D (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)); } =20 - time_left =3D CONFIG_DPM_WATCHDOG_TIMEOUT - CONFIG_DPM_WATCHDOG_WARNING_T= IMEOUT; + time_left =3D dpm_watchdog_timeout - dpm_watchdog_warning_timeout; dev_warn(wd->dev, "**** DPM device timeout after %u seconds; %u seconds u= ntil panic ****\n", - CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT, time_left); + dpm_watchdog_warning_timeout, time_left); show_stack(wd->tsk, NULL, KERN_WARNING); =20 wd->fatal =3D true; @@ -587,11 +640,11 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd,= struct device *dev) =20 wd->dev =3D dev; wd->tsk =3D current; - wd->fatal =3D CONFIG_DPM_WATCHDOG_TIMEOUT =3D=3D CONFIG_DPM_WATCHDOG_WARN= ING_TIMEOUT; + wd->fatal =3D dpm_watchdog_timeout =3D=3D dpm_watchdog_warning_timeout; =20 timer_setup_on_stack(timer, dpm_watchdog_handler, 0); /* use same timeout value for both suspend and resume */ - timer->expires =3D jiffies + HZ * CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT; + timer->expires =3D jiffies + HZ * dpm_watchdog_warning_timeout; add_timer(timer); } =20 --=20 2.54.0.1032.g2f8565e1d1-goog From nobody Mon Jun 8 09:48:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69E754219EB; Thu, 4 Jun 2026 09:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564136; cv=none; b=lQjXAmijYmR8mUMq8qjIIuxtI5U1t4KlS9QkmpEOWj0M+uAN4Vg6vdWljeVfo5Hxpvbf4ZjeR6ORsWfBQRp+GBThW9pioJCa/C0i9cZw+jmCBIEJmdpyMMuDcEQ2Uj67yEb3L3vjhOARIw7HPh8TPbJ9kvAc8Py0cHwMdA2LeVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780564136; c=relaxed/simple; bh=1NKFWL2NyVxy6Y6uj2DWwKX9cpfJCoivyYZ47AVpgy8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y4ezwEhhCe5TCmx9/3DSacbSkfNVPmy+sVrduNkNL9txzPFAKsuKkYvhKssHV9Xl/kWBJWyACoKOnL8tIq1TXLmkGAFLoiraHwWoPW7ueUyxIbDQlXBjZw3RUizc9C7MrXA0+IvqDMFz/+eO5GQCzRVsfOHDgnHHghwju/iTAWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KcLDXcjW; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KcLDXcjW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8DB01F00899; Thu, 4 Jun 2026 09:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780564135; bh=FFTwwbkj61o3Y4O9YgiQkwjXl0EBdIaAq8zyegWIOt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KcLDXcjWGtAg2811Q+a2RAuhJG6qki9A5EQagMO5XyJG4wv5b2Iw1AsJzHgIHAHDK XE6gM248njueuhrdCZopJzfkhImR2ltMPGPxXBPvaF6FIvh5xj3loqNWC4eIcoNZmS bok0gleFi60nuvGgl5meS8v09FU0UdhSjC9HYJ2/Uz5iXZsYi4ReYUl4EysSjcyOP+ iJszwYng6Y1gRtmnk52ALJPfAU3pe8jUwJ31GyCaFHKbKQMgMzKnxc50FYdIbgQNyg OvjOqfvsuf70R+mjw02IetdUCUwGF/wC6y8yu7LNHMx36NaCpmkHZKzxCoQMMuk3+u T9bIYFTdr/Fng== From: Tzung-Bi Shih To: Jonathan Corbet , "Rafael J. Wysocki" , Greg Kroah-Hartman , Danilo Krummrich Cc: Shuah Khan , Pavel Machek , Len Brown , tzungbi@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, tfiga@chromium.org, senozhatsky@chromium.org Subject: [PATCH v2 3/3] PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts Date: Thu, 4 Jun 2026 09:07:55 +0000 Message-ID: <20260604090756.2884671-8-tzungbi@kernel.org> X-Mailer: git-send-email 2.54.0.1032.g2f8565e1d1-goog In-Reply-To: <20260604090756.2884671-1-tzungbi@kernel.org> References: <20260604090756.2884671-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- v2: - 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 #include #include +#include #include #include #include @@ -539,6 +540,58 @@ static bool __read_mostly dpm_watchdog_enabled =3D module_param(dpm_watchdog_enabled, bool, 0644); MODULE_PARM_DESC(dpm_watchdog_enabled, "Enable DPM watchdog"); =20 +static unsigned int __read_mostly dpm_watchdog_timeout =3D CONFIG_DPM_WATC= HDOG_TIMEOUT; +static unsigned int __read_mostly dpm_watchdog_warning_timeout =3D + CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT; +static const unsigned int dpm_watchdog_timeout_max =3D 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 =3D *table; + unsigned int val =3D dpm_watchdog_timeout; + int ret; + + ctl.data =3D &val; + ret =3D proc_douintvec_minmax(&ctl, write, buffer, lenp, ppos); + if (ret || !write) + return ret; + + if (val < dpm_watchdog_warning_timeout) + dpm_watchdog_warning_timeout =3D val; + dpm_watchdog_timeout =3D val; + + return 0; +} + +static const struct ctl_table dpm_watchdog_sysctls[] =3D { + { + .procname =3D "dpm_watchdog_timeout_secs", + .maxlen =3D sizeof(unsigned int), + .mode =3D 0644, + .proc_handler =3D proc_dodpm_watchdog_timeout_secs, + .extra1 =3D SYSCTL_ONE, + .extra2 =3D (void *)&dpm_watchdog_timeout_max, + }, + { + .procname =3D "dpm_watchdog_warning_timeout_secs", + .data =3D &dpm_watchdog_warning_timeout, + .maxlen =3D sizeof(unsigned int), + .mode =3D 0644, + .proc_handler =3D proc_douintvec_minmax, + .extra1 =3D SYSCTL_ONE, + .extra2 =3D (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)); } =20 - time_left =3D CONFIG_DPM_WATCHDOG_TIMEOUT - CONFIG_DPM_WATCHDOG_WARNING_T= IMEOUT; + time_left =3D dpm_watchdog_timeout - dpm_watchdog_warning_timeout; dev_warn(wd->dev, "**** DPM device timeout after %u seconds; %u seconds u= ntil panic ****\n", - CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT, time_left); + dpm_watchdog_warning_timeout, time_left); show_stack(wd->tsk, NULL, KERN_WARNING); =20 wd->fatal =3D true; @@ -587,11 +640,11 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd,= struct device *dev) =20 wd->dev =3D dev; wd->tsk =3D current; - wd->fatal =3D CONFIG_DPM_WATCHDOG_TIMEOUT =3D=3D CONFIG_DPM_WATCHDOG_WARN= ING_TIMEOUT; + wd->fatal =3D dpm_watchdog_timeout =3D=3D dpm_watchdog_warning_timeout; =20 timer_setup_on_stack(timer, dpm_watchdog_handler, 0); /* use same timeout value for both suspend and resume */ - timer->expires =3D jiffies + HZ * CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT; + timer->expires =3D jiffies + HZ * dpm_watchdog_warning_timeout; add_timer(timer); } =20 --=20 2.54.0.1032.g2f8565e1d1-goog