From: Guenter Roeck <linux@roeck-us.net>
To: Jerry Hoemann <jerry.hoemann@hpe.com>
Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org,
linux-kernel@vger.kernel.org, mironov.ivan@gmail.com,
rasmus.villemoes@prevas.dk
Subject: Re: [PATCH 4/6] watchdog/hpwdt: Add module parameter kdumptimeout.
Date: Thu, 6 Jun 2019 14:19:25 -0700 [thread overview]
Message-ID: <20190606211925.GC1299@roeck-us.net> (raw)
In-Reply-To: <1558126783-4877-5-git-send-email-jerry.hoemann@hpe.com>
On Fri, May 17, 2019 at 02:59:41PM -0600, Jerry Hoemann wrote:
> Instead of unconditionally stopping the watchdog timer after receipt of
> a pretimeout NMI, reprogram the timeout based upon module parameter
> kdumptimeout.
>
> The provides a more flexible override than the depricated allow_kdump.
>
> Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/hpwdt.c | 27 ++++++++++++++++++++++++---
> 1 file changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
> index aa4101c..dc65006 100644
> --- a/drivers/watchdog/hpwdt.c
> +++ b/drivers/watchdog/hpwdt.c
> @@ -29,7 +29,8 @@
> #define HPWDT_VERSION "2.0.2"
> #define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
> #define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000)
> -#define HPWDT_MAX_TIMER TICKS_TO_SECS(65535)
> +#define HPWDT_MAX_TICKS 65535
> +#define HPWDT_MAX_TIMER TICKS_TO_SECS(HPWDT_MAX_TICKS)
> #define DEFAULT_MARGIN 30
> #define PRETIMEOUT_SEC 9
>
> @@ -37,6 +38,7 @@
> static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
> static bool nowayout = WATCHDOG_NOWAYOUT;
> static bool pretimeout = IS_ENABLED(CONFIG_HPWDT_NMI_DECODING);
> +static int kdumptimeout = -1;
>
> static void __iomem *pci_mem_addr; /* the PCI-memory address */
> static unsigned long __iomem *hpwdt_nmistat;
> @@ -56,6 +58,7 @@
> {0}, /* terminate list */
> };
>
> +static struct watchdog_device hpwdt_dev;
> /*
> * Watchdog operations
> */
> @@ -94,12 +97,18 @@ static int hpwdt_stop_core(struct watchdog_device *wdd)
> return 0;
> }
>
> +static void hpwdt_ping_ticks(int val)
> +{
> + val = min(val, HPWDT_MAX_TICKS);
> + iowrite16(val, hpwdt_timer_reg);
> +}
> +
> static int hpwdt_ping(struct watchdog_device *wdd)
> {
> int reload = SECS_TO_TICKS(min(wdd->timeout, wdd->max_hw_heartbeat_ms/1000));
>
> dev_dbg(wdd->parent, "ping watchdog 0x%08x:0x%08x\n", wdd->timeout, reload);
> - iowrite16(reload, hpwdt_timer_reg);
> + hpwdt_ping_ticks(reload);
>
> return 0;
> }
> @@ -175,7 +184,14 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
> if (ilo5 && !pretimeout && !mynmi)
> return NMI_DONE;
>
> - hpwdt_stop();
> + if (kdumptimeout < 0)
> + hpwdt_stop();
> + else if (kdumptimeout == 0)
> + ;
> + else {
> + unsigned int val = max((unsigned int)kdumptimeout, hpwdt_dev.timeout);
> + hpwdt_ping_ticks(SECS_TO_TICKS(val));
> + }
>
> hex_byte_pack(panic_msg, mynmi);
> nmi_panic(regs, panic_msg);
> @@ -328,6 +344,7 @@ static int hpwdt_init_one(struct pci_dev *dev,
> pretimeout = 0;
> }
> hpwdt_dev.pretimeout = pretimeout ? PRETIMEOUT_SEC : 0;
> + kdumptimeout = min(kdumptimeout, HPWDT_MAX_TIMER);
>
> hpwdt_dev.parent = &dev->dev;
> retval = watchdog_register_device(&hpwdt_dev);
> @@ -342,6 +359,7 @@ static int hpwdt_init_one(struct pci_dev *dev,
> hpwdt_dev.timeout, nowayout);
> dev_info(&dev->dev, "pretimeout: %s.\n",
> pretimeout ? "on" : "off");
> + dev_info(&dev->dev, "kdumptimeout: %d.\n", kdumptimeout);
>
> if (dev->subsystem_vendor == PCI_VENDOR_ID_HP_3PAR)
> ilo5 = true;
> @@ -387,6 +405,9 @@ static void hpwdt_exit(struct pci_dev *dev)
> MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
> __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>
> +module_param(kdumptimeout, int, 0444);
> +MODULE_PARM_DESC(kdumptimeout, "Timeout applied for crash kernel transition in seconds");
> +
> #ifdef CONFIG_HPWDT_NMI_DECODING
> module_param(pretimeout, bool, 0);
> MODULE_PARM_DESC(pretimeout, "Watchdog pretimeout enabled");
next prev parent reply other threads:[~2019-06-06 21:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 20:59 [PATCH 0/6] watchdog/hpwdt: cleanups and kdump accommodations Jerry Hoemann
2019-05-17 20:59 ` [PATCH 1/6] watchdog/hpwdt: Stop hpwdt on unregister Jerry Hoemann
2019-06-06 21:14 ` Guenter Roeck
2019-05-17 20:59 ` [PATCH 2/6] watchdog/hpwdt: Advertize max_hw_heartbeat_ms Jerry Hoemann
2019-06-06 21:17 ` Guenter Roeck
2019-05-17 20:59 ` [PATCH 3/6] watchdog/hpwdt: Have core ping watchdog Jerry Hoemann
2019-06-06 21:18 ` Guenter Roeck
2019-05-17 20:59 ` [PATCH 4/6] watchdog/hpwdt: Add module parameter kdumptimeout Jerry Hoemann
2019-06-06 21:19 ` Guenter Roeck [this message]
2019-05-17 20:59 ` [PATCH 5/6] watchdog/hpwdt: Update documentation Jerry Hoemann
2019-06-06 21:19 ` Guenter Roeck
2019-05-17 20:59 ` [PATCH 6/6] watchdog/hpwdt: Reflect changes Jerry Hoemann
2019-06-06 21:20 ` Guenter Roeck
2019-06-05 22:31 ` [PATCH 0/6] watchdog/hpwdt: cleanups and kdump accommodations Jerry Hoemann
2019-06-05 22:51 ` 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=20190606211925.GC1299@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jerry.hoemann@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=mironov.ivan@gmail.com \
--cc=rasmus.villemoes@prevas.dk \
--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