Received: by 10.223.185.116 with SMTP id b49csp2072254wrg; Mon, 12 Feb 2018 03:56:50 -0800 (PST) X-Google-Smtp-Source: AH8x227kFj8Hfwlulx3Ic2LtL3FPLsl/r4AOTLGA18SCqwv9mB4AsQYguICASvNI3ta/7hr++A89 X-Received: by 10.99.180.3 with SMTP id s3mr9164893pgf.148.1518436610394; Mon, 12 Feb 2018 03:56:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518436610; cv=none; d=google.com; s=arc-20160816; b=VkRMhmlxvpYjwz7mGj4hZGGyNI8mOV0G4WZfLTUWyrTPBCIXuIWAoYuxkFHXHb3Nwc K4dezo5iRSENFSuegIjYmqYpcLAjgMLJTPigpNzh8sieoK3rK/TO8pp+nvIAeS4vsq8C mmZxotpz+C3jKqfF6LEx0qsz5IdhFDz0GT3org9dDzhoeYW84PeLRCwhpEgxt1iGBozz B1eqxXJCemJFxjuN7jx9Nvc6tRMoWpgfMstUka4ZfkJym++hNhWcrY8B1IlLLeSGVx7r tUmFyy8KTQ+FjibmcJ6y8YLOtmu29fjvkbiHc1UVARDKTUdQKKrXCGc6I8JCV/FaWe0+ xmHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=rgWwjg92hVUt7BMK7LPOndcCDK5ANXlWViG+cOi9V9w=; b=OCCzLczwAry1GDqjOMEGNuRWIaQg+fu6fQ5gkMM9wYQW/bIGnNhoECHYjeFCESdqeS 1F1HCGw5Am4krQgym1iOD99Ir0eoEYdITLfYlxSrShq+8Xsk0oxyehxwmJr0fjH+4N4K X8CO1E02koV+ckNRMhso0TihJohxO8fmxxnXwomL1yZA4CGqM8TfEDwokSC9EWw+OFeT 44eCoqS69dziZ8OOl3zuryJElgMZTW0+ynUKUkyYMxO9qI/dc3Bjbb/kw0PrzF5NPz25 58TlPNEVfq2Cmvjkoajj5MDd7xPpqRfeVrrx5yi7YlHdWX40oB50jgDubOIXe6BH84dd XejQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LHX+JFSL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7si5043375pgc.452.2018.02.12.03.56.35; Mon, 12 Feb 2018 03:56:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LHX+JFSL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933070AbeBLJJQ (ORCPT + 99 others); Mon, 12 Feb 2018 04:09:16 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34153 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751456AbeBLJJN (ORCPT ); Mon, 12 Feb 2018 04:09:13 -0500 Received: by mail-lf0-f66.google.com with SMTP id k19so19469725lfj.1; Mon, 12 Feb 2018 01:09:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rgWwjg92hVUt7BMK7LPOndcCDK5ANXlWViG+cOi9V9w=; b=LHX+JFSL777Omz3ByRfd3Y0QR5gVBFpT85o9EHqNkPYSCv73zeFWsItVAlwgJOtxr/ Mw3cLun8GRoM0t4oPbgdqFrtSFxh7mZBBTEukeo6jo6fMw5t1X1y3SSFyg6puCWvLQXk wgfjn/NZ2Fat4BffgWZjBJ7QSFm9oSLmb1HBTtExjeRzND0q8giuBi3E9e7NrDRHToQ0 McfId9G57vNKyqNjO/Ph0TPFRmmk02yHic6EwgAFuAPnopcFPg6MSaQzhur8pKhtKM34 cVamKwQGyHlj+vwDbpMnolblICbrFaMeUU/jXStxWtnjP7BeSmlSJx4T1dE1hApRljho AGXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rgWwjg92hVUt7BMK7LPOndcCDK5ANXlWViG+cOi9V9w=; b=WXHSwYurcW5YI6sdCLlsebsCfGCqmWqJ9bv/dz4fyTHeGXwospKHU9/uBzaQhE5TU7 fskxAOXZhtWBLMhAFIabq0P0zmAoYXO7EwoQCab9G9icoI3cZdvwgMHbPQdlcYz3i+ad yVvoi29aI+eRq3hkVT1CRP41hIY1HNC5X2gVRMWIamqHvhbCgg2axBvsVZJJE3TsWup1 ktZNwseJQ6llE5GpOZDndsymm6uUp//g6QndNkDnt4XRLGrgs34nKKHsYD5aSJXH3sm2 R3sr+E+ksc5dSj9KZE7srcegh7JEmTupuGWKquQa3Ix5CgRTTQqA0C+ny+fuhhFG/w+i SGSw== X-Gm-Message-State: APf1xPDQdx67vBaRgIfO9i0f8nLRufk2M7mx84HCF9FceSswjzQ+rzW/ sojSLcG/v2R9+y46dIzIYcY= X-Received: by 10.25.93.83 with SMTP id p19mr5956569lfj.113.1518426551354; Mon, 12 Feb 2018 01:09:11 -0800 (PST) Received: from gmail.com ([94.234.51.171]) by smtp.gmail.com with ESMTPSA id 7sm925781ljx.39.2018.02.12.01.09.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:09:10 -0800 (PST) Date: Mon, 12 Feb 2018 10:09:06 +0100 From: Marcus Folkesson To: Jerry Hoemann Cc: wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, rwright@hpe.com, maurice.a.saldivar@hpe.com Subject: Re: [PATCH v2 08/11] watchdog/hpwdt: Programable Pretimeout NMI Message-ID: <20180212090906.GB4513@gmail.com> References: <20180212052111.12010-1-jerry.hoemann@hpe.com> <20180212052111.12010-9-jerry.hoemann@hpe.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uQr8t48UFsdbeI+V" Content-Disposition: inline In-Reply-To: <20180212052111.12010-9-jerry.hoemann@hpe.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --uQr8t48UFsdbeI+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jerry, On Sun, Feb 11, 2018 at 10:21:08PM -0700, Jerry Hoemann wrote: > Make whether or not the hpwdt watchdog delivers a pretimeout NMI > programable by the user. >=20 > The underlying iLO hardware is programmable as to whether or not > a pre-timeout NMI is delivered to the system before the iLO resets > the system. However, the iLO does not allow for programming the > length of time that NMI is delivered before the system is reset. >=20 > Hence, in hpwdt_set_pretimeout, val =3D=3D 0 disables the NMI. Any > non-zero value sets the pretimeout length to what the hardware > supports. >=20 > Signed-off-by: Jerry Hoemann > --- > drivers/watchdog/hpwdt.c | 42 ++++++++++++++++++++++++++++++++++++------ > 1 file changed, 36 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c > index 740d0c633204..e7355f72d883 100644 > --- a/drivers/watchdog/hpwdt.c > +++ b/drivers/watchdog/hpwdt.c > @@ -28,12 +28,15 @@ > #define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000) > #define HPWDT_MAX_TIMER TICKS_TO_SECS(65535) > #define DEFAULT_MARGIN 30 > +#define PRETIMEOUT_SEC 9 > =20 > static unsigned int soft_margin =3D DEFAULT_MARGIN; /* in seconds */ > -static unsigned int reload; /* the computed soft_margin */ > static bool nowayout =3D WATCHDOG_NOWAYOUT; > #ifdef CONFIG_HPWDT_NMI_DECODING > static unsigned int allow_kdump =3D 1; > +static bool pretimeout =3D 1; > +#else > +static bool pretimeout; > #endif > =20 > static void __iomem *pci_mem_addr; /* the PCI-memory address */ > @@ -55,10 +58,12 @@ static struct watchdog_device hpwdt_dev; > */ > static int hpwdt_start(struct watchdog_device *dev) > { > - reload =3D SECS_TO_TICKS(dev->timeout); > + int control =3D 0x81 | (pretimeout ? 0x4 : 0); > + int reload =3D SECS_TO_TICKS(dev->timeout); > =20 > + pr_debug("start watchdog 0x%08x:0x%02x\n", reload, control); dev_dbg() Even here, I think we should use=20 dev_emerg() dev_crit() dev_alert() dev_err() dev_warn() dev_notice() instead of pr_* functions now when we have a device to use. > iowrite16(reload, hpwdt_timer_reg); > - iowrite8(0x85, hpwdt_timer_con); > + iowrite8(control, hpwdt_timer_con); > =20 > return 0; > } > @@ -67,6 +72,8 @@ static int hpwdt_stop(struct watchdog_device *dev) > { > unsigned long data; > =20 > + pr_debug("stop watchdog\n"); dev_dbg() > + > data =3D ioread8(hpwdt_timer_con); > data &=3D 0xFE; > iowrite8(data, hpwdt_timer_con); > @@ -75,8 +82,9 @@ static int hpwdt_stop(struct watchdog_device *dev) > =20 > static int hpwdt_ping(struct watchdog_device *dev) > { > - reload =3D SECS_TO_TICKS(dev->timeout); > + int reload =3D SECS_TO_TICKS(dev->timeout); > =20 > + pr_debug("ping watchdog 0x%08x\n", reload); > iowrite16(reload, hpwdt_timer_reg); > =20 > return 0; > @@ -98,6 +106,16 @@ static int hpwdt_settimeout(struct watchdog_device *d= ev, unsigned int val) > } > =20 > #ifdef CONFIG_HPWDT_NMI_DECODING /* { */ > +static int hpwdt_set_pretimeout(struct watchdog_device *dev, unsigned in= t val) > +{ > + if (val && (val !=3D PRETIMEOUT_SEC)) { > + pr_info("Setting pretimeout to %d\n", PRETIMEOUT_SEC); dev_info() > + val =3D PRETIMEOUT_SEC; > + } > + dev->pretimeout =3D val; > + pretimeout =3D val ? 1 : 0; > + return 0; > +} > =20 > static unsigned int hpwdt_my_nmi(void) > { > @@ -108,7 +126,6 @@ static inline int hexdigit(int v) > { > return (v > 9) ? (v-9+'A') : (v+'0'); > } > - > /* > * NMI Handler > */ > @@ -128,6 +145,9 @@ static int hpwdt_pretimeout(unsigned int ulReason, st= ruct pt_regs *regs) > =20 > pr_debug("nmi: ulReason=3D%d, mynmi=3D0x%0x\n", ulReason, mynmi); > =20 > + if (!pretimeout) > + return NMI_DONE; > + > if (allow_kdump) > hpwdt_stop(&hpwdt_dev); > =20 > @@ -144,7 +164,8 @@ static int hpwdt_pretimeout(unsigned int ulReason, st= ruct pt_regs *regs) > static const struct watchdog_info hpwdt_info =3D { > .options =3D WDIOF_SETTIMEOUT | > WDIOF_KEEPALIVEPING | > - WDIOF_MAGICCLOSE, > + WDIOF_MAGICCLOSE | > + WDIOF_PRETIMEOUT, > .identity =3D "HPE iLO2+ HW Watchdog Timer", > }; > =20 > @@ -296,6 +317,9 @@ static const struct watchdog_ops hpwdt_ops =3D { > .ping =3D hpwdt_ping, > .set_timeout =3D hpwdt_settimeout, > .get_timeleft =3D hpwdt_gettimeleft, > +#ifdef CONFIG_HPWDT_NMI_DECODING /* { */ > + .set_pretimeout =3D hpwdt_set_pretimeout, > +#endif /* } */ > }; > =20 > static struct watchdog_device hpwdt_dev =3D { > @@ -304,6 +328,9 @@ static struct watchdog_device hpwdt_dev =3D { > .min_timeout =3D 1, > .max_timeout =3D HPWDT_MAX_TIMER, > .timeout =3D DEFAULT_MARGIN, > +#ifdef CONFIG_HPWDT_NMI_DECODING /* { */ > + .pretimeout =3D PRETIMEOUT_SEC, > +#endif /* } */ > }; > =20 > =20 > @@ -322,6 +349,9 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stoppe= d once started (default=3D" > #ifdef CONFIG_HPWDT_NMI_DECODING /* { */ > module_param(allow_kdump, int, 0444); > MODULE_PARM_DESC(allow_kdump, "Start a kernel dump after NMI occurs"); > + > +module_param(pretimeout, bool, 0444); > +MODULE_PARM_DESC(pretimeout, "Watchdog pretimeout enabled"); > #endif /* } */ > =20 > module_pci_driver(hpwdt_driver); > --=20 > 2.13.6 Best regards Marcus Folkesson >=20 --uQr8t48UFsdbeI+V Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEBVGi6LZstU1kwSxliIBOb1ldUjIFAlqBWawACgkQiIBOb1ld UjIoURAAwhUOe/OqeFlyXbEA1etY5806bo405mJXyszKH/q4XlUrUJgYlHjGhfd9 LAQpOWaxvOJy+H7l6Iv6SeJ6kF8Mm0er44c9NR+ObI/7ZGZvNAtS0SW/VGmKoH+M 2opEoOSCUTGTduXn9YRlECg/Zymco/GtlcgN5ZyKbW5zzYztUXpsW45hvjlgpVWm aS81/FxCa2gGnSfC5LHhALyuRuCCei1RXBfW0BmZwnWfSoxMKicFIrgiuBwKqGoX Pmtv7q/SXWxcy233CUpSCJUaLp+Z8jsNZNUqnSitcQmuy917Xu9CUWI/4Wr8ySda HzXRlATudcyZo12uHRF74DFrn+ZxyZJmIpznwRjgeig8bJnHOcmPVdquAj+4IQfB TuS3h+w2UoYbItXttEBULlNwbdjz7jDj1SuJKI4YZGy094sYKb7+q4fC4eL8etli XT8vku2fYEuETWoF7r1Ehrgtg5JimphlC3EJwQ2HMvtB6eFD6innt26QIfn5PLjO 6DfKrAMuXL7mbE/x0pSuavjPdxolyzMvsPJYcoKiZ7BnHxLL08hTdQ14qAg7zVYR s9nBPsugAXQA6NIKWU9KqTniBP8LnNHXr9DKVN1OMG4+ONBa1AiFy2Cr6GAsww6M I+TwH6MMo0CFmTeMUEOZm6t8H2S58+FNs7yCPCiawMY0IlxphpQ= =f+Z/ -----END PGP SIGNATURE----- --uQr8t48UFsdbeI+V--