All of lore.kernel.org
 help / color / mirror / Atom feed
From: <josephjang@google.com>
To: gregkh@linuxfoundation.org, rafael@kernel.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: Tue, 20 Oct 2020 09:01:05 +0000	[thread overview]
Message-ID: <0000000000008d35ba05b216782a@google.com> (raw)

> On Tue, Oct 20, 2020 at 08:15:38AM +0000, josephjang@google.com wrote:
> > > On Tue, Oct 20, 2020 at 02:22:26PM +0800, Joseph Jang wrote:
> > > > Add sleep timer and timeout handler to prevent device stuck during
> > > suspend/
> > > > resume process. The 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@google.com>
> > > > ---
> > > >  MAINTAINERS                   |  2 +
> > > >  include/linux/console.h       |  1 +
> > > >  include/linux/suspend_timer.h | 90  
> +++++++++++++++++++++++++++++++++++
> >
> > > Why is this file in include/linux/ if you only ever call it from  
> one .c
> > > file?
> >
> > I just refer to include/linux/suspend.h and create a new header file in  
> the
> > same folder.
> > If you have a better location for the new header file, please feel free  
> to
> > let me know.

> Only put .h files that are needed by different .c files in the
> include/linux/ directory.  Otherwise it should be local to where the .c
> file is.
> Great, use that!

> > But we really hit the suspend hang issue that DPM_WATCHDOG cannot cover.

> What issue is that?

> > We propose a wide coverage debug feature like PM_SLEEP_MONITOR which
> > not only covers PM but also core PM hang issues.
> >
> > And DPM_WATCHDOG is for device driver power management in
> > drivers/base/power/main.c
> > and PM_SLEEP_MONITOR locate is for core power management in
> > kernel/power/suspend.c.
> > I think it is fine for users to select whether they need device PM only  
> or
> > not.

> How will a user know which they should use?

> Why not just fix whatever is wrong with the watchdog code instead of
> creating a new one?

> > > And why isn't the watchdog sufficient for you?  Why are you "open
> > > coding" a watchdog timer logic here at all???
> >
> > Yes, we refer to DPM_WATCHDOG to extend the watchdog debugging for core  
> PM.
> > Because we really hit a real case that was not covered by DPM_WATCHDOG.

> Then fix that!

> > I think PM_SLEEP_MONITOR is an extension debug feature from  
> DPM_WATCHDOG.

> Please just fix the watchdog, as obviously it is not working properly.
> Don't create something new because of that.

> thanks,

> greg k-h

Thank you Greq for promptly responding.
I am okay to fix the DPM_WATCHDOG feature, but would like to have quick  
sync up before start.
Could you help?


1. Can we change the kernel config name ?
DPM_WATCHDOG stands for Device Power Management.
We propose PM_SLEEP_MONITOR is to cover Core PM and Device PM.


2. Can we create a new data structure instead of using the following struct  
dpm_watchdog?
struct dpm_watchdog {
	struct device		*dev;
	struct task_struct	*tsk;
	struct timer_list	timer;
};

I list some reasons by following ...

static int device_resume(struct device *dev, pm_message_t state, bool async)
{
	pm_callback_t callback = NULL;
	const char *info = NULL;
	int error = 0;
	DECLARE_DPM_WATCHDOG_ON_STACK(wd);  <== dpm_watchdog use stack memory for  
watchdog timer struct, but sleep timer use global memory.

...<SNIP>

	if (!dpm_wait_for_superior(dev, async))
		goto Complete;

	dpm_watchdog_set(&wd, dev);  <== dpm_watchdog need "struct device", but  
sleep timer doesn't need it.
	device_lock(dev);

...<SNIP>

  Unlock:
	device_unlock(dev);
	dpm_watchdog_clear(&wd);

  Complete:
	complete_all(&dev->power.completion);

	TRACE_RESUME(error);

	return error;
}

Thank you,
Joseph.

             reply	other threads:[~2020-10-20  9:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  9:01 josephjang [this message]
2020-10-20  9:25 ` [PATCH] power: suspend: Add suspend timeout handler Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2020-10-20  8:15 josephjang
2020-10-20  8:46 ` Greg KH
2020-10-16 13:33 josephjang
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=0000000000008d35ba05b216782a@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 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.