Skip to contentSkip to conversation

RAS changes for v4.3

GIT PULL New Ingo Molnar 4 participants 7 messages Aug 31, 2015 – Oct 16, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest ras-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git ras-core-for-linus

# HEAD: 6c36dfe949187dc2729abfad4b083758ac5c2e0e x86/ras: Move AMD MCE injector to arch/x86/ras/

MCE handling updates, but also some generic drivers/edac/ changes to better organize the Kconfig space.

Thanks,

Ingo

------------------>
Ashok Raj (2):
x86/mce: Remove unused function declarations x86/mce: Clear Local MCE opt-in before kexec

Borislav Petkov (6):
x86/mce: Reuse one of the u16 padding fields in 'struct mce' x86/mce: Kill drain_mcelog_buffer()
RAS: Add a menuconfig option with descriptive text x86/mce: Rename rcu_dereference_check_mce() to mce_log_get_idx_check() x86/mce: Add a wrapper around mce_log() for injection x86/ras: Move AMD MCE injector to arch/x86/ras/

Chen, Gong (4):
x86/mce: Provide a lockless memory pool to save error records x86/mce: Don't use percpu workqueues
x86/mce: Remove the MCE ring for Action Optional errors x86/mce: Avoid potential deadlock due to printk() in MCE context

Xie XiuQi (1):
x86/mce: Reenable CMCI banks when swiching back to interrupt mode

 arch/x86/Kconfig                             |   1 +
 arch/x86/Makefile                            |   2 +
 arch/x86/include/asm/mce.h                   |   8 +-
 arch/x86/include/uapi/asm/mce.h              |   3 +-
 arch/x86/kernel/cpu/mcheck/Makefile          |   2 +-
 arch/x86/kernel/cpu/mcheck/mce-apei.c        |   1 -
 arch/x86/kernel/cpu/mcheck/mce-genpool.c     |  99 ++++++++++++
 arch/x86/kernel/cpu/mcheck/mce-internal.h    |  14 ++
 arch/x86/kernel/cpu/mcheck/mce.c             | 231 +++++++++++++--------------
 arch/x86/kernel/cpu/mcheck/mce_intel.c       |  61 ++++---
 arch/x86/kernel/process.c                    |   2 +
 arch/x86/kernel/smp.c                        |   2 +
 arch/x86/ras/Kconfig                         |  11 ++
 arch/x86/ras/Makefile                        |   2 +
 {drivers/edac => arch/x86/ras}/mce_amd_inj.c |   6 +-
 drivers/edac/Kconfig                         |  10 --
 drivers/edac/Makefile                        |   1 -
 drivers/ras/Kconfig                          |  37 ++++-
 18 files changed, 329 insertions(+), 164 deletions(-)
 create mode 100644 arch/x86/kernel/cpu/mcheck/mce-genpool.c
 create mode 100644 arch/x86/ras/Kconfig
 create mode 100644 arch/x86/ras/Makefile
 rename {drivers/edac => arch/x86/ras}/mce_amd_inj.c (98%)
arch/x86/Kconfig +1 -0
index b3a1a5d77d92..06dbb5da90c6 100644
@@ -955,6 +955,7 @@ config X86_REROUTE_FOR_BROKEN_BOOT_IRQS
 
 config X86_MCE
 	bool "Machine Check / overheating reporting"
+	select GENERIC_ALLOCATOR
 	default y
 	---help---
 	  Machine Check support allows the processor to notify the
arch/x86/Makefile +2 -0
index 118e6debc483..0f38418719ab 100644
@@ -212,6 +212,8 @@ drivers-$(CONFIG_PM) += arch/x86/power/
 
 drivers-$(CONFIG_FB) += arch/x86/video/
 
+drivers-$(CONFIG_RAS) += arch/x86/ras/
+
 ####
 # boot loader support. Several targets are kept for legacy purposes
 
arch/x86/include/asm/mce.h +4 -4
index 982dfc3679ad..2dbc0bf2b9f3 100644
@@ -151,10 +151,12 @@ extern int mce_p5_enabled;
 #ifdef CONFIG_X86_MCE
 int mcheck_init(void);
 void mcheck_cpu_init(struct cpuinfo_x86 *c);
+void mcheck_cpu_clear(struct cpuinfo_x86 *c);
 void mcheck_vendor_init_severity(void);
 #else
 static inline int mcheck_init(void) { return 0; }
 static inline void mcheck_cpu_init(struct cpuinfo_x86 *c) {}
+static inline void mcheck_cpu_clear(struct cpuinfo_x86 *c) {}
 static inline void mcheck_vendor_init_severity(void) {}
 #endif
 
@@ -181,20 +183,18 @@ DECLARE_PER_CPU(struct device *, mce_device);
 
 #ifdef CONFIG_X86_MCE_INTEL
 void mce_intel_feature_init(struct cpuinfo_x86 *c);
+void mce_intel_feature_clear(struct cpuinfo_x86 *c);
 void cmci_clear(void);
 void cmci_reenable(void);
 void cmci_rediscover(void);
 void cmci_recheck(void);
-void lmce_clear(void);
-void lmce_enable(void);
 #else
 static inline void mce_intel_feature_init(struct cpuinfo_x86 *c) { }
+static inline void mce_intel_feature_clear(struct cpuinfo_x86 *c) { }
 static inline void cmci_clear(void) {}
 static inline void cmci_reenable(void) {}
 static inline void cmci_rediscover(void) {}
 static inline void cmci_recheck(void) {}
-static inline void lmce_clear(void) {}
-static inline void lmce_enable(void) {}
 #endif
 
 #ifdef CONFIG_X86_MCE_AMD
arch/x86/include/uapi/asm/mce.h +2 -1
index a0eab85ce7b8..76880ede9a35 100644
@@ -15,7 +15,8 @@ struct mce {
 	__u64 time;	/* wall time_t when error was detected */
 	__u8  cpuvendor;	/* cpu vendor as encoded in system.h */
 	__u8  inject_flags;	/* software inject flags */
-	__u16  pad;
+	__u8  severity;
+	__u8  usable_addr;
 	__u32 cpuid;	/* CPUID 1 EAX */
 	__u8  cs;		/* code segment */
 	__u8  bank;	/* machine check bank */
arch/x86/kernel/cpu/mcheck/Makefile +1 -1
index bb34b03af252..a3311c886194 100644
@@ -1,4 +1,4 @@
-obj-y				=  mce.o mce-severity.o
+obj-y				=  mce.o mce-severity.o mce-genpool.o
 
 obj-$(CONFIG_X86_ANCIENT_MCE)	+= winchip.o p5.o
 obj-$(CONFIG_X86_MCE_INTEL)	+= mce_intel.o
arch/x86/kernel/cpu/mcheck/mce-apei.c +0 -1
index a1aef9533154..34c89a3e8260 100644
@@ -57,7 +57,6 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err)
 
 	m.addr = mem_err->physical_addr;
 	mce_log(&m);
-	mce_notify_irq();
 }
 EXPORT_SYMBOL_GPL(apei_mce_report_mem_error);
 
arch/x86/kernel/cpu/mcheck/mce-genpool.c new file +99 -0

99 lines not on this page · raw message

arch/x86/kernel/cpu/mcheck/mce-internal.h +14 -0
index fe32074b865b..547720efd923 100644
@@ -13,6 +13,8 @@ enum severity_level {
 	MCE_PANIC_SEVERITY,
 };
 
+extern struct atomic_notifier_head x86_mce_decoder_chain;
+
 #define ATTR_LEN		16
 #define INITIAL_CHECK_INTERVAL	5 * 60 /* 5 minutes */
 
@@ -24,6 +26,16 @@ struct mce_bank {
 	char			attrname[ATTR_LEN];	/* attribute name */
 };
 
+struct mce_evt_llist {
+	struct llist_node llnode;
+	struct mce mce;
+};
+
+void mce_gen_pool_process(void);
+bool mce_gen_pool_empty(void);
+int mce_gen_pool_add(struct mce *mce);
+int mce_gen_pool_init(void);
+
 extern int (*mce_severity)(struct mce *a, int tolerant, char **msg, bool is_excp);
 struct dentry *mce_get_debugfs_dir(void);
 
@@ -67,3 +79,5 @@ static inline int apei_clear_mce(u64 record_id)
 	return -EINVAL;
 }
 #endif
+
+void mce_inject_log(struct mce *m);
arch/x86/kernel/cpu/mcheck/mce.c +110 -121

353 lines not on this page · raw message

arch/x86/kernel/cpu/mcheck/mce_intel.c +41 -20

106 lines not on this page · raw message

arch/x86/kernel/process.c +2 -0
index 397688beed4b..b20ef187ff41 100644
@@ -29,6 +29,7 @@
 #include <asm/debugreg.h>
 #include <asm/nmi.h>
 #include <asm/tlbflush.h>
+#include <asm/mce.h>
 
 /*
  * per-CPU TSS segments. Threads are completely 'soft' on Linux,
@@ -319,6 +320,7 @@ void stop_this_cpu(void *dummy)
 	 */
 	set_cpu_online(smp_processor_id(), false);
 	disable_local_APIC();
+	mcheck_cpu_clear(this_cpu_ptr(&cpu_info));
 
 	for (;;)
 		halt();
arch/x86/kernel/smp.c +2 -0
index 15aaa69bbb5e..12c8286206ce 100644
@@ -30,6 +30,7 @@
 #include <asm/proto.h>
 #include <asm/apic.h>
 #include <asm/nmi.h>
+#include <asm/mce.h>
 #include <asm/trace/irq_vectors.h>
 /*
  *	Some notes on x86 processor bugs affecting SMP operation:
@@ -243,6 +244,7 @@ static void native_stop_other_cpus(int wait)
 finish:
 	local_irq_save(flags);
 	disable_local_APIC();
+	mcheck_cpu_clear(this_cpu_ptr(&cpu_info));
 	local_irq_restore(flags);
 }
 
arch/x86/ras/Kconfig new file +11 -0
new file mode 100644
index 000000000000..10fea5fc821e
@@ -0,0 +1,11 @@
+config AMD_MCE_INJ
+	tristate "Simple MCE injection interface for AMD processors"
+	depends on RAS && EDAC_DECODE_MCE && DEBUG_FS
+	default n
+	help
+	  This is a simple debugfs interface to inject MCEs and test different
+	  aspects of the MCE handling code.
+
+	  WARNING: Do not even assume this interface is staying stable!
+
+
arch/x86/ras/Makefile new file +2 -0
new file mode 100644
index 000000000000..dd2c98b84037
@@ -0,0 +1,2 @@
+obj-$(CONFIG_AMD_MCE_INJ)		+= mce_amd_inj.o
+
arch/x86/ras/mce_amd_inj.c renamed from drivers/edac/mce_amd_inj.c +3 -3
similarity index 98%
rename from drivers/edac/mce_amd_inj.c
rename to arch/x86/ras/mce_amd_inj.c
index 4c73e4d03d46..17e35b5bf779 100644
@@ -6,7 +6,7 @@
  * This file may be distributed under the terms of the GNU General Public
  * License version 2.
  *
- * Copyright (c) 2010-14:  Borislav Petkov <[email protected]>
+ * Copyright (c) 2010-15:  Borislav Petkov <[email protected]>
  *			Advanced Micro Devices Inc.
  */
 
@@ -19,7 +19,7 @@
 #include <linux/uaccess.h>
 #include <asm/mce.h>
 
-#include "mce_amd.h"
+#include "../kernel/cpu/mcheck/mce-internal.h"
 
 /*
  * Collect all the MCi_XXX settings
@@ -195,7 +195,7 @@ static void do_inject(void)
 		i_mce.status |= MCI_STATUS_MISCV;
 
 	if (inj_type == SW_INJ) {
-		amd_decode_mce(NULL, 0, &i_mce);
+		mce_inject_log(&i_mce);
 		return;
 	}
 
drivers/edac/Kconfig +0 -10
index 8677ead2a8e1..ef25000a5bc6 100644
@@ -61,16 +61,6 @@ config EDAC_DECODE_MCE
 	  which occur really early upon boot, before the module infrastructure
 	  has been initialized.
 
-config EDAC_MCE_INJ
-	tristate "Simple MCE injection interface"
-	depends on EDAC_DECODE_MCE && DEBUG_FS
-	default n
-	help
-	  This is a simple debugfs interface to inject MCEs and test different
-	  aspects of the MCE handling code.
-
-	  WARNING: Do not even assume this interface is staying stable!
-
 config EDAC_MM_EDAC
 	tristate "Main Memory EDAC (Error Detection And Correction) reporting"
 	select RAS
drivers/edac/Makefile +0 -1
index 28ef2a519f65..ae3c5f3ce405 100644
@@ -17,7 +17,6 @@ edac_core-y	+= edac_pci.o edac_pci_sysfs.o
 endif
 
 obj-$(CONFIG_EDAC_GHES)			+= ghes_edac.o
-obj-$(CONFIG_EDAC_MCE_INJ)		+= mce_amd_inj.o
 
 edac_mce_amd-y				:= mce_amd.o
 obj-$(CONFIG_EDAC_DECODE_MCE)		+= edac_mce_amd.o
drivers/ras/Kconfig +35 -2
index f9da613052c2..4c3c67d13254 100644
@@ -1,2 +1,35 @@
-config RAS
-	bool
+menuconfig RAS
+	bool "Reliability, Availability and Serviceability (RAS) features"
+	help
+	  Reliability, availability and serviceability (RAS) is a computer
+	  hardware engineering term. Computers designed with higher levels
+	  of RAS have a multitude of features that protect data integrity
+	  and help them stay available for long periods of time without
+	  failure.
+
+	  Reliability can be defined as the probability that the system will
+	  produce correct outputs up to some given time. Reliability is
+	  enhanced by features that help to avoid, detect and repair hardware
+	  faults.
+
+	  Availability is the probability a system is operational at a given
+	  time, i.e. the amount of time a device is actually operating as the
+	  percentage of total time it should be operating.
+
+	  Serviceability or maintainability is the simplicity and speed with
+	  which a system can be repaired or maintained; if the time to repair
+	  a failed system increases, then availability will decrease.
+
+	  Note that Reliability and Availability are distinct concepts:
+	  Reliability is a measure of the ability of a system to function
+	  correctly, including avoiding data corruption, whereas Availability
+	  measures how often it is available for use, even though it may not
+	  be functioning correctly. For example, a server may run forever and
+	  so have ideal availability, but may be unreliable, with frequent
+	  data corruption.
+
+if RAS
+
+source arch/x86/ras/Kconfig
+
+endif
#1 lore raw

Hi Ingo,

drivers/ras/Kconfig line 2

Quoted 7 lines · Ingo Molnar
drivers/ras/Kconfig +2 -2
@@ -1,2 +1,35 @@
-config RAS
-       bool
+menuconfig RAS
+       bool "Reliability, Availability and Serviceability (RAS) features"

Do you think it would make sense to add

        depends on X86 || COMPILE_TEST

to hide the option on unsupported systems?

drivers/ras/Kconfig line 3

Quoted 1 line
drivers/ras/Kconfig +1 -0
+       help

[ delete help text ]

drivers/ras/Kconfig line 35

Quoted 5 lines
drivers/ras/Kconfig +5 -0
+if RAS
+
+source arch/x86/ras/Kconfig
+
+endif

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#2 lore raw
Quoted 13 lines · Geert Uytterhoeven

Hi Ingo,

drivers/ras/Kconfig line 2

Quoted 7 lines · Ingo Molnar
drivers/ras/Kconfig +2 -2
@@ -1,2 +1,35 @@
-config RAS
-       bool
+menuconfig RAS
+       bool "Reliability, Availability and Serviceability (RAS) features"

Do you think it would make sense to add

Quoted 3 lines
        depends on X86 || COMPILE_TEST

to hide the option on unsupported systems?

Either that or maybe have X86 select CONFIG_RAS...?

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
maintainer
#3 lore raw

PATCH 1/1 RAS: Show Kconfig menu only on supported architectures

From: Borislav Petkov <[email protected]>
Date: Tue, 13 Oct 2015 20:18:45 +0200
Subject: [PATCH] RAS: Show Kconfig menu only on supported architectures

Make it depend on only those architectures which provide APIs to RAS features so that it remains invisible on the remaining ones.

---
 drivers/ras/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/ras/Kconfig +1 -0
index 4c3c67d13254..46021e15a6a6 100644
@@ -1,5 +1,6 @@
 menuconfig RAS
 	bool "Reliability, Availability and Serviceability (RAS) features"
+	depends on X86 || COMPILE_TEST
 	help
 	  Reliability, availability and serviceability (RAS) is a computer
 	  hardware engineering term. Computers designed with higher levels
Signature · 8 lines
2.3.5


-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
#4 lore raw

Re: [PATCH] RAS: Show Kconfig menu only on supported architectures

reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Borislav,

[auto build test WARNING on linus/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Borislav-Petkov/RAS-Show-Kconfig-menu-only-on-supported-architectures/20151014-022534
config: tile-tilegx_defconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile

All warnings (new ones prefixed by >>):

warning: (MEMORY_FAILURE && PCIEAER && EDAC_MM_EDAC) selects RAS which has unmet direct dependencies (X86 || COMPILE_TEST)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#5 lore raw

Re: [PATCH] RAS: Show Kconfig menu only on supported architectures

In reply to Borislav Petkov
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Borislav,

[auto build test WARNING on linus/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Borislav-Petkov/RAS-Show-Kconfig-menu-only-on-supported-architectures/20151014-022534
config: arm-spear13xx_defconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All warnings (new ones prefixed by >>):

warning: (PCIEAER && MEMORY_FAILURE && EDAC_MM_EDAC) selects RAS which has unmet direct dependencies (X86 || COMPILE_TEST)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw

Re: [PATCH] RAS: Show Kconfig menu only on supported architectures

In reply to Borislav Petkov
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Borislav,

[auto build test WARNING on linus/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Borislav-Petkov/RAS-Show-Kconfig-menu-only-on-supported-architectures/20151014-022534
config: arm64-defconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64

All warnings (new ones prefixed by >>):

warning: (PCIEAER && MEMORY_FAILURE && EDAC_MM_EDAC && ACPI_EXTLOG) selects RAS which has unmet direct dependencies (X86 || COMPILE_TEST)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation