public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Borislav Petkov <borislav.petkov@amd.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	andi@firstfloor.org, torvalds@linux-foundation.org,
	tglx@linutronix.de, borislav.petkov@amd.com, mingo@elte.hu
Subject: [tip:x86/urgent] x86: EDAC: carve out AMD MCE decoding logic
Date: Fri, 2 Oct 2009 14:01:44 GMT	[thread overview]
Message-ID: <tip-0d18b2e34bd1ad8f5bd3f3a17b5e7df132e511a9@git.kernel.org> (raw)
In-Reply-To: <20091002133148.GD28682@aftab>

Commit-ID:  0d18b2e34bd1ad8f5bd3f3a17b5e7df132e511a9
Gitweb:     http://git.kernel.org/tip/0d18b2e34bd1ad8f5bd3f3a17b5e7df132e511a9
Author:     Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Fri, 2 Oct 2009 15:31:48 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 2 Oct 2009 15:42:19 +0200

x86: EDAC: carve out AMD MCE decoding logic

This converts the MCE decoding logic into a standalone config
option which can be built-in or a module, the first one being the
default for MCEs happening early on in the boot process.

This, beyond being separated in a cleaner way, also saves RAM by
making the decoding logic modular.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andi Kleen <andi@firstfloor.org>
LKML-Reference: <20091002133148.GD28682@aftab>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 drivers/edac/Kconfig        |   14 +++++++++++++-
 drivers/edac/Makefile       |    5 +----
 drivers/edac/edac_mce_amd.c |   19 ++++++++++++++++++-
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 02127e5..55c9c59 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -47,6 +47,18 @@ config EDAC_DEBUG_VERBOSE
 	  Source file name and line number where debugging message
 	  printed will be added to debugging message.
 
+ config EDAC_DECODE_MCE
+	tristate "Decode MCEs in human-readable form (only on AMD for now)"
+	depends on CPU_SUP_AMD && X86_MCE
+	default y
+	---help---
+	  Enable this option if you want to decode Machine Check Exceptions
+	  occuring on your machine in human-readable form.
+
+	  You should definitely say Y here in case you want to decode MCEs
+	  which occur really early upon boot, before the module infrastructure
+	  has been initialized.
+
 config EDAC_MM_EDAC
 	tristate "Main Memory EDAC (Error Detection And Correction) reporting"
 	help
@@ -59,7 +71,7 @@ config EDAC_MM_EDAC
 
 config EDAC_AMD64
 	tristate "AMD64 (Opteron, Athlon64) K8, F10h, F11h"
-	depends on EDAC_MM_EDAC && K8_NB && X86_64 && PCI && CPU_SUP_AMD
+	depends on EDAC_MM_EDAC && K8_NB && X86_64 && PCI && EDAC_DECODE_MCE
 	help
 	  Support for error detection and correction on the AMD 64
 	  Families of Memory Controllers (K8, F10h and F11h)
diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile
index 8701cd7..bc5dc23 100644
--- a/drivers/edac/Makefile
+++ b/drivers/edac/Makefile
@@ -6,7 +6,6 @@
 # GNU General Public License.
 #
 
-
 obj-$(CONFIG_EDAC)			:= edac_stub.o
 obj-$(CONFIG_EDAC_MM_EDAC)		+= edac_core.o
 
@@ -17,9 +16,7 @@ ifdef CONFIG_PCI
 edac_core-objs	+= edac_pci.o edac_pci_sysfs.o
 endif
 
-ifdef CONFIG_CPU_SUP_AMD
-obj-$(CONFIG_X86_MCE)			+= edac_mce_amd.o
-endif
+obj-$(CONFIG_EDAC_DECODE_MCE)		+= edac_mce_amd.o
 
 obj-$(CONFIG_EDAC_AMD76X)		+= amd76x_edac.o
 obj-$(CONFIG_EDAC_CPC925)		+= cpc925_edac.o
diff --git a/drivers/edac/edac_mce_amd.c b/drivers/edac/edac_mce_amd.c
index 83a01a1..713ed7d 100644
--- a/drivers/edac/edac_mce_amd.c
+++ b/drivers/edac/edac_mce_amd.c
@@ -3,6 +3,7 @@
 
 static bool report_gart_errors;
 static void (*nb_bus_decoder)(int node_id, struct err_regs *regs);
+static void (*orig_mce_callback)(struct mce *m);
 
 void amd_report_gart_errors(bool v)
 {
@@ -427,9 +428,25 @@ static int __init mce_amd_init(void)
 	 * We can decode MCEs for Opteron and later CPUs:
 	 */
 	if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) &&
-	    (boot_cpu_data.x86 >= 0xf))
+	    (boot_cpu_data.x86 >= 0xf)) {
+		/* safe the default decode mce callback */
+		orig_mce_callback = x86_mce_decode_callback;
+
 		x86_mce_decode_callback = amd_decode_mce;
+	}
 
 	return 0;
 }
 early_initcall(mce_amd_init);
+
+#ifdef MODULE
+static void __exit mce_amd_exit(void)
+{
+	x86_mce_decode_callback = orig_mce_callback;
+}
+
+MODULE_DESCRIPTION("AMD MCE decoder");
+MODULE_ALIAS("edac-mce-amd");
+MODULE_LICENSE("GPL");
+module_exit(mce_amd_exit);
+#endif

  parent reply	other threads:[~2009-10-02 14:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 14:09 x86: mce: Please revert 22223c9b417be5fd0ab2cf9ad17eb7bd1e19f7b9 Andi Kleen
2009-09-30 19:40 ` Borislav Petkov
2009-09-30 20:46   ` Ingo Molnar
2009-09-30 21:48     ` Ingo Molnar
2009-09-30 22:39       ` Borislav Petkov
2009-09-30 23:09         ` Ingo Molnar
2009-10-01 14:14           ` Borislav Petkov
2009-10-01 14:34             ` Linus Torvalds
2009-10-01 14:46               ` Borislav Petkov
2009-10-01 15:00                 ` Ingo Molnar
2009-10-01 15:21                   ` Borislav Petkov
2009-10-01 15:32                     ` Ingo Molnar
2009-10-02 13:21                       ` Borislav Petkov
2009-10-02 13:22                         ` [PATCH 1/3] x86, mce, edac: Fix MCE decoding callback logic Borislav Petkov
2009-10-02 13:23                         ` [PATCH 2/3] initcalls: add early_initcall for modules Borislav Petkov
2009-10-02 14:01                           ` [tip:x86/urgent] initcalls: Add early_initcall() " tip-bot for Borislav Petkov
2009-10-02 13:26                         ` x86: mce: Please revert 22223c9b417be5fd0ab2cf9ad17eb7bd1e19f7b9 Ingo Molnar
2009-10-02 13:31                         ` [PATCH 3/3] EDAC: carve out AMD MCE decoding logic Borislav Petkov
2009-10-02 13:39                           ` Ingo Molnar
2009-10-02 18:26                             ` Borislav Petkov
2009-10-02 18:47                               ` Ingo Molnar
2009-10-03  6:57                                 ` Borislav Petkov
2009-10-03  7:18                                   ` Ingo Molnar
2009-10-05 15:15                                     ` Borislav Petkov
2009-10-16 12:55                                   ` [tip:perf/mce] mce, edac: Use an atomic notifier for MCEs decoding tip-bot for Borislav Petkov
2009-10-02 14:01                           ` tip-bot for Borislav Petkov [this message]
2009-10-01 14:55               ` x86: mce: Please revert 22223c9b417be5fd0ab2cf9ad17eb7bd1e19f7b9 Ingo Molnar
2009-10-01 15:26               ` Andi Kleen
2009-10-02 14:01             ` [tip:x86/urgent] x86: EDAC: MCE: Fix MCE decoding callback logic tip-bot for Ingo Molnar

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=tip-0d18b2e34bd1ad8f5bd3f3a17b5e7df132e511a9@git.kernel.org \
    --to=borislav.petkov@amd.com \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox