Skip to contentSkip to conversation

x86, MCE: Use MCE decoder notifier chain

PATCH In review Borislav Petkov 3 participants 7 messages Jul 18, 2011 – Aug 5, 2011

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 1/2 x86, MCE: Use notifier chain only for MCE decoding

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

Drop the edac_mce custom hook in favor of the generic notifier mechanism. Also, do not log the error to mcelog if the notified agent was able to decode it.

---
 arch/x86/kernel/cpu/mcheck/mce.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +6 -11
index 08363b0..019786a 100644
@@ -144,23 +144,20 @@ static struct mce_log mcelog = {
 void mce_log(struct mce *mce)
 {
 	unsigned next, entry;
+	int ret = 0;
 
 	/* Emit the trace record: */
 	trace_mce_record(mce);
 
+	ret = atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
+	if (ret == NOTIFY_STOP)
+		return;
+
 	mce->finished = 0;
 	wmb();
 	for (;;) {
 		entry = rcu_dereference_check_mce(mcelog.next);
 		for (;;) {
-			/*
-			 * If edac_mce is enabled, it will check the error type
-			 * and will process it, if it is a known error.
-			 * Otherwise, the error will be sent through mcelog
-			 * interface
-			 */
-			if (edac_mce_parse(mce))
-				return;
 
 			/*
 			 * When the buffer fills up discard new entries.
@@ -551,10 +548,8 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
 		 * Don't get the IP here because it's unlikely to
 		 * have anything to do with the actual error location.
 		 */
-		if (!(flags & MCP_DONTLOG) && !mce_dont_log_ce) {
+		if (!(flags & MCP_DONTLOG) && !mce_dont_log_ce)
 			mce_log(&m);
-			atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, &m);
-		}
 
 		/*
 		 * Clear state for this bank.
Signature · 1 line
1.7.4.rc2
#0 lore raw

cover x86, MCE: Use MCE decoder notifier chain

From: Borislav Petkov <[email protected]>

Hi Mauro, Tony,

the following two patches convert i7core_edac to use the MCE decoder notifier chain, thus getting rid of the custom edac_mce hook. There should be no functionality change following from this along with a nice diffstat of removing ca 100 lines.

The patches are ontop of the latest tip/ras/core and are available at

git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git fix-mce-logging

I'd like to ask you guys to please give them a run to make sure I haven't broken i7core_edac.

Thanks.

 arch/x86/kernel/cpu/mcheck/mce.c |   18 ++++-------
 drivers/edac/Kconfig             |    3 --
 drivers/edac/Makefile            |    1 -
 drivers/edac/edac_mce.c          |   61 --------------------------------------
 drivers/edac/i7core_edac.c       |   51 +++++++++++++++----------------
 include/linux/edac_mce.h         |   31 -------------------
 6 files changed, 31 insertions(+), 134 deletions(-)
#2 lore raw

PATCH 2/2 i7core_edac: Drop the edac_mce facility

From: Borislav Petkov <[email protected]>

Remove edac_mce pieces and use the normal MCE decoder notifier chain by retaining the same functionality with considerably less code.

Cc Mauro Carvalho Chehab <[email protected]>
---
 arch/x86/kernel/cpu/mcheck/mce.c |    1 -
 drivers/edac/Kconfig             |    3 --
 drivers/edac/Makefile            |    1 -
 drivers/edac/edac_mce.c          |   61 --------------------------------------
 drivers/edac/i7core_edac.c       |   51 +++++++++++++++----------------
 include/linux/edac_mce.h         |   31 -------------------
 6 files changed, 25 insertions(+), 123 deletions(-)
 delete mode 100644 drivers/edac/edac_mce.c
 delete mode 100644 include/linux/edac_mce.h
arch/x86/kernel/cpu/mcheck/mce.c +0 -1
index 019786a..63aad27 100644
@@ -36,7 +36,6 @@
 #include <linux/fs.h>
 #include <linux/mm.h>
 #include <linux/debugfs.h>
-#include <linux/edac_mce.h>
 #include <linux/irq_work.h>
 
 #include <asm/processor.h>
drivers/edac/Kconfig +0 -3
index af1a17d..f888fb5 100644
@@ -71,9 +71,6 @@ config EDAC_MM_EDAC
 	  occurred so that a particular failing memory module can be
 	  replaced.  If unsure, select 'Y'.
 
-config EDAC_MCE
-	bool
-
 config EDAC_AMD64
 	tristate "AMD64 (Opteron, Athlon64) K8, F10h"
 	depends on EDAC_MM_EDAC && AMD_NB && X86_64 && EDAC_DECODE_MCE
drivers/edac/Makefile +0 -1
index 3e23913..b06a9b1 100644
@@ -8,7 +8,6 @@
 
 obj-$(CONFIG_EDAC)			:= edac_stub.o
 obj-$(CONFIG_EDAC_MM_EDAC)		+= edac_core.o
-obj-$(CONFIG_EDAC_MCE)			+= edac_mce.o
 
 edac_core-y	:= edac_mc.o edac_device.o edac_mc_sysfs.o edac_pci_sysfs.o
 edac_core-y	+= edac_module.o edac_device_sysfs.o
drivers/edac/edac_mce.c deleted +0 -61

61 lines not on this page · raw message

drivers/edac/i7core_edac.c +25 -26

113 lines not on this page · raw message

include/linux/edac_mce.h deleted +0 -31
deleted file mode 100644
index f974fc0..0000000
@@ -1,31 +0,0 @@
-/* Provides edac interface to mcelog events
- *
- * This file may be distributed under the terms of the
- * GNU General Public License version 2.
- *
- * Copyright (c) 2009 by:
- *	 Mauro Carvalho Chehab <[email protected]>
- *
- * Red Hat Inc. http://www.redhat.com
- */
-
-#if defined(CONFIG_EDAC_MCE) || \
-			(defined(CONFIG_EDAC_MCE_MODULE) && defined(MODULE))
-
-#include <asm/mce.h>
-#include <linux/list.h>
-
-struct edac_mce {
-	struct list_head list;
-
-	void *priv;
-	int (*check_error)(void *priv, struct mce *mce);
-};
-
-int edac_mce_register(struct edac_mce *edac_mce);
-void edac_mce_unregister(struct edac_mce *edac_mce);
-int edac_mce_parse(struct mce *mce);
-
-#else
-#define edac_mce_parse(mce) (0)
-#endif
Signature · 1 line
1.7.4.rc2
#3 lore raw
In reply to Borislav Petkov

Ping?

Mauro, any progress on those below?

Thanks.

Quoted 28 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

Hi Mauro, Tony,

the following two patches convert i7core_edac to use the MCE decoder notifier chain, thus getting rid of the custom edac_mce hook. There should be no functionality change following from this along with a nice diffstat of removing ca 100 lines.

The patches are ontop of the latest tip/ras/core and are available at

git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git fix-mce-logging

I'd like to ask you guys to please give them a run to make sure I haven't broken i7core_edac.

Thanks.

 arch/x86/kernel/cpu/mcheck/mce.c |   18 ++++-------
 drivers/edac/Kconfig             |    3 --
 drivers/edac/Makefile            |    1 -
 drivers/edac/edac_mce.c          |   61 --------------------------------------
 drivers/edac/i7core_edac.c       |   51 +++++++++++++++----------------
 include/linux/edac_mce.h         |   31 -------------------
 6 files changed, 31 insertions(+), 134 deletions(-)
Signature · 8 lines
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
#4 lore raw

Boris,

Em 02-08-2011 08:58, Borislav Petkov escreveu:

Quoted 3 lines

Ping?

Mauro, any progress on those below?

Sorry for taking a long time on that. I'm testing it right now, together with a few other patches for i7core.

I've added it (with a few conflict fixes) at:
ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/edac.git linux_next

If everything works as before, I'll send it to Linus tomorrow, assuming that linux-next will catch them.

Thanks,
Mauro

Quoted 33 lines

Thanks.

Quoted 28 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

Hi Mauro, Tony,

the following two patches convert i7core_edac to use the MCE decoder notifier chain, thus getting rid of the custom edac_mce hook. There should be no functionality change following from this along with a nice diffstat of removing ca 100 lines.

The patches are ontop of the latest tip/ras/core and are available at

git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git fix-mce-logging

I'd like to ask you guys to please give them a run to make sure I haven't broken i7core_edac.

Thanks.

 arch/x86/kernel/cpu/mcheck/mce.c |   18 ++++-------
 drivers/edac/Kconfig             |    3 --
 drivers/edac/Makefile            |    1 -
 drivers/edac/edac_mce.c          |   61 --------------------------------------
 drivers/edac/i7core_edac.c       |   51 +++++++++++++++----------------
 include/linux/edac_mce.h         |   31 -------------------
 6 files changed, 31 insertions(+), 134 deletions(-)
#5 lore raw
Quoted 7 lines · Mauro Carvalho Chehab

Boris,

Em 02-08-2011 08:58, Borislav Petkov escreveu:

Quoted 3 lines

Ping?

Mauro, any progress on those below?

Quoted 8 lines

Sorry for taking a long time on that. I'm testing it right now, together with a few other patches for i7core.

I've added it (with a few conflict fixes) at:
ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/edac.git linux_next

If everything works as before, I'll send it to Linus tomorrow, assuming that linux-next will catch them.

Ok, thanks.

Please bear in mind that the second patch depends on the first and they both touch arch/x86 so you'd at least need Acked-by's from x86 maintainers. Ingo?

Signature · 8 lines
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
Acked-by
#6 lore raw
Quoted 14 lines · Borislav Petkov
Quoted 13 lines · Mauro Carvalho Chehab

Boris,

Em 02-08-2011 08:58, Borislav Petkov escreveu:

Quoted 3 lines

Ping?

Mauro, any progress on those below?

Sorry for taking a long time on that. I'm testing it right now, together with a few other patches for i7core.

I've added it (with a few conflict fixes) at:
ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/edac.git linux_next

Quoted 8 lines
Quoted 2 lines

If everything works as before, I'll send it to Linus tomorrow, assuming that linux-next will catch them.

Ok, thanks.

Please bear in mind that the second patch depends on the first and they both touch arch/x86 so you'd at least need Acked-by's from x86 maintainers. Ingo?

a quick look suggests it's ok:

Thanks,

Ingo