Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp31481rwb; Fri, 19 Aug 2022 16:12:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5DdCCcue3m/dR+O7wfr/QxCzmkh+vi7JtTSOPKw0pt9n8n2IyvOU5Hhz8ImqGqHnbtfqT+ X-Received: by 2002:aa7:c554:0:b0:445:fa29:b11a with SMTP id s20-20020aa7c554000000b00445fa29b11amr7431739edr.168.1660950753613; Fri, 19 Aug 2022 16:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660950753; cv=none; d=google.com; s=arc-20160816; b=Qv5XOJmLkuRhljXIrQb8nzaMoiT78vOsE4+H+HzLU32Gg56g9OwxmlWZtU8j4EUA6s R+ikVrI14ta3GeHH3tMsopxi2zskVhMJglyftAH+pZpV4ac7t2pKBW3lc9sWvGAiY+zG vfLyh8sCQhvJgd+JNSsu01LNovK6yxxOX+6uegdHBdcmKRkSz4/e+e5g2eoGFx3vbBqF 2C+sBjZ53cc34b1eE5R+8R7yVsitMQ9cbELf0JT+c8+igYwsu2wHWzi35MsgBSipBtJf nV+1DVds6MdUBHSr7guM4rSMWlmE9etdLFjsKZ6HJ17c0SZkAHIlnR3c0JE1bO4Ko82r EliQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OonmUPZkO/emCOphZ8VnLPwYmag4wEjaMQk7IMB+RMQ=; b=zC9u6hDSb6gqtcNr0ibOCUqd67p9rPjDEGci+qfZe+5O1UJAOcrYl8b5fDeObyWDm3 ga0N3EID1CcRy+sGQzGW0iNy2J2ufvOXC/EPYzdbutobvjze+ULrtvYbtUmaHa4hrE6o DL2yzo5nz1640QtTnbTQH9ATUikXL1G0AmocPXm7OlLWA3haMg0o4VFJTFA1PSBw0iUI 4ZHbGNSO+olLK1XftDaocrSPgm+7go6HzNm0EUa4xJ7X9LUTz6VC84PIRygZbsi15d6X IhckHLimCZhuNL3FGN1kXZ3RsLUC1XrEFT7IC5/P6t9pyZv8gxZu3bUqCpYrMmHEHiL3 kYRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=frivb87m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020a1709067fce00b00738a50268d3si3440236ejs.417.2022.08.19.16.12.06; Fri, 19 Aug 2022 16:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=frivb87m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233485AbiHSWYC (ORCPT + 99 others); Fri, 19 Aug 2022 18:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241975AbiHSWXy (ORCPT ); Fri, 19 Aug 2022 18:23:54 -0400 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76D9B23BD1; Fri, 19 Aug 2022 15:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=OonmUPZkO/emCOphZ8VnLPwYmag4wEjaMQk7IMB+RMQ=; b=frivb87m1aODDLexRXHjILEpy0 zypuxM1lUa2+Sde0ChP8r+SpXKZTYYQ06rsm4azbLcf835GhtiU/63eTRWcbzZyjLucvdKKHJYKiK /euCL6+qpMh2bq+mDBCmd4zfYMRfG4Tqf1qA8tyF9Sf9mTKWE49sFBT6zlM+mWR7kHQzFnNnWU6MW lkll9FniO4rDprJKDPgb+tUp2okPeMrFiVLU/alXFetoW59OAkLnidfuhStQMFD628z2AmR0v5dqg u9NF7VPoqZwVRcG9G6dqJ9Zqmry2mF8HYNj1eMF0SH2Nd3PIvrPYCM3Wwvafygev10hLlqXwn+n1L GJahVPlA==; Received: from [179.232.144.59] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1oPAP0-00Cb74-3H; Sat, 20 Aug 2022 00:23:47 +0200 From: "Guilherme G. Piccoli" To: akpm@linux-foundation.org, bhe@redhat.com, pmladek@suse.com, kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, kernel-dev@igalia.com, kernel@gpiccoli.net, halves@canonical.com, fabiomirmar@gmail.com, alejandro.j.jimenez@oracle.com, andriy.shevchenko@linux.intel.com, arnd@arndb.de, bp@alien8.de, corbet@lwn.net, d.hatayama@jp.fujitsu.com, dave.hansen@linux.intel.com, dyoung@redhat.com, feng.tang@intel.com, gregkh@linuxfoundation.org, mikelley@microsoft.com, hidehiro.kawai.ez@hitachi.com, jgross@suse.com, john.ogness@linutronix.de, keescook@chromium.org, luto@kernel.org, mhiramat@kernel.org, mingo@redhat.com, paulmck@kernel.org, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, stern@rowland.harvard.edu, tglx@linutronix.de, vgoyal@redhat.com, vkuznets@redhat.com, will@kernel.org, xuqiang36@huawei.com, "Guilherme G. Piccoli" , linux-edac@vger.kernel.org, Tony Luck , Dinh Nguyen Subject: [PATCH V3 08/11] EDAC/altera: Skip the panic notifier if kdump is loaded Date: Fri, 19 Aug 2022 19:17:28 -0300 Message-Id: <20220819221731.480795-9-gpiccoli@igalia.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819221731.480795-1-gpiccoli@igalia.com> References: <20220819221731.480795-1-gpiccoli@igalia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The altera_edac panic notifier performs some data collection with regards errors detected; such code relies in the regmap layer to perform reads/writes, so the code is abstracted and there is some risk level to execute that, since the panic path runs in atomic context, with interrupts/preemption and secondary CPUs disabled. Users want the information collected in this panic notifier though, so in order to balance the risk/benefit, let's skip the altera panic notifier if kdump is loaded. While at it, remove a useless header and encompass a macro inside the sole ifdef block it is used. Cc: Borislav Petkov Cc: Petr Mladek Cc: Tony Luck Acked-by: Dinh Nguyen Signed-off-by: Guilherme G. Piccoli --- V3: - added the ack tag from Dinh - thanks! - had a good discussion with Boris about that in V2 [0], hopefully we can continue and reach a consensus in this V3. [0] https://lore.kernel.org/lkml/46137c67-25b4-6657-33b7-cffdc7afc0d7@igalia.com/ V2: - new patch, based on the discussion in [1]. [1] https://lore.kernel.org/lkml/62a63fc2-346f-f375-043a-fa21385279df@igalia.com/ drivers/edac/altera_edac.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index e7e8e624a436..741fe5539154 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include #include #include "altera_edac.h" @@ -2063,22 +2063,30 @@ static const struct irq_domain_ops a10_eccmgr_ic_ops = { }; /************** Stratix 10 EDAC Double Bit Error Handler ************/ -#define to_a10edac(p, m) container_of(p, struct altr_arria10_edac, m) - #ifdef CONFIG_64BIT /* panic routine issues reboot on non-zero panic_timeout */ extern int panic_timeout; +#define to_a10edac(p, m) container_of(p, struct altr_arria10_edac, m) + /* * The double bit error is handled through SError which is fatal. This is * called as a panic notifier to printout ECC error info as part of the panic. + * + * Notice that if kdump is set, we take the risk avoidance approach and + * skip the notifier, given that users are expected to have access to a + * full vmcore. */ static int s10_edac_dberr_handler(struct notifier_block *this, unsigned long event, void *ptr) { - struct altr_arria10_edac *edac = to_a10edac(this, panic_notifier); + struct altr_arria10_edac *edac; int err_addr, dberror; + if (kexec_crash_loaded()) + return NOTIFY_DONE; + + edac = to_a10edac(this, panic_notifier); regmap_read(edac->ecc_mgr_map, S10_SYSMGR_ECC_INTSTAT_DERR_OFST, &dberror); regmap_write(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST, dberror); -- 2.37.2