All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
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,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	linux-edac@vger.kernel.org, Dinh Nguyen <dinguyen@kernel.org>,
	Tony Luck <tony.luck@intel.com>
Subject: [PATCH v2 10/13] EDAC/altera: Skip the panic notifier if kdump is loaded
Date: Tue, 19 Jul 2022 16:53:23 -0300	[thread overview]
Message-ID: <20220719195325.402745-11-gpiccoli@igalia.com> (raw)
In-Reply-To: <20220719195325.402745-1-gpiccoli@igalia.com>

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: Dinh Nguyen <dinguyen@kernel.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>

---

V2:
- new patch, based on the discussion in [0].
[0] 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 <linux/kernel.h>
 #include <linux/mfd/altera-sysmgr.h>
 #include <linux/mfd/syscon.h>
-#include <linux/notifier.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
@@ -24,6 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/types.h>
+#include <linux/kexec.h>
 #include <linux/uaccess.h>
 
 #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.1


WARNING: multiple messages have this Message-ID (diff)
From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
To: akpm@linux-foundation.org, bhe@redhat.com, pmladek@suse.com,
	kexec@lists.infradead.org
Cc: linux-hyperv@vger.kernel.org, halves@canonical.com,
	peterz@infradead.org, dave.hansen@linux.intel.com,
	feng.tang@intel.com, mikelley@microsoft.com, will@kernel.org,
	arnd@arndb.de, corbet@lwn.net, paulmck@kernel.org,
	fabiomirmar@gmail.com, x86@kernel.org, mingo@redhat.com,
	stern@rowland.harvard.edu, dyoung@redhat.com, vgoyal@redhat.com,
	alejandro.j.jimenez@oracle.com, keescook@chromium.org,
	john.ogness@linutronix.de, Dinh Nguyen <dinguyen@kernel.org>,
	rostedt@goodmis.org, bp@alien8.de, luto@kernel.org,
	hidehiro.kawai.ez@hitachi.com, tglx@linutronix.de,
	andriy.shevchenko@linux.intel.com, linux-edac@vger.kernel.org,
	jgross@suse.com, Tony Luck <tony.luck@intel.com>,
	gregkh@linuxfoundation.org, kernel@gpiccoli.net,
	linux-kernel@vger.kernel.org, senozhatsky@chromium.org,
	d.hatayama@jp.fujitsu.com, mhiramat@kernel.org,
	kernel-dev@igalia.com, netdev@vger.kernel.org,
	vkuznets@redhat.com
Subject: [PATCH v2 10/13] EDAC/altera: Skip the panic notifier if kdump is loaded
Date: Tue, 19 Jul 2022 16:53:23 -0300	[thread overview]
Message-ID: <20220719195325.402745-11-gpiccoli@igalia.com> (raw)
In-Reply-To: <20220719195325.402745-1-gpiccoli@igalia.com>

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: Dinh Nguyen <dinguyen@kernel.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>

---

V2:
- new patch, based on the discussion in [0].
[0] 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 <linux/kernel.h>
 #include <linux/mfd/altera-sysmgr.h>
 #include <linux/mfd/syscon.h>
-#include <linux/notifier.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
@@ -24,6 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/types.h>
+#include <linux/kexec.h>
 #include <linux/uaccess.h>
 
 #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.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2022-07-19 19:58 UTC|newest]

Thread overview: 142+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 19:53 [PATCH v2 00/13] The panic notifiers refactor strikes back - fixes/clean-ups Guilherme G. Piccoli
2022-07-19 19:53 ` Guilherme G. Piccoli
2022-07-19 19:53 ` Guilherme G. Piccoli
2022-07-19 19:53 ` Guilherme G. Piccoli
2022-07-19 19:53 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 01/13] ARM: Disable FIQs (but not IRQs) on CPUs shutdown paths Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-08-07 15:35   ` Guilherme G. Piccoli
2022-08-07 15:35     ` Guilherme G. Piccoli
2022-08-07 15:35     ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 02/13] notifier: Add panic notifiers info and purge trailing whitespaces Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-08-03  9:21   ` Baoquan He
2022-08-03  9:21     ` Baoquan He
2022-07-19 19:53 ` [PATCH v2 03/13] firmware: google: Test spinlock on panic path to avoid lockups Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-08-07 15:38   ` Guilherme G. Piccoli
2022-08-07 15:38     ` Guilherme G. Piccoli
2022-08-08  5:07   ` Evan Green
2022-08-08  5:07     ` Evan Green
2022-08-08 15:14     ` Guilherme G. Piccoli
2022-08-08 15:14       ` Guilherme G. Piccoli
2022-08-08 15:26       ` Greg Kroah-Hartman
2022-08-08 15:26         ` Greg Kroah-Hartman
2022-08-08 15:37         ` Guilherme G. Piccoli
2022-08-08 15:37           ` Guilherme G. Piccoli
2022-08-10 12:54           ` Greg Kroah-Hartman
2022-08-10 12:54             ` Greg Kroah-Hartman
2022-07-19 19:53 ` [PATCH v2 04/13] soc: bcm: brcmstb: Document panic notifier action and remove useless header Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-20 23:00   ` Florian Fainelli
2022-07-20 23:00     ` Florian Fainelli
2022-07-21 13:17     ` Guilherme G. Piccoli
2022-07-21 13:17       ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 05/13] alpha: Clean-up the panic notifier code Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 06/13] um: Improve panic notifiers consistency and ordering Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-08-07 15:40   ` Guilherme G. Piccoli
2022-08-07 15:40     ` Guilherme G. Piccoli
2022-08-07 15:40     ` Guilherme G. Piccoli
2022-08-09 18:09     ` Johannes Berg
2022-08-09 18:09       ` Johannes Berg
2022-08-09 18:09       ` Johannes Berg
2022-08-09 19:03       ` Guilherme G. Piccoli
2022-08-09 19:03         ` Guilherme G. Piccoli
2022-08-09 19:03         ` Guilherme G. Piccoli
2022-08-09 19:08         ` Johannes Berg
2022-08-09 19:08           ` Johannes Berg
2022-08-09 19:08           ` Johannes Berg
2022-08-09 19:45           ` Guilherme G. Piccoli
2022-08-09 19:45             ` Guilherme G. Piccoli
2022-08-09 19:45             ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 07/13] parisc: Replace regular spinlock with spin_trylock on panic path Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-20  1:43   ` Jeroen Roovers
2022-07-20  1:43     ` Jeroen Roovers
2022-07-21 13:19     ` Guilherme G. Piccoli
2022-07-21 13:19       ` Guilherme G. Piccoli
2022-07-21 13:45       ` Helge Deller
2022-07-21 13:45         ` Helge Deller
2022-07-21 14:00         ` Guilherme G. Piccoli
2022-07-21 14:00           ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 08/13] tracing: Improve panic/die notifiers Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-08-03  9:36   ` Baoquan He
2022-08-03  9:36     ` Baoquan He
2022-08-03  9:52     ` Baoquan He
2022-08-03  9:52       ` Baoquan He
2022-08-03 11:44       ` Guilherme G. Piccoli
2022-08-03 11:44         ` Guilherme G. Piccoli
2022-08-07 15:46   ` Guilherme G. Piccoli
2022-08-07 15:46     ` Guilherme G. Piccoli
2022-08-16 14:14   ` Steven Rostedt
2022-08-16 14:14     ` Steven Rostedt
2022-08-16 14:57     ` Alan Stern
2022-08-16 14:57       ` Alan Stern
2022-08-16 15:52       ` Steven Rostedt
2022-08-16 15:52         ` Steven Rostedt
2022-08-16 20:12         ` Guilherme G. Piccoli
2022-08-16 20:12           ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 09/13] notifier: Show function names on notifier routines if DEBUG_NOTIFIERS is set Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-19 20:33   ` Arjan van de Ven
2022-07-19 20:33     ` Arjan van de Ven
2022-07-19 20:44     ` Guilherme G. Piccoli
2022-07-19 20:44       ` Guilherme G. Piccoli
2022-07-19 20:48       ` Arjan van de Ven
2022-07-19 20:48         ` Arjan van de Ven
2022-07-19 21:00         ` Guilherme G. Piccoli
2022-07-19 21:00           ` Guilherme G. Piccoli
2022-07-19 22:04           ` Arjan van de Ven
2022-07-19 22:04             ` Arjan van de Ven
2022-07-21 13:20             ` Guilherme G. Piccoli
2022-07-21 13:20               ` Guilherme G. Piccoli
2022-07-19 19:53 ` Guilherme G. Piccoli [this message]
2022-07-19 19:53   ` [PATCH v2 10/13] EDAC/altera: Skip the panic notifier if kdump is loaded Guilherme G. Piccoli
2022-08-07 15:48   ` Guilherme G. Piccoli
2022-08-07 15:48     ` Guilherme G. Piccoli
2022-08-16 18:44   ` Dinh Nguyen
2022-08-16 18:44     ` Dinh Nguyen
2022-08-16 20:16     ` Guilherme G. Piccoli
2022-08-16 20:16       ` Guilherme G. Piccoli
2022-08-17 17:31   ` Borislav Petkov
2022-08-17 17:31     ` Borislav Petkov
2022-08-17 18:45     ` Guilherme G. Piccoli
2022-08-17 18:45       ` Guilherme G. Piccoli
2022-08-17 19:34       ` Borislav Petkov
2022-08-17 19:34         ` Borislav Petkov
2022-08-17 20:28         ` Guilherme G. Piccoli
2022-08-17 20:28           ` Guilherme G. Piccoli
2022-08-17 21:02           ` Borislav Petkov
2022-08-17 21:02             ` Borislav Petkov
2022-08-17 21:39             ` Guilherme G. Piccoli
2022-08-17 21:39               ` Guilherme G. Piccoli
2022-08-17 21:46               ` Borislav Petkov
2022-08-17 21:46                 ` Borislav Petkov
2022-08-17 21:56                 ` Guilherme G. Piccoli
2022-08-17 21:56                   ` Guilherme G. Piccoli
2022-08-17 22:00                   ` Borislav Petkov
2022-08-17 22:00                     ` Borislav Petkov
2022-08-17 22:09                     ` Guilherme G. Piccoli
2022-08-17 22:09                       ` Guilherme G. Piccoli
2022-08-17 22:19                       ` Borislav Petkov
2022-08-17 22:19                         ` Borislav Petkov
2022-08-17 22:49                         ` Guilherme G. Piccoli
2022-08-17 22:49                           ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 11/13] video/hyperv_fb: Avoid taking busy spinlock on panic path Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-25 18:09   ` Michael Kelley (LINUX)
2022-07-25 18:09     ` Michael Kelley (LINUX)
2022-07-25 22:05     ` Guilherme G. Piccoli
2022-07-25 22:05       ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 12/13] drivers/hv/vmbus, video/hyperv_fb: Untangle and refactor Hyper-V panic notifiers Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli
2022-07-25 18:55   ` Michael Kelley (LINUX)
2022-07-25 18:55     ` Michael Kelley (LINUX)
2022-07-19 19:53 ` [PATCH v2 13/13] panic: Fixes the panic_print NMI backtrace setting Guilherme G. Piccoli
2022-07-19 19:53   ` Guilherme G. Piccoli

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=20220719195325.402745-11-gpiccoli@igalia.com \
    --to=gpiccoli@igalia.com \
    --cc=akpm@linux-foundation.org \
    --cc=alejandro.j.jimenez@oracle.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=d.hatayama@jp.fujitsu.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dinguyen@kernel.org \
    --cc=dyoung@redhat.com \
    --cc=fabiomirmar@gmail.com \
    --cc=feng.tang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=halves@canonical.com \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=jgross@suse.com \
    --cc=john.ogness@linutronix.de \
    --cc=keescook@chromium.org \
    --cc=kernel-dev@igalia.com \
    --cc=kernel@gpiccoli.net \
    --cc=kexec@lists.infradead.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=stern@rowland.harvard.edu \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=vgoyal@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.