Skip to contentSkip to conversation

x86/ras changes for v3.17

GIT PULL Ingo Molnar 1 participant 1 message Aug 4, 2014

Subsystems (8)
x86 ACPI PCI Tracing +4 more subsystems
lore
Share & tools
lore
#0 lore raw

Linus,

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

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

# HEAD: c3107e3c504d3187ed8eac8179494946faff1481 Merge tag 'please-pull-apei' into x86/ras

The main changes in this cycle are:

* RAS tracing/events infrastructure, by Gong Chen.

* Various generalizations of the APEI code to make it available to non-x86 architectures, by Tomasz Nowicki.

out-of-topic modifications in x86-ras-for-linus:
--------------------------------------------------

  drivers/Kconfig                    # 76ac827: trace, RAS: Add basic RAS trace e
  drivers/Makefile                   # 76ac827: trace, RAS: Add basic RAS trace e
  drivers/acpi/Kconfig               # 2dfb7d5: trace, RAS: Add eMCA trace event 
  drivers/acpi/acpi_extlog.c         # 7c76bb5: RAS, extlog: Adjust init flow
                                   # d6cae93: trace, eMCA: Add a knob to adjust
                                   # 2dfb7d5: trace, RAS: Add eMCA trace event 
  drivers/acpi/apei/Kconfig          # 44a69f6: acpi, apei, ghes: Make NMI error 
  drivers/acpi/apei/apei-base.c      # 9dae3d0: apei, mce: Factor out APEI archit
  drivers/acpi/apei/ghes.c           # 594c725: acpi, apei, ghes: Factor out iore
                                   # 44a69f6: acpi, apei, ghes: Make NMI error 
                                   # 9dae3d0: apei, mce: Factor out APEI archit
  drivers/acpi/apei/hest.c           # 9dae3d0: apei, mce: Factor out APEI archit
  drivers/edac/Kconfig               # 76ac827: trace, RAS: Add basic RAS trace e
  drivers/edac/edac_mc.c             # 76ac827: trace, RAS: Add basic RAS trace e
  drivers/firmware/efi/cper.c        # 2dfb7d5: trace, RAS: Add eMCA trace event 
                                   # 3760cd2: CPER: Adjust code flow of some fu
  drivers/pci/pcie/aer/Kconfig       # 0a2409a: trace, AER: Move trace into unifi
  drivers/pci/pcie/aer/aerdrv_errprint.c# 0a2409a: trace, AER: Move trace into unifi
  drivers/ras/Kconfig                # 76ac827: trace, RAS: Add basic RAS trace e
  drivers/ras/Makefile               # d963cd9: RAS, debugfs: Add debugfs interfa
                                   # 76ac827: trace, RAS: Add basic RAS trace e
  drivers/ras/debugfs.c              # d963cd9: RAS, debugfs: Add debugfs interfa
  drivers/ras/ras.c                  # 2dfb7d5: trace, RAS: Add eMCA trace event 
                                   # d963cd9: RAS, debugfs: Add debugfs interfa
                                   # 76ac827: trace, RAS: Add basic RAS trace e
  include/acpi/apei.h                # 594c725: acpi, apei, ghes: Factor out iore
                                   # 9dae3d0: apei, mce: Factor out APEI archit
  include/linux/aer.h                # 5ccb822: x86/ras: Fix build warnings in <l
  include/linux/cper.h               # 2dfb7d5: trace, RAS: Add eMCA trace event 
                                   # 3760cd2: CPER: Adjust code flow of some fu
  include/linux/nmi.h                # 44a69f6: acpi, apei, ghes: Make NMI error 
  include/linux/ras.h                # d963cd9: RAS, debugfs: Add debugfs interfa
  include/ras/ras_event.h            # 2dfb7d5: trace, RAS: Add eMCA trace event 

# 0a2409a: trace, AER: Move trace into unifi
include/trace/events/ras.h # 0a2409a: trace, AER: Move trace into unifi

Thanks,

Ingo

------------------>
Borislav Petkov (2):
x86, MCE: Kill CPU_POST_DEAD
x86, MCE: Robustify mcheck_init_device

Chen, Gong (7):
trace, RAS: Add basic RAS trace event
trace, AER: Move trace into unified interface
CPER: Adjust code flow of some functions
RAS, debugfs: Add debugfs interface for RAS subsystem trace, RAS: Add eMCA trace event interface trace, eMCA: Add a knob to adjust where to save event log RAS, extlog: Adjust init flow

Mike Qiu (1):
x86/ras: Fix build warnings in <linux/aer.h>

Tomasz Nowicki (3):
apei, mce: Factor out APEI architecture specific MCE calls.
acpi, apei, ghes: Make NMI error notification to be GHES architecture extension. acpi, apei, ghes: Factor out ioremap virtual memory for IRQ and NMI context.

 arch/x86/Kconfig                       |   2 +
 arch/x86/kernel/acpi/Makefile          |   1 +
 arch/x86/kernel/acpi/apei.c            |  62 +++++++++++
 arch/x86/kernel/cpu/mcheck/mce.c       |  19 ++--
 drivers/Kconfig                        |   2 +
 drivers/Makefile                       |   1 +
 drivers/acpi/Kconfig                   |   4 +-
 drivers/acpi/acpi_extlog.c             |  46 ++++++--
 drivers/acpi/apei/Kconfig              |   8 +-
 drivers/acpi/apei/apei-base.c          |  13 +++
 drivers/acpi/apei/ghes.c               | 173 ++++++++++++++++++-----------
 drivers/acpi/apei/hest.c               |  29 +----
 drivers/edac/Kconfig                   |   1 +
 drivers/edac/edac_mc.c                 |   3 -
 drivers/firmware/efi/cper.c            | 192 +++++++++++++++++++++++----------
 drivers/pci/pcie/aer/Kconfig           |   1 +
 drivers/pci/pcie/aer/aerdrv_errprint.c |   4 +-
 drivers/ras/Kconfig                    |   2 +
 drivers/ras/Makefile                   |   1 +
 drivers/ras/debugfs.c                  |  56 ++++++++++
 drivers/ras/ras.c                      |  29 +++++
 include/acpi/apei.h                    |   4 +
 include/linux/aer.h                    |   2 +
 include/linux/cper.h                   |  32 ++++++
 include/linux/nmi.h                    |   4 +
 include/linux/ras.h                    |  14 +++
 include/ras/ras_event.h                | 128 ++++++++++++++++++++++
 include/trace/events/ras.h             |  77 -------------
 28 files changed, 659 insertions(+), 251 deletions(-)
 create mode 100644 arch/x86/kernel/acpi/apei.c
 create mode 100644 drivers/ras/Kconfig
 create mode 100644 drivers/ras/Makefile
 create mode 100644 drivers/ras/debugfs.c
 create mode 100644 drivers/ras/ras.c
 create mode 100644 include/linux/ras.h
 delete mode 100644 include/trace/events/ras.h
arch/x86/Kconfig +2 -0
index d24887b..4387344 100644
@@ -132,6 +132,8 @@ config X86
 	select GENERIC_CPU_AUTOPROBE
 	select HAVE_ARCH_AUDITSYSCALL
 	select ARCH_SUPPORTS_ATOMIC_RMW
+	select HAVE_ACPI_APEI if ACPI
+	select HAVE_ACPI_APEI_NMI if ACPI
 
 config INSTRUCTION_DECODER
 	def_bool y
arch/x86/kernel/acpi/Makefile +1 -0
index 163b225..3242e59 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_ACPI)		+= boot.o
 obj-$(CONFIG_ACPI_SLEEP)	+= sleep.o wakeup_$(BITS).o
+obj-$(CONFIG_ACPI_APEI)		+= apei.o
 
 ifneq ($(CONFIG_ACPI_PROCESSOR),)
 obj-y				+= cstate.o
arch/x86/kernel/acpi/apei.c new file +62 -0

62 lines not on this page · raw message

arch/x86/kernel/cpu/mcheck/mce.c +10 -9
index bb92f38..4fc5797 100644
@@ -2385,6 +2385,10 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
 			threshold_cpu_callback(action, cpu);
 		mce_device_remove(cpu);
 		mce_intel_hcpu_update(cpu);
+
+		/* intentionally ignoring frozen here */
+		if (!(action & CPU_TASKS_FROZEN))
+			cmci_rediscover();
 		break;
 	case CPU_DOWN_PREPARE:
 		smp_call_function_single(cpu, mce_disable_cpu, &action, 1);
@@ -2396,11 +2400,6 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
 		break;
 	}
 
-	if (action == CPU_POST_DEAD) {
-		/* intentionally ignoring frozen here */
-		cmci_rediscover();
-	}
-
 	return NOTIFY_OK;
 }
 
@@ -2451,6 +2450,12 @@ static __init int mcheck_init_device(void)
 	for_each_online_cpu(i) {
 		err = mce_device_create(i);
 		if (err) {
+			/*
+			 * Register notifier anyway (and do not unreg it) so
+			 * that we don't leave undeleted timers, see notifier
+			 * callback above.
+			 */
+			__register_hotcpu_notifier(&mce_cpu_notifier);
 			cpu_notifier_register_done();
 			goto err_device_create;
 		}
@@ -2471,10 +2476,6 @@ static __init int mcheck_init_device(void)
 err_register:
 	unregister_syscore_ops(&mce_syscore_ops);
 
-	cpu_notifier_register_begin();
-	__unregister_hotcpu_notifier(&mce_cpu_notifier);
-	cpu_notifier_register_done();
-
 err_device_create:
 	/*
 	 * We didn't keep track of which devices were created above, but
drivers/Kconfig +2 -0
index 0e87a34..4e6e66c 100644
@@ -176,4 +176,6 @@ source "drivers/powercap/Kconfig"
 
 source "drivers/mcb/Kconfig"
 
+source "drivers/ras/Kconfig"
+
 endmenu
drivers/Makefile +1 -0
index f98b50d..65c32b1 100644
@@ -158,3 +158,4 @@ obj-$(CONFIG_NTB)		+= ntb/
 obj-$(CONFIG_FMC)		+= fmc/
 obj-$(CONFIG_POWERCAP)		+= powercap/
 obj-$(CONFIG_MCB)		+= mcb/
+obj-$(CONFIG_RAS)		+= ras/
drivers/acpi/Kconfig +3 -1
index a34a228..206942b 100644
@@ -370,6 +370,7 @@ config ACPI_EXTLOG
 	tristate "Extended Error Log support"
 	depends on X86_MCE && X86_LOCAL_APIC
 	select UEFI_CPER
+	select RAS
 	default n
 	help
 	  Certain usages such as Predictive Failure Analysis (PFA) require
@@ -384,6 +385,7 @@ config ACPI_EXTLOG
 
 	  Enhanced MCA Logging allows firmware to provide additional error
 	  information to system software, synchronous with MCE or CMCI. This
-	  driver adds support for that functionality.
+	  driver adds support for that functionality with corresponding
+	  tracepoint which carries that information to userspace.
 
 endif	# ACPI
drivers/acpi/acpi_extlog.c +35 -11

80 lines not on this page · raw message

drivers/acpi/apei/Kconfig +7 -1
index c4dac71..b0140c8 100644
@@ -1,9 +1,15 @@
+config HAVE_ACPI_APEI
+	bool
+
+config HAVE_ACPI_APEI_NMI
+	bool
+
 config ACPI_APEI
 	bool "ACPI Platform Error Interface (APEI)"
 	select MISC_FILESYSTEMS
 	select PSTORE
 	select UEFI_CPER
-	depends on X86
+	depends on HAVE_ACPI_APEI
 	help
 	  APEI allows to report errors (for example from the chipset)
 	  to the operating system. This improves NMI handling
drivers/acpi/apei/apei-base.c +13 -0
index 8678dfe..2cd7bdd 100644
@@ -745,6 +745,19 @@ struct dentry *apei_get_debugfs_dir(void)
 }
 EXPORT_SYMBOL_GPL(apei_get_debugfs_dir);
 
+int __weak arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr,
+				  void *data)
+{
+	return 1;
+}
+EXPORT_SYMBOL_GPL(arch_apei_enable_cmcff);
+
+void __weak arch_apei_report_mem_error(int sev,
+				       struct cper_sec_mem_err *mem_err)
+{
+}
+EXPORT_SYMBOL_GPL(arch_apei_report_mem_error);
+
 int apei_osc_setup(void)
 {
 	static u8 whea_uuid_str[] = "ed855e0c-6c90-47bf-a62a-26de0fc5ad5c";
drivers/acpi/apei/ghes.c +110 -63

289 lines not on this page · raw message

drivers/acpi/apei/hest.c +1 -28
index f5e37f3..06e9b41 100644
@@ -36,7 +36,6 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 #include <acpi/apei.h>
-#include <asm/mce.h>
 
 #include "apei-internal.h"
 
@@ -128,33 +127,7 @@ EXPORT_SYMBOL_GPL(apei_hest_parse);
  */
 static int __init hest_parse_cmc(struct acpi_hest_header *hest_hdr, void *data)
 {
-#ifdef CONFIG_X86_MCE
-	int i;
-	struct acpi_hest_ia_corrected *cmc;
-	struct acpi_hest_ia_error_bank *mc_bank;
-
-	if (hest_hdr->type != ACPI_HEST_TYPE_IA32_CORRECTED_CHECK)
-		return 0;
-
-	cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
-	if (!cmc->enabled)
-		return 0;
-
-	/*
-	 * We expect HEST to provide a list of MC banks that report errors
-	 * in firmware first mode. Otherwise, return non-zero value to
-	 * indicate that we are done parsing HEST.
-	 */
-	if (!(cmc->flags & ACPI_HEST_FIRMWARE_FIRST) || !cmc->num_hardware_banks)
-		return 1;
-
-	pr_info(HEST_PFX "Enabling Firmware First mode for corrected errors.\n");
-
-	mc_bank = (struct acpi_hest_ia_error_bank *)(cmc + 1);
-	for (i = 0; i < cmc->num_hardware_banks; i++, mc_bank++)
-		mce_disable_bank(mc_bank->bank_number);
-#endif
-	return 1;
+	return arch_apei_enable_cmcff(hest_hdr, data);
 }
 
 struct ghes_arr {
drivers/edac/Kconfig +1 -0
index 878f090..d3c0465 100644
@@ -72,6 +72,7 @@ config EDAC_MCE_INJ
 
 config EDAC_MM_EDAC
 	tristate "Main Memory EDAC (Error Detection And Correction) reporting"
+	select RAS
 	help
 	  Some systems are able to detect and correct errors in main
 	  memory.  EDAC can report statistics on memory error
drivers/edac/edac_mc.c +0 -3
index 2c694b5..9f134823 100644
@@ -33,9 +33,6 @@
 #include <asm/edac.h>
 #include "edac_core.h"
 #include "edac_module.h"
-
-#define CREATE_TRACE_POINTS
-#define TRACE_INCLUDE_PATH ../../include/ras
 #include <ras/ras_event.h>
 
 /* lock to memory controller's control array */
drivers/firmware/efi/cper.c +137 -55

292 lines not on this page · raw message

drivers/pci/pcie/aer/Kconfig +1 -0
index 50e94e0..3894402 100644
@@ -5,6 +5,7 @@
 config PCIEAER
 	boolean "Root Port Advanced Error Reporting support"
 	depends on PCIEPORTBUS
+	select RAS
 	default y
 	help
 	  This enables PCI Express Root Port Advanced Error Reporting
drivers/pci/pcie/aer/aerdrv_errprint.c +1 -3
index 36ed31b5..35d06e1 100644
@@ -22,9 +22,7 @@
 #include <linux/cper.h>
 
 #include "aerdrv.h"
-
-#define CREATE_TRACE_POINTS
-#include <trace/events/ras.h>
+#include <ras/ras_event.h>
 
 #define AER_AGENT_RECEIVER		0
 #define AER_AGENT_REQUESTER		1
drivers/ras/Kconfig new file +2 -0
new file mode 100644
index 0000000..f9da613
@@ -0,0 +1,2 @@
+config RAS
+	bool
drivers/ras/Makefile new file +1 -0
new file mode 100644
index 0000000..d7f7334
@@ -0,0 +1 @@
+obj-$(CONFIG_RAS) += ras.o debugfs.o
drivers/ras/debugfs.c new file +56 -0

56 lines not on this page · raw message

drivers/ras/ras.c new file +29 -0
new file mode 100644
index 0000000..b67dd36
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 Intel Corporation
+ *
+ * Authors:
+ *	Chen, Gong <[email protected]>
+ */
+
+#include <linux/init.h>
+#include <linux/ras.h>
+
+#define CREATE_TRACE_POINTS
+#define TRACE_INCLUDE_PATH ../../include/ras
+#include <ras/ras_event.h>
+
+static int __init ras_init(void)
+{
+	int rc = 0;
+
+	ras_debugfs_init();
+	rc = ras_add_daemon_trace();
+
+	return rc;
+}
+subsys_initcall(ras_init);
+
+#if defined(CONFIG_ACPI_EXTLOG) || defined(CONFIG_ACPI_EXTLOG_MODULE)
+EXPORT_TRACEPOINT_SYMBOL_GPL(extlog_mem_event);
+#endif
+EXPORT_TRACEPOINT_SYMBOL_GPL(mc_event);
include/acpi/apei.h +4 -0
index 04f349d..76284bb 100644
@@ -42,5 +42,9 @@ ssize_t erst_read(u64 record_id, struct cper_record_header *record,
 		  size_t buflen);
 int erst_clear(u64 record_id);
 
+int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data);
+void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err);
+void arch_apei_flush_tlb_one(unsigned long addr);
+
 #endif
 #endif
include/linux/aer.h +2 -0
index 4dbaa70..c826d1c 100644
@@ -11,6 +11,8 @@
 #define AER_FATAL			1
 #define AER_CORRECTABLE			2
 
+struct pci_dev;
+
 struct aer_header_log_regs {
 	unsigned int dw0;
 	unsigned int dw1;
include/linux/cper.h +32 -0
index 2fc0ec3..76abba4 100644
@@ -22,6 +22,7 @@
 #define LINUX_CPER_H
 
 #include <linux/uuid.h>
+#include <linux/trace_seq.h>
 
 /* CPER record signature and the size */
 #define CPER_SIG_RECORD				"CPER"
@@ -36,6 +37,13 @@
 #define CPER_RECORD_REV				0x0100
 
 /*
+ * CPER record length contains the CPER fields which are relevant for further
+ * handling of a memory error in userspace (we don't carry all the fields
+ * defined in the UEFI spec because some of them don't make any sense.)
+ * Currently, a length of 256 should be more than enough.
+ */
+#define CPER_REC_LEN					256
+/*
  * Severity difinition for error_severity in struct cper_record_header
  * and section_severity in struct cper_section_descriptor
  */
@@ -356,6 +364,24 @@ struct cper_sec_mem_err {
 	__u16	mem_dev_handle;		/* module handle in UEFI 2.4 */
 };
 
+struct cper_mem_err_compact {
+	__u64	validation_bits;
+	__u16	node;
+	__u16	card;
+	__u16	module;
+	__u16	bank;
+	__u16	device;
+	__u16	row;
+	__u16	column;
+	__u16	bit_pos;
+	__u64	requestor_id;
+	__u64	responder_id;
+	__u64	target_id;
+	__u16	rank;
+	__u16	mem_array_handle;
+	__u16	mem_dev_handle;
+};
+
 struct cper_sec_pcie {
 	__u64		validation_bits;
 	__u32		port_type;
@@ -395,7 +421,13 @@ struct cper_sec_pcie {
 #pragma pack()
 
 u64 cper_next_record_id(void);
+const char *cper_severity_str(unsigned int);
+const char *cper_mem_err_type_str(unsigned int);
 void cper_print_bits(const char *prefix, unsigned int bits,
 		     const char * const strs[], unsigned int strs_size);
+void cper_mem_err_pack(const struct cper_sec_mem_err *,
+		       struct cper_mem_err_compact *);
+const char *cper_mem_err_unpack(struct trace_seq *,
+				struct cper_mem_err_compact *);
 
 #endif
include/linux/nmi.h +4 -0
index 447775e..1d2a6ab 100644
@@ -63,4 +63,8 @@ extern int proc_dowatchdog(struct ctl_table *, int ,
 			   void __user *, size_t *, loff_t *);
 #endif
 
+#ifdef CONFIG_HAVE_ACPI_APEI_NMI
+#include <asm/nmi.h>
+#endif
+
 #endif
include/linux/ras.h new file +14 -0
new file mode 100644
index 0000000..2aceeaf
@@ -0,0 +1,14 @@
+#ifndef __RAS_H__
+#define __RAS_H__
+
+#ifdef CONFIG_DEBUG_FS
+int ras_userspace_consumers(void);
+void ras_debugfs_init(void);
+int ras_add_daemon_trace(void);
+#else
+static inline int ras_userspace_consumers(void) { return 0; }
+static inline void ras_debugfs_init(void) { return; }
+static inline int ras_add_daemon_trace(void) { return 0; }
+#endif
+
+#endif
include/ras/ras_event.h +128 -0

140 lines not on this page · raw message

include/trace/events/ras.h deleted +0 -77

77 lines not on this page · raw message