linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <josephjang@google.com>
To: rafael@kernel.org, gregkh@linuxfoundation.org, rjw@rjwysocki.net,
	pavel@ucw.cz, len.brown@intel.com, pmladek@suse.com,
	sergey.senozhatsky@gmail.com, rostedt@goodmis.org
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	jonglin@google.com, woodylin@google.com, markcheng@google.com,
	josephjang@google.com
Subject: [PATCH] power: suspend: Add suspend timeout handler
Date: Fri, 16 Oct 2020 13:33:36 +0000	[thread overview]
Message-ID: <000000000000cfe69e05b1c9cf0e@google.com> (raw)

> >
> > On Fri, Oct 16, 2020 at 3:22 PM <josephjang@google.com> wrote:
> > >
> > > Thank you Rafael's promptly response.
> > >
> > > > On Fri, Oct 16, 2020 at 5:51 AM Joseph Jang <josephjang@google.com>  
> wrote:
> > > > >
> > > > > From: josephjang <josephjang@google.com>
> > > > >
> > > > > Add suspend timeout handler to prevent device stuck during  
> suspend/
> > > > > resume process. Suspend 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 30 seconds.
> > > > >
> > > > > Note: Can use following command to simulate suspend hang for  
> testing.
> > > > >     adb shell echo 1 > /sys/power/pm_hang
> > > > >     adb shell echo mem > /sys/power/state
> > > > > Signed-off-by: josephjang <josephjang@google.com>
> > > > > ---
> > > > >  include/linux/console.h |   1 +
> > > > >  kernel/power/Kconfig    |   9 +++
> > > > >  kernel/power/main.c     |  66 ++++++++++++++++
> > > > >  kernel/power/suspend.c  | 162  
> ++++++++++++++++++++++++++++++++++++++++
> > > > >  kernel/printk/printk.c  |   5 ++
> > > > >  5 files changed, 243 insertions(+)
> > > > >
> > > > > diff --git a/include/linux/console.h b/include/linux/console.h
> > > > > index 0670d3491e0e..ac468c602c0b 100644
> > > > > --- a/include/linux/console.h
> > > > > +++ b/include/linux/console.h
> > > > > @@ -192,6 +192,7 @@ static inline void console_sysfs_notify(void)
> > > > >  { }
> > > > >  #endif
> > > > >  extern bool console_suspend_enabled;
> > > > > +extern int is_console_suspended(void);
> > > > >
> > > > >  /* Suspend and resume console messages over PM events */
> > > > >  extern void suspend_console(void);
> > > > > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> > > > > index a7320f07689d..52b7a181b6d8 100644
> > > > > --- a/kernel/power/Kconfig
> > > > > +++ b/kernel/power/Kconfig
> > > > > @@ -207,6 +207,15 @@ config PM_SLEEP_DEBUG
> > > > >         def_bool y
> > > > >         depends on PM_DEBUG && PM_SLEEP
> > > > >
> > > > > +config PM_SLEEP_MONITOR
> > > > > +       bool "Linux kernel suspend/resume process monitor"
> > > > > +       depends on PM_SLEEP
> > > > > +       help
> > > > > +       This option will enable suspend/resume monitor to prevent  
> device
> > > > > +       stuck during suspend/resume process. Suspend 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 30
> > > > seconds.
> > > > > +
> > >
> > > > The facility associated with the Kconfig entry right below is  
> supposed
> > > > to do exactly the same thing.
> > >
> > > > What's the reason to add another one?  What is missing?
> > >
> > >
> > >
> > > > >  config DPM_WATCHDOG
> > > > >         bool "Device suspend/resume watchdog"
> > > > >         depends on PM_DEBUG && PSTORE && EXPERT
> > >
> > > Because we found some suspend hand issue that cannot be detected by
> > > "CONFIG_DPM_WATCHDOG" (which is focus on device PM).
> >
> > What's that issue?
> >
> > > Our suspend timeout monitor can cover PM core and Device PM hang  
> issues.
> >
> > Then I'd suggest to extend the existing watchdog instead of adding a
> > whole new implementation.


Since kernel/power/suspend.c doesn't need "struct device *dev" like  
following.
Can we create a new suspend_timer to cover PM core and Device PM hang  
issues?

/**
  * dpm_watchdog_set - Enable pm watchdog for given device.
  * @wd: Watchdog. Must be allocated on the stack.
  * @dev: Device to handle.
  */
static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
{
	struct timer_list *timer = &wd->timer;

	wd->dev = dev;
	wd->tsk = current;
...



Thank you,
Joseph.

             reply	other threads:[~2020-10-16 13:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 13:33 josephjang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-10-20  9:01 [PATCH] power: suspend: Add suspend timeout handler josephjang
2020-10-20  9:25 ` Greg KH
2020-10-20  8:15 josephjang
2020-10-20  8:46 ` Greg KH
2020-10-16 13:22 josephjang
2020-10-16 13:24 ` Rafael J. Wysocki
2020-10-16 13:25   ` Joseph Jang
2020-10-16 11:35 josephjang
2020-10-16 11:26 josephjang
2020-10-16  3:51 Joseph Jang
2020-10-16  5:44 ` Greg Kroah-Hartman
     [not found]   ` <CAPaOXERGzo8uF9gh4aAoicEAi_TtHn1M2Yno5LAWQPcWmq_evQ@mail.gmail.com>
2020-10-16  9:03     ` Greg Kroah-Hartman
2020-10-16  9:30     ` Joseph Jang
2020-10-16  9:01 ` Petr Mladek
2020-10-16  9:54   ` Joseph Jang
2020-10-16 13:03   ` Rafael J. Wysocki
2020-10-16 13:07 ` Rafael J. Wysocki

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=000000000000cfe69e05b1c9cf0e@google.com \
    --to=josephjang@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonglin@google.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=markcheng@google.com \
    --cc=pavel@ucw.cz \
    --cc=pmladek@suse.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=woodylin@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).