From: Tzung-Bi Shih <tzungbi@kernel.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Danilo Krummrich <dakr@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Pavel Machek <pavel@kernel.org>, Len Brown <lenb@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
Subject: Re: [PATCH] PM: sleep: Allow disabling DPM watchdog by default
Date: Tue, 2 Jun 2026 02:08:55 +0000 [thread overview]
Message-ID: <ah47N8Ng9zfcASmk@google.com> (raw)
In-Reply-To: <CAJZ5v0gc7AtOjWd+cg6tFgzPBovu=wmYmavjaRRjTdNNd8q-0g@mail.gmail.com>
On Mon, Jun 01, 2026 at 08:39:42PM +0200, Rafael J. Wysocki wrote:
> On Thu, May 28, 2026 at 12:32 PM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> > 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);
>
> You might as well use a module parameter to allow this to be set or
> clear at run time. Is there a particular reason why you only want it
> to be enabled or disabled via the kernel command line?
Thanks for the suggestion. Mainly because in our use cases, we only need
to set it once at boot time.
Also, I was wondering if we need to consider potential races if the flag
can be set at runtime. E.g.:
1) The flag is set.
2) dpm_watchdog_set() is called and the timer is started.
3) The flag is then unset.
4) The subsequent dpm_watchdog_clear() isn't stop the timer.
Given this, would you still suggest providing the module parameter for
completeness?
>
> > +
> > /**
> > * 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);
> > }
next prev parent reply other threads:[~2026-06-02 2:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 10:32 [PATCH] PM: sleep: Allow disabling DPM watchdog by default Tzung-Bi Shih
2026-06-01 18:39 ` Rafael J. Wysocki
2026-06-02 2:08 ` Tzung-Bi Shih [this message]
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=ah47N8Ng9zfcASmk@google.com \
--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 \
--cc=tfiga@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.