Re: [PATCH] PM: sleep: Allow disabling DPM watchdog by default
From: Tomasz Figa
Date: Tue Jun 02 2026 - 09:04:25 EST
On Tue, Jun 2, 2026 at 7:48 PM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:
>
> On Tue, Jun 02, 2026 at 05:37:13PM +0900, Tomasz Figa wrote:
> > On Tue, Jun 2, 2026 at 11:09 AM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:
> > >
> > > 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@xxxxxxxxxx> 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?
> >
> > Would that lead to anything bad, though? If I'm remembering correctly,
> > would that mean that any already ongoing PM operations would still be
> > subject to the timer, but not any new ones.
>
> I was overthinking the race. All userspace programs should be frozen when
> the DPM watchdog is active. The race I was concerned about isn't possible.
Right. Somehow I was convinced that the DPM watchdog is also used for
runtime PM, but after checking the code it doesn't look like so.
>
> Would you still suggest providing the module parameter for completeness?
I'd also vote for a module parameter. Being able to toggle this at
runtime would be useful for troubleshooting problems without needing
to change the command line arguments (which isn't trivial on some
systems).
>
> >
> > My suggestion would also be to actually make the timeout and warning
> > timeout configurable at runtime.
>
> I'm working on that and I think that should be in a separate patch.
Great, thanks. I'll leave the splitting and other logistics to the maintainers.
Best,
Tomasz