linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
To: Primoz Fiser <primoz.fiser@norik.com>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Support Opensource <Support.Opensource@diasemi.com>
Cc: Tero Kristo <t-kristo@ti.com>,
	Stefan Riedmueller <s.riedmueller@phytec.de>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>
Subject: RE: [PATCH v2] watchdog: da9062: da9063: prevent pings ahead of machine reset
Date: Thu, 8 Jul 2021 14:15:17 +0000	[thread overview]
Message-ID: <DB9PR10MB4652FCD8EB538492E66BD52880199@DB9PR10MB4652.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20210708082128.2832904-1-primoz.fiser@norik.com>

On 08 July 2021 09:21, Primoz Fiser wrote:

> Proper machine resets via da9062/da9063 PMICs are very tricky as they
> require special i2c atomic transfers when interrupts are not available
> anymore. This is also a reason why both PMIC's restart handlers do not
> use regmap but instead opt for i2c_smbus_write_byte_data() which does
> i2c transfer in atomic manner. Under the hood, this function tries to
> obtain i2c bus lock with call to i2c_adapter_trylock_bus() which will
> return -EAGAIN (-11) if lock is not available.
> 
> Since commit 982bb70517aef ("watchdog: reset last_hw_keepalive time at
> start") occasional restart handler failures with "Failed to shutdown
> (err = -11)" error messages were observed, indicating that some
> process is holding the i2c bus lock. Investigation into the matter
> uncovered that sometimes during reboot sequence watchdog ping is issued
> late into poweroff/reboot phase which did not happen before mentioned
> commit (usually the watchdog ping happened immediately as commit message
> suggests). As of now, when watchdog ping usually happens late into
> poweroff/reboot stage when interrupts are not available anymore, i2c bus
> lock cannot be released anymore and pending restart handler in turn
> fails.
> 
> Thus, to prevent such late watchdog pings from happening ahead of
> pending machine restart and consequently locking up the i2c bus, check
> for system_state in watchdog ping handler and consequently do not send
> pings anymore in case system_state > SYSTEM_RUNNING.
> 
> Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>

Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

      parent reply	other threads:[~2021-07-08 14:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 11:21 [PATCH] watchdog: da9062: da9063: prevent watchdog pings ahead of reboot Primoz Fiser
2021-07-06 13:28 ` Guenter Roeck
2021-07-07  4:39   ` Primoz Fiser
2021-07-08  8:21 ` [PATCH v2] watchdog: da9062: da9063: prevent pings ahead of machine reset Primoz Fiser
2021-07-08 14:00   ` Guenter Roeck
2021-07-08 14:15   ` Adam Thomson [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=DB9PR10MB4652FCD8EB538492E66BD52880199@DB9PR10MB4652.EURPRD10.PROD.OUTLOOK.COM \
    --to=adam.thomson.opensource@diasemi.com \
    --cc=Support.Opensource@diasemi.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=primoz.fiser@norik.com \
    --cc=s.riedmueller@phytec.de \
    --cc=t-kristo@ti.com \
    --cc=wim@linux-watchdog.org \
    --cc=wsa+renesas@sang-engineering.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).