public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jerry Hoemann <jerry.hoemann@hpe.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog/hpwdt: Support Suspend and Resume
Date: Tue, 13 Feb 2024 20:15:35 -0700	[thread overview]
Message-ID: <20240214031535.GH2879@perchik> (raw)
In-Reply-To: <7b70a8e7-10ce-4835-891c-b854919fa3cb@roeck-us.net>

On Tue, Feb 13, 2024 at 08:12:57AM -0800, Guenter Roeck wrote:
> On Tue, Feb 13, 2024 at 12:02:03AM -0700, Jerry Hoemann wrote:
> > Add call backs to support suspend and resume.
> > 
> 
> That makes me wonder if we should add something like
> 	watchdog_stop_on_suspend()
> to the watchdog core. Almost every watchdog driver supporting
> suspend/resume repeats the same sequence (except for the debug
> message). That is a separate question, though.

I think that is a good idea.

> 
> > Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
> > ---
> >  drivers/watchdog/hpwdt.c | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> > 
> > diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
> > index 138dc8d8ca3d..6565cfaa8e57 100644
> > --- a/drivers/watchdog/hpwdt.c
> > +++ b/drivers/watchdog/hpwdt.c
> > @@ -378,11 +378,38 @@ static void hpwdt_exit(struct pci_dev *dev)
> >  	pci_disable_device(dev);
> >  }
> >  
> > +static int hpwdt_suspend(struct device *dev)
> > +{
> > +	dev_dbg(dev, "Suspend watchdog\n");
> > +
> 
> Doesn't the suspend / resume code already display such debug messages ?

It displays some.  I mostly was using to make sure that the
callback was being called.  I can drop it.


> 
> > +	if (watchdog_active(&hpwdt_dev))
> > +		hpwdt_stop();
> > +
> > +	return 0;
> > +}
> > +
> > +static int hpwdt_resume(struct device *dev)
> > +{
> > +	dev_dbg(dev, "Resume watchdog\n");
> > +
> > +	if (watchdog_active(&hpwdt_dev))
> > +		hpwdt_start(&hpwdt_dev);
> > +
> > +	return 0;
> > +}
> > +
> > +static DEFINE_SIMPLE_DEV_PM_OPS(hpwdt_pm_ops, hpwdt_suspend, hpwdt_resume);
> 
> That disables / enables the watchdog as part of regular suspend/resume
> handling, meaning any hang during suspend/resume that happens later will
> hang the system. Sure you don't want to use SET_LATE_SYSTEM_SLEEP_PM_OPS()
> instead ?
> 
> Never mind, though. Your call, obviously.

Your suggestion would be an improvement.
Will change in version 2 of patch.


Thanks for the help.


> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 
> Thanks,
> Guenter

-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------

      reply	other threads:[~2024-02-14  3:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  7:02 [PATCH] watchdog/hpwdt: Support Suspend and Resume Jerry Hoemann
2024-02-13 16:12 ` Guenter Roeck
2024-02-14  3:15   ` Jerry Hoemann [this message]

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=20240214031535.GH2879@perchik \
    --to=jerry.hoemann@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wim@linux-watchdog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox