From: Jerry Hoemann <jerry.hoemann@hpe.com>
To: Vladimir Panteleev <git@vladimir.panteleev.md>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] watchdog: sp5100_tco: Add "action" module parameter
Date: Thu, 22 Sep 2022 11:51:11 -0600 [thread overview]
Message-ID: <20220922175110.GC960@perchik> (raw)
In-Reply-To: <20220920092721.7686-1-git@vladimir.panteleev.md>
On Tue, Sep 20, 2022 at 09:27:21AM +0000, Vladimir Panteleev wrote:
> Allow configuring the "action" bit, as documented in [1].
>
> Previously, the only action supported by this module was to reset the
> system (0). It can now be configured to power off (1) instead.
>
> [1]: https://www.amd.com/system/files/TechDocs/44413.pdf
>
> Signed-off-by: Vladimir Panteleev <git@vladimir.panteleev.md>
> ---
>
> Changes since v1:
> - Drop the rename of the SP5100_WDT_ACTION_RESET define
> - Make the new parameter not visible in sysfs for consistency
>
> drivers/watchdog/sp5100_tco.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c
> index ae54dd33e233..fb426b7d81da 100644
> --- a/drivers/watchdog/sp5100_tco.c
> +++ b/drivers/watchdog/sp5100_tco.c
> @@ -65,6 +65,12 @@ static struct pci_dev *sp5100_tco_pci;
>
> /* module parameters */
>
> +#define WATCHDOG_ACTION 0
> +static bool action = WATCHDOG_ACTION;
> +module_param(action, bool, 0);
> +MODULE_PARM_DESC(action, "Action taken when watchdog expires, 0 to reset, 1 to poweroff (default="
> + __MODULE_STRING(WATCHDOG_ACTION) ")");
> +
> #define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat. */
> static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */
> module_param(heartbeat, int, 0);
> @@ -297,8 +303,11 @@ static int sp5100_tco_timer_init(struct sp5100_tco *tco)
> if (val & SP5100_WDT_FIRED)
> wdd->bootstatus = WDIOF_CARDRESET;
>
> - /* Set watchdog action to reset the system */
> - val &= ~SP5100_WDT_ACTION_RESET;
> + /* Set watchdog action */
> + if (action)
> + val |= SP5100_WDT_ACTION_RESET;
> + else
> + val &= ~SP5100_WDT_ACTION_RESET;
> writel(val, SP5100_WDT_CONTROL(tco->tcobase));
>
> /* Set a reasonable heartbeat before we stop the timer */
> --
> 2.37.3
Looking at other WDT, I see at least three that have an "action"
parameter. These appear to have inconsistent semantics with each
other and this patch.
Is there something we could to create more uniformity with module
level parameters like these?
Examples:
machzwd.c:
MODULE_PARM_DESC(action, "after watchdog resets, generate: "
"0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI");
pseries-wdt.c
static const unsigned long pseries_wdt_action[] = {
[0] = PSERIES_WDTF_ACTION_HARD_POWEROFF,
[1] = PSERIES_WDTF_ACTION_HARD_RESTART,
[2] = PSERIES_WDTF_ACTION_DUMP_RESTART,
sbsa_gwdt.c
MODULE_PARM_DESC(action, "after watchdog gets WS0 interrupt, do: "
"0 = skip(*) 1 = panic");
--
-----------------------------------------------------------------------------
Jerry Hoemann Software Engineer Hewlett Packard Enterprise
-----------------------------------------------------------------------------
next prev parent reply other threads:[~2022-09-22 17:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 9:27 [PATCH v2] watchdog: sp5100_tco: Add "action" module parameter Vladimir Panteleev
2022-09-22 17:36 ` rwright
2022-09-22 17:43 ` Guenter Roeck
2022-09-22 17:51 ` Jerry Hoemann [this message]
2022-09-25 19:54 ` Guenter Roeck
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=20220922175110.GC960@perchik \
--to=jerry.hoemann@hpe.com \
--cc=git@vladimir.panteleev.md \
--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