Received: by 10.223.185.116 with SMTP id b49csp3917827wrg; Tue, 13 Feb 2018 09:43:04 -0800 (PST) X-Google-Smtp-Source: AH8x225ZkvKOxO+6Xn4Bp378iYe5WC/lCJRFoF9bVcgIC6OxV2VeBATsEa/7OIaPmPh6EiR9LS0y X-Received: by 10.99.110.205 with SMTP id j196mr1594654pgc.54.1518543784533; Tue, 13 Feb 2018 09:43:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518543784; cv=none; d=google.com; s=arc-20160816; b=wpYzfphQhjBV3LNqzhH0obwRJ5WOt6eFZJoslwWH6sXDvYJGPiah56PN/ZTzG9TCIE o9pVbBvxl0jIwIj7UO3kj9jJRh+209bUVFkgwZ0AQAG9W0B1RiksDMJcOh7XpJH/0o5E dh/bayehJA+P3J423MP5vdh2fYo8iEVMZ7eNWgRLZQwsQU6kQgqsF4J4PSGmNZcYM84M k1C/7Xy5tMluRWfh+5rwlYxZQzX9a2lwJhjqpEMZgkvY7gj13vvu/RNbXt1PfIJbpc82 UGGjpExBS0+mOgiBK2P61mUIbx5xJkjtzM3pyR6Q3xm/RyfxZSMB/iTWUZB8g7RoV2Yk DRQg== 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=R5Bdf2a6Lmt9/bxWQ2W6blxW8pyiRsAYbnLvjKH0KKE=; b=sSrJDSQORQaFUBRR+jEdlydHnk8JmZChQ5j3z6PCJqroAb7kpuVMCEI96d4OHESXVV Y6wcKXZ3xo4wUvaGAC9t8zBIJLDw0hYO0slMp/upNVU2eFZQ16Gd1Ki3bvk/j+ixMNUI VIlgR1FqQ0X7sHbJpumKa4cqRQN+/tYn8OF9DRf7JvtFBi+RpfecOfg+VIBJg8Oi9Mo6 YnGZoTQd9IKvWmebf5J+6gXdNGtHneOQUfsPUZ5miGJ/nQ+APe7NfwTBwoWxz5ZMujFo SFRR6QIog9CcbUjyeHrjcD3P6vXIiw5deDu3bUXv91SPtXgOBg0S57aM5/ga6dOmAdA2 Hmfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=bG3cTLT0; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r84si1769750pfi.156.2018.02.13.09.42.49; Tue, 13 Feb 2018 09:43:04 -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=fail header.i=@gmail.com header.s=20161025 header.b=bG3cTLT0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965343AbeBMRlj (ORCPT + 99 others); Tue, 13 Feb 2018 12:41:39 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:41128 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965023AbeBMRlh (ORCPT ); Tue, 13 Feb 2018 12:41:37 -0500 Received: by mail-pg0-f66.google.com with SMTP id t4so340713pgp.8; Tue, 13 Feb 2018 09:41:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=R5Bdf2a6Lmt9/bxWQ2W6blxW8pyiRsAYbnLvjKH0KKE=; b=bG3cTLT0XHGBD7z0iDptLarN1sY4RLRkNXN2D+k769+YMllIMepKsGSGQkfVT0aH1L IFdlIC4+CxTlaUmYEg4KxusPWIieTGpa/ISyF7B6gTdrpYwOdxoJkd2nHuUR8IQj+XEn 1p5weE83ZgQQIR3JuKrDv7SDkBetAxTrQujgyQ2EeZTfmzwu8y42zxXb+MU4hKRfoKog hrn8jARcXOUxeAwXLvj7/3xVj60kLans3iy2FNRfHmLsiiRNZYEONlvpgrOgm8R3gZcb lXHpojJZ1GCzVNDCSF9+fujKxqbLn+tXL62gle+jqjGum5lGgaQSOJXcGQ73ExlIrjTV GlOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=R5Bdf2a6Lmt9/bxWQ2W6blxW8pyiRsAYbnLvjKH0KKE=; b=Dn/RFD+f75cN6lW1qCXkHfApO7TM64EwZpw8CmsQvc+plwSAnleBXJev9HjOgPHFqx hckLKftPY/Kweiz+QhObST8spQjFlAN8Q9hkfVTrRTmqJJ4hJ/EIzYXDIBbmGE/q01Kl eDBGXu9/4OHH9CxS9Oz9lB6qWENGVUhk3f4xOcjkdsoyUfNjc0TgFdTqfX96ZST0Y055 rQV8b2Cz08BIBMWzCp9ptbiatdCd+c1G+nfJsUtwBwjX7QrRfjdvIsIPDhGTEn0ThuH2 6/UAbJPAp+Z8s2RTZ+QU3dW5Mp6Vq7JPtKRtQXnw0vB2UW27Ns9qP+Bo3Gvw5uyxqbsS kv0Q== X-Gm-Message-State: APf1xPBRZh4xOT7Ew9ZjxR89KKIG5jGggrcbS1U/70IZ6UVTsgvw579l TihlmJM78Dh5KDXGvQbBAD0= X-Received: by 10.98.212.6 with SMTP id a6mr2023020pfh.104.1518543697213; Tue, 13 Feb 2018 09:41:37 -0800 (PST) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id b6sm31195406pfe.85.2018.02.13.09.41.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 09:41:36 -0800 (PST) Date: Tue, 13 Feb 2018 09:41:35 -0800 From: Guenter Roeck To: Jerry Hoemann Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, rwright@hpe.com, maurice.a.saldivar@hpe.com Subject: Re: [PATCH v2 03/11] watchdog/hpwdt: Update nmi_panic message. Message-ID: <20180213174135.GA22401@roeck-us.net> References: <20180212052111.12010-1-jerry.hoemann@hpe.com> <20180212052111.12010-4-jerry.hoemann@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180212052111.12010-4-jerry.hoemann@hpe.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 11, 2018 at 10:21:03PM -0700, Jerry Hoemann wrote: > Include the nmistat in the nmi_panic message to give support > an indication why the NMI was called (e.g. a timeout or generate > nmi button.) > > Signed-off-by: Jerry Hoemann > --- > drivers/watchdog/hpwdt.c | 27 +++++++++++++++++++-------- > 1 file changed, 19 insertions(+), 8 deletions(-) > > diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c > index 20a13c5d0285..6f7949ef9a23 100644 > --- a/drivers/watchdog/hpwdt.c > +++ b/drivers/watchdog/hpwdt.c > @@ -108,24 +108,35 @@ static int hpwdt_my_nmi(void) > return ioread8(hpwdt_nmistat) & 0x6; > } > > +static inline int hexdigit(int v) > +{ > + return (v > 9) ? (v-9+'A') : (v+'0'); > +} > + > /* > * NMI Handler > */ > static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs) > { > - if ((ulReason == NMI_UNKNOWN) && !hpwdt_my_nmi()) > + unsigned int mynmi = hpwdt_my_nmi(); > + static char panic_msg[] = > + "00: An NMI occurred. Depending on your system the reason " > + "for the NMI is logged in any one of the following resources:\n" > + "1. Integrated Management Log (IML)\n" > + "2. OA Syslog\n" > + "3. OA Forward Progress Log\n" > + "4. iLO Event Log"; > + > + if ((ulReason == NMI_UNKNOWN) && !mynmi) > return NMI_DONE; > > if (allow_kdump) > hpwdt_stop(); > > - nmi_panic(regs, "An NMI occurred. Depending on your system the reason " > - "for the NMI is logged in any one of the following " > - "resources:\n" > - "1. Integrated Management Log (IML)\n" > - "2. OA Syslog\n" > - "3. OA Forward Progress Log\n" > - "4. iLO Event Log"); > + panic_msg[0] = hexdigit((mynmi>>4)&0xf); > + panic_msg[1] = hexdigit(mynmi&0xf); No need to reinvent the wheel. panic_msg[0] = hex_asc_hi(mynmi); panic_msg[1] = hex_asc_lo(mynmi); or even better hex_byte_pack(panic_msg, mynmi); There are matching _upper functions if you prefer A..F instead of a..f. Guenter