[PATCH v3] power: suspend: Move dpm_watchdog to suspend.c and enhance it

From: josephjang
Date: Wed Nov 18 2020 - 01:54:20 EST


On Fri, Nov 13, 2020 at 2:26 PM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Oct 23, 2020 at 02:04:17PM +0800, Joseph Jang wrote:
> > Since dpm_watchdog just cover device power management, we proposed to
> > move it to core power suspend.c to cover not only device power management
> > hang issues, but also core power management hand issues.
> >
> > Since dpm_watchdog stands for device pm, we propose to use new name sleep
> > timer and new timeout handler to cover more sleep hang issues. The new
> > timeout handler will dump disk sleep task at first round timeout and
> > trigger kernel panic at second round timeout.
> > The default timer for each round is defined in
> > CONFIG_PM_SLEEP_TIMER_TIMEOUT.
> >
> > Signed-off-by: Joseph Jang <josephjang@xxxxxxxxxx>
>
> It still seems odd you can't use a watchdog for this, as you really have
> just implemented the same thing here, but "open coded" the logic.
>
> I'll let Rafael chime in here too, as he knows this area much better
> than I as to if this is viable or not.

It is viable AFAICS.

Just make the existing thing work with dev == NULL and use it as needed.

Thank you Greg and Rafael code review and good suggestions.

Since dpm_watchdog just covers two functions __device_suspend() and device_resume().
We still don't know how to use current dpm_watchdog to capture other suspend hang cases
outside these two functions. So we are trying to enhance it by moving dpm_watchdog from
"drivers/base/power/main.c" to "kernel/power/suspend.c" and enable/disable the watchdog
in more core pm functions.
Could you help to review if we can do that or not? If not, could you help to give us
other better suggestions?

If you agree to do that, I will provide a new PATCH version 4 to fix all coding problems
later.


Thank you,
Joseph.