Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1100625imu; Wed, 16 Jan 2019 12:45:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN5tT9BGAkdvTspuzLF2TKUkXctq2HRkovJEbCTQRnhPYcify2+wn/OuXaCBJhjufveNonUS X-Received: by 2002:a62:83ce:: with SMTP id h197mr11737063pfe.187.1547671550372; Wed, 16 Jan 2019 12:45:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547671550; cv=none; d=google.com; s=arc-20160816; b=aQJq6IRaIivw8/VpgMCJtVGwchLpBFc5fZjmBDfw5WhMvzDqNBslGcqKMwkmsfs85Z 9kmtGU8Xsc88XIMHE95AcdebMLf6F/y0l7b4A1IXclMEfZnV+XtUKS+S/OW0GA4O5X3G tLtCMWhZXCE3v4oRGdqLSpPHoyd05lyqNJAZxchQZM+mHUd6ceYyyInYFEBKzzJZVyom wXsA3pnrPykNEkL8bFgKP9ExXn3CbYQbL1ssYzo8LM+1T+SUh29xiNMdoZonOfJYDZ7M 0VN/6xyHA6nzDKBjrsFKyWJJRnhJi4CGkj5EoZ/x96vBYwM5gl3YJoMa5++KPYWO3xWu X/TA== 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:reply-to:message-id :subject:cc:to:from:date; bh=UMECGFrfbk29jY+BvDnySbTL3QbvTn8QE601hE7qSJs=; b=Gh8hyY3ZRURzt+y2ZxyMsxl1a2EbZjYMh1MfAYaUT9MhCLwXujjjtdCADuMlpF1s78 ASk0VoE2mMK/UpeAvGvGlPoM7UCAm9V1xlWTnzSGDcPcV79Li3jEaCXyB8lxki1a++3T b4Ghd8x4Dhzjr4qMGo3LDXXl16aGKY641OzXlY5MbsaxvT2SJjLW9/clF9eMWGu3ReeN CRHGOcT3sUh01zQHiAxhLJywzk1YHlGzQifNX50kN6xxKJ5AQfyL9N/KV50/DR029/3Z NFxUS2gyYJ1cccCev12LkgchdnU44KMvddzTj7KQcDhf6H/thyatkv1xY34T1+TY3CJ+ migA== ARC-Authentication-Results: i=1; mx.google.com; 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 f65si6552684pfb.194.2019.01.16.12.45.31; Wed, 16 Jan 2019 12:45: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; 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 S1731471AbfAPDil (ORCPT + 99 others); Tue, 15 Jan 2019 22:38:41 -0500 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]:56960 "EHLO mx0a-002e3701.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730481AbfAPDil (ORCPT ); Tue, 15 Jan 2019 22:38:41 -0500 X-Greylist: delayed 4074 seconds by postgrey-1.27 at vger.kernel.org; Tue, 15 Jan 2019 22:38:40 EST Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0G2QA3P029498; Wed, 16 Jan 2019 02:30:25 GMT Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) by mx0a-002e3701.pphosted.com with ESMTP id 2q1qvj9dn5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Jan 2019 02:30:25 +0000 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3427.houston.hpe.com (Postfix) with ESMTP id 9DD0957; Wed, 16 Jan 2019 02:30:23 +0000 (UTC) Received: from anatevka (anatevka.americas.hpqcorp.net [10.34.81.61]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id CCBF458; Wed, 16 Jan 2019 02:30:22 +0000 (UTC) Date: Tue, 15 Jan 2019 19:30:22 -0700 From: Jerry Hoemann To: Ivan Mironov Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Wim Van Sebroeck , Guenter Roeck Subject: Re: [RFC PATCH 4/4] watchdog: hpwdt: Make panic behaviour configurable Message-ID: <20190116023022.GE18342@anatevka> Reply-To: Jerry.Hoemann@hpe.com References: <20190114023617.10656-1-mironov.ivan@gmail.com> <20190114023617.10656-5-mironov.ivan@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190114023617.10656-5-mironov.ivan@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-16_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901160016 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 14, 2019 at 07:36:17AM +0500, Ivan Mironov wrote: > This adds an option to not panic on NMI even if it was caused by iLO. > > Signed-off-by: Ivan Mironov > --- > drivers/watchdog/hpwdt.c | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c > index 95d002b5b120..b12858491189 100644 > --- a/drivers/watchdog/hpwdt.c > +++ b/drivers/watchdog/hpwdt.c > @@ -37,6 +37,10 @@ static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */ > static bool nowayout = WATCHDOG_NOWAYOUT; > static bool pretimeout = IS_ENABLED(CONFIG_HPWDT_NMI_DECODING); > > +#ifdef CONFIG_HPWDT_NMI_DECODING > +static bool panic_on_nmi = true; > +#endif /* CONFIG_HPWDT_NMI_DECODING */ > + > static void __iomem *pci_mem_addr; /* the PCI-memory address */ > static unsigned long __iomem *hpwdt_nmistat; > static unsigned long __iomem *hpwdt_timer_reg; > @@ -146,7 +150,10 @@ static int hpwdt_set_pretimeout(struct watchdog_device *wdd, unsigned int req) > > static int hpwdt_my_nmi(void) > { > - return ioread8(hpwdt_nmistat) & 0x6; > + int nmistat = ioread8(hpwdt_nmistat); > + > + iowrite8(nmistat & ~0x6, hpwdt_nmistat); > + return nmistat & 0x6; This is a read only register. > } > > /* > @@ -168,7 +175,10 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs) > "4. iLO Event Log\n", > mynmi, ulReason, smp_processor_id()); > > - nmi_panic(regs, "hpwdt: NMI: Not continuing"); > + if (panic_on_nmi) > + nmi_panic(regs, "hpwdt: NMI: Not continuing"); > + > + pr_emerg("Dazed and confused, but trying to continue\n"); > The watchdog core provides a way to enable/disable the NMI pretimeout dynamically via ioctl. The pretimeout NMI can also be disabled via module parameter to hpwdt. This adds complexity without really adding functionality. BTW, don't reuse error messages. Makes it difficult to tell where the error originated from. > return NMI_HANDLED; > } > @@ -376,6 +386,9 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" > #ifdef CONFIG_HPWDT_NMI_DECODING > module_param(pretimeout, bool, 0); > MODULE_PARM_DESC(pretimeout, "Watchdog pretimeout enabled"); > -#endif > + > +module_param(panic_on_nmi, bool, 0); > +MODULE_PARM_DESC(panic_on_nmi, "Cause panic on NMI induced by iLO (default=1)"); > +#endif /* CONFIG_HPWDT_NMI_DECODING */ > > module_pci_driver(hpwdt_driver); > -- > 2.20.1 -- ----------------------------------------------------------------------------- Jerry Hoemann Software Engineer Hewlett Packard Enterprise -----------------------------------------------------------------------------