CPER: Add Memory Error Section 2 support
Subsystems (6)
v5 cover CPER: Add Memory Error Section 2 support
The CPER Memory Error Section allows to report memory related hardware errors. To support:
- up to 64GiB DIMMs
- DDR4 (bank group and address) and stacked 3DS technology (Chip ID) the record was introduced a short-term solution:
- Validation Bit18 "Extended Row Bit 16 and 17 Valid"
- an "Extend" field at offset 73.
and a long term solution: a new CPER Memory Error Section 2 record. The new CPER record was introduced in UEFI 2.5 spec release (February, 2015).
This patchset aims to add support for this record for existing/future platforms that might/will use it.
The support is mostly duplicated from Memory Error Section handling. Other than differences coming from the content of Memory Error Section 1 and 2, differences in the support are:
- v2 do not rely on a compact "struct cper_mem_err_compact" struct. This structure was used to support older versions of the Memory Error Section (1). This is not needed for the new structure.
- The compact version is also used by the tracing framework. To avoid relying and propagating a non-standard record format, through trace event (cf. extlog_mem event) the new trace event prints each field individually.
The last patch of the serie was only build-tested due to the absence of relevant hardware. apei_mce_report_mem_error() and arch_apei_report_mem_error() implementations were also removed since last version.
It will also require a proper handling from the rasdaemon. Applying this last patch without rasdaemon support will silent the reports of Memory Error Section 2 error, cf. ras_userspace_consumers() check.
Future:
- _OSC support (if agreed)
- Addition of arm64 tracepoints
https://lore.kernel.org/lkml/[email protected]/
- Emission of lossy CPER Mem error v1 tracepoints for legacy userspace tools
https://lore.kernel.org/lkml/[email protected]/
RFC: https://lore.kernel.org/all/[email protected]/#t V1: https://lore.kernel.org/all/[email protected]/
- Corrections from Jonathan's review
- New patch:
[PATCH v2 4/6] EDAC/ghes: Extract error report initialization
- Last patch not in RFC as it has been reviewed by Jonathan@ [PATCH v2 6/6] ACPI: extlog: add Memory Error Section 2 trace event
V2:
- Updated ghes_edac_init_error() to ghes_edac_init_error_desc(), which now only acts on the input "struct edac_raw_error_desc"
+ added lockdep_assert_held() to ghes_edac_init_error_desc()
- Accumulate failures with "queued |=" in ghes_do_proc()
- New PATCH:
[PATCH v3 5/7] ACPI: APEI: Extract common memory failure handling
V3:
- Added <linux/bits.h> include
- Used pr_warn_rate_limited()
- Removed one warn for smbios handle overflow
- Replaced __string() -> __string_len() in trace event
Added patch to us scnprintf():
- cper: Return actual bytes written by DIMM location helpers Added patches to increase buffer size and prevent overflows:
- EDAC/ghes: Small buffer fixes for mem other_detail helpers
- efi/cper: Pass buffer length to memory location helpers
- efi/cper: Pass buffer length to DIMM location helpers
V4:
- Re-order patches + split patches following the suggestion at:
https://lore-kernel.gnuweeb.org/linux-edac/20261124151417.GB2156781%40yaz-khff2.amd.com/
- Update of the commit message following the new split.
- No code changes once the serie is applied.
Pierre Gondois (13):
efi/cper: Prevent buffer overflows in cper_dimm_err_location() efi/cper: Prevent buffer overflows in cper_mem_err_location() EDAC/ghes: Rationalize buffer usage in for mem other_detail helper efi/cper: Use BIT_ULL() for processor and memory validation bits EDAC/ghes: Extract error report initialization
ACPI: APEI: Extract common memory failure handling efi/cper: Add Memory Error Section 2 structures efi/cper: Increase memory error record buffer size efi/cper: Add helpers to handle Memory Error Section 2
ACPI: APEI: Handle Memory Error Section 2 records in GHES EDAC/ghes: Increase memory error location and detail buffers EDAC/ghes: Handle Memory Error Section 2 records
ACPI: extlog: Add Memory Error Section 2 trace event
drivers/acpi/acpi_extlog.c | 6 + drivers/acpi/apei/ghes.c | 58 ++++++++-- drivers/edac/ghes_edac.c | 211 ++++++++++++++++++++++++++++-------- drivers/firmware/efi/cper.c | 137 ++++++++++++++++++++--- drivers/ras/ras.c | 1 + include/acpi/ghes.h | 2 + include/linux/cper.h | 138 ++++++++++++++++------- include/linux/edac.h | 2 +- include/ras/ras_event.h | 102 +++++++++++++++++ 9 files changed, 548 insertions(+), 109 deletions(-)
--
2.43.0
PATCH v5 1/13 efi/cper: Prevent buffer overflows in cper_dimm_err_location()
Buffer overflows/truncated messages might happen in cper_dimm_err_location(). To prevent them, add a length parameter to cper_dimm_err_location() and use scnprintf() instead of snprintf() to return the actual chars written to the buffer.
--- drivers/edac/ghes_edac.c | 9 ++++++--- drivers/firmware/efi/cper.c | 19 +++++++++---------- include/linux/cper.h | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-)
drivers/edac/ghes_edac.c +6 -3
@@ -276,6 +276,7 @@ static int ghes_edac_report_mem_error(struct notifier_block *nb,struct mem_ctl_info *mci;unsigned long sev = val;struct ghes_pvt *pvt; +size_t len;unsigned long flags;char *p;
@@ -347,21 +348,23 @@ static int ghes_edac_report_mem_error(struct notifier_block *nb, e->grain = ~mem_err->physical_addr_mask +1 ;/* Memory error location, mapped on e->location */ - p = e->location;cper_mem_err_pack (mem_err, &cmem); + + len =sizeof (e->location); + p = e->location; p +=cper_mem_err_location (&cmem, p);if (mem_err->validation_bits &CPER_MEM_VALID_MODULE_HANDLE ) {struct dimm_info *dimm; - p +=cper_dimm_err_location (&cmem, p); + p +=cper_dimm_err_location (&cmem, p, len - (p - e->location)); dimm =find_dimm_by_handle (mci, mem_err->mem_dev_handle);if (dimm) { e->top_layer = dimm->idx;strscpy (e->label, dimm->label); } } -if (p > e->location) +if (p > e->location && p[-1 ] ==' ' ) *(p -1 ) ='\0' ;if (!*e->label)
drivers/firmware/efi/cper.c +9 -10
@@ -353,22 +353,21 @@ int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg) }EXPORT_SYMBOL_GPL (cper_mem_err_location); -int cper_dimm_err_location (struct cper_mem_err_compact *mem,char *msg) +int cper_dimm_err_location (struct cper_mem_err_compact *mem,char *msg,size_t len) { -u32 len, n; +u32 n;const char *bank =NULL , *device =NULL ; -if (!msg || !(mem->validation_bits &CPER_MEM_VALID_MODULE_HANDLE )) +if (!msg || !len || !(mem->validation_bits &CPER_MEM_VALID_MODULE_HANDLE ))return 0 ; - len =CPER_REC_LEN ;dmi_memdev_name (mem->mem_dev_handle, &bank, &device);if (bank && device) - n =snprintf (msg, len,"DIMM location: %s %s " , bank, device); + n =scnprintf (msg, len,"DIMM location: %s %s " , bank, device);else - n =snprintf (msg, len, -"DIMM location: not present. DMI handle: 0x%.4x " , - mem->mem_dev_handle); + n =scnprintf (msg, len, +"DIMM location: not present. DMI handle: 0x%.4x " , + mem->mem_dev_handle);return n; }
@@ -422,7 +421,7 @@ const char *cper_mem_err_unpack(struct trace_seq *p,if (cper_mem_err_location (cmem, rcd_decode_str))trace_seq_printf (p,"%s" , rcd_decode_str); -if (cper_dimm_err_location (cmem, rcd_decode_str)) +if (cper_dimm_err_location (cmem, rcd_decode_str,sizeof (rcd_decode_str)))trace_seq_printf (p,"%s" , rcd_decode_str);trace_seq_putc (p,'\0' );
@@ -459,7 +458,7 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem,printk ("%s""error_type: %d, %s\n" , pfx, etype,cper_mem_err_type_str (etype)); } -if (cper_dimm_err_location (&cmem, rcd_decode_str)) +if (cper_dimm_err_location (&cmem, rcd_decode_str,sizeof (rcd_decode_str)))printk ("%s%s\n" , pfx, rcd_decode_str); }
include/linux/cper.h +1 -1
@@ -600,7 +600,7 @@ void cper_print_proc_arm(const char *pfx,void cper_print_proc_ia (const char *pfx,const struct cper_sec_proc_ia *proc);int cper_mem_err_location (struct cper_mem_err_compact *mem,char *msg); -int cper_dimm_err_location (struct cper_mem_err_compact *mem,char *msg); +int cper_dimm_err_location (struct cper_mem_err_compact *mem,char *msg,size_t len);struct acpi_hest_generic_status ; void cper_estatus_print(const char *pfx,
Signature · 1 line
2.43.0
PATCH v5 2/13 efi/cper: Prevent buffer overflows in cper_mem_err_location()
In reply to Pierre GondoisBuffer overflows/truncated messages might happen in cper_mem_err_location(). To prevent them, add a length parameter.
--- drivers/edac/ghes_edac.c | 2 +- drivers/firmware/efi/cper.c | 11 +++++------ include/linux/cper.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/edac/ghes_edac.c +1 -1
@@ -352,7 +352,7 @@ static int ghes_edac_report_mem_error(struct notifier_block *nb, len =sizeof (e->location); p = e->location; - p +=cper_mem_err_location (&cmem, p); + p +=cper_mem_err_location (&cmem, p, len);if (mem_err->validation_bits &CPER_MEM_VALID_MODULE_HANDLE ) {struct dimm_info *dimm;
drivers/firmware/efi/cper.c +5 -6
@@ -298,15 +298,14 @@ const char *cper_mem_err_status_str(u64 status) }EXPORT_SYMBOL_GPL (cper_mem_err_status_str); -int cper_mem_err_location (struct cper_mem_err_compact *mem,char *msg) +int cper_mem_err_location (struct cper_mem_err_compact *mem,char *msg,size_t len) { -u32 len, n; +u32 n; -if (!msg) +if (!msg || !len)return 0 ; n =0 ; - len =CPER_REC_LEN ;if (mem->validation_bits &CPER_MEM_VALID_NODE ) n +=scnprintf (msg + n, len - n,"node:%d " , mem->node);if (mem->validation_bits &CPER_MEM_VALID_CARD )
@@ -419,7 +418,7 @@ const char *cper_mem_err_unpack(struct trace_seq *p,const char *ret =trace_seq_buffer_ptr (p);char rcd_decode_str[CPER_REC_LEN ]; -if (cper_mem_err_location (cmem, rcd_decode_str)) +if (cper_mem_err_location (cmem, rcd_decode_str,sizeof (rcd_decode_str)))trace_seq_printf (p,"%s" , rcd_decode_str);if (cper_dimm_err_location (cmem, rcd_decode_str,sizeof (rcd_decode_str)))trace_seq_printf (p,"%s" , rcd_decode_str);
@@ -451,7 +450,7 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem,printk ("%s""physical_address_mask: 0x%016llx\n" , pfx, mem->physical_addr_mask);cper_mem_err_pack (mem, &cmem); -if (cper_mem_err_location (&cmem, rcd_decode_str)) +if (cper_mem_err_location (&cmem, rcd_decode_str,sizeof (rcd_decode_str)))printk ("%s%s\n" , pfx, rcd_decode_str);if (mem->validation_bits &CPER_MEM_VALID_ERROR_TYPE ) {u8 etype = mem->error_type;
include/linux/cper.h +1 -1
@@ -599,7 +599,7 @@ void cper_print_proc_arm(const char *pfx, u32 length);void cper_print_proc_ia (const char *pfx,const struct cper_sec_proc_ia *proc); -int cper_mem_err_location (struct cper_mem_err_compact *mem,char *msg); +int cper_mem_err_location (struct cper_mem_err_compact *mem,char *msg,size_t len);int cper_dimm_err_location (struct cper_mem_err_compact *mem,char *msg,size_t len);struct acpi_hest_generic_status ;
Signature · 1 line
2.43.0
PATCH v5 3/13 EDAC/ghes: Rationalize buffer usage in for mem other_detail helper
In reply to Pierre Gondoisscnprintf() already reserves space for the terminating NULL, leaving one byte unused and under-flowing the capacity when len=0. Callers also remove the last character unconditionally, which can discard valid text after truncation.
Update print_mem_error_other_detail() to fix the above issues.
--- drivers/edac/ghes_edac.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/edac/ghes_edac.c +4 -5
@@ -243,15 +243,14 @@ static void ghes_scan_system(void) }static int print_mem_error_other_detail (const struct cper_sec_mem_err *mem,char *msg, -const char *location,unsigned int len) +const char *location,size_t len) {u32 n; -if (!msg) +if (!msg || !len)return 0 ; n =0 ; - len -=1 ; n +=scnprintf (msg + n, len - n,"APEI location: %s " , location);
@@ -372,8 +371,8 @@ static int ghes_edac_report_mem_error(struct notifier_block *nb,/* All other fields are mapped on e->other_detail */ p = pvt->other_detail; - p +=print_mem_error_other_detail (mem_err, p, e->location,OTHER_DETAIL_LEN ); -if (p > pvt->other_detail) + p +=print_mem_error_other_detail (mem_err, p, e->location,sizeof (pvt->other_detail)); +if (p > pvt->other_detail && p[-1 ] ==' ' ) *(p -1 ) ='\0' ;edac_raw_mc_handle_error (e);
Signature · 1 line
2.43.0
PATCH v5 4/13 efi/cper: Use BIT_ULL() for processor and memory validation bits
In reply to Pierre GondoisUse the BIT_ULL() macro to describe flag bits instead of hexadecimal values which are harder to read.
--- include/linux/cper.h | 73 ++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 36 deletions(-)
include/linux/cper.h +37 -36
@@ -9,6 +9,7 @@#ifndef LINUX_CPER_H #define LINUX_CPER_H +#include <linux/bits.h> #include <linux/uuid.h> #include <linux/trace_seq.h>
@@ -225,42 +226,42 @@ enum {GUID_INIT (0x036F84E1 ,0x7F37 ,0x428c ,0xA7 ,0x9E ,0x57 ,0x5F , \ 0xDF, 0xAA, 0x84, 0xEC) -#define CPER_PROC_VALID_TYPE 0x0001 -#define CPER_PROC_VALID_ISA 0x0002 -#define CPER_PROC_VALID_ERROR_TYPE 0x0004 -#define CPER_PROC_VALID_OPERATION 0x0008 -#define CPER_PROC_VALID_FLAGS 0x0010 -#define CPER_PROC_VALID_LEVEL 0x0020 -#define CPER_PROC_VALID_VERSION 0x0040 -#define CPER_PROC_VALID_BRAND_INFO 0x0080 -#define CPER_PROC_VALID_ID 0x0100 -#define CPER_PROC_VALID_TARGET_ADDRESS 0x0200 -#define CPER_PROC_VALID_REQUESTOR_ID 0x0400 -#define CPER_PROC_VALID_RESPONDER_ID 0x0800 -#define CPER_PROC_VALID_IP 0x1000 - -#define CPER_MEM_VALID_ERROR_STATUS 0x0001 -#define CPER_MEM_VALID_PA 0x0002 -#define CPER_MEM_VALID_PA_MASK 0x0004 -#define CPER_MEM_VALID_NODE 0x0008 -#define CPER_MEM_VALID_CARD 0x0010 -#define CPER_MEM_VALID_MODULE 0x0020 -#define CPER_MEM_VALID_BANK 0x0040 -#define CPER_MEM_VALID_DEVICE 0x0080 -#define CPER_MEM_VALID_ROW 0x0100 -#define CPER_MEM_VALID_COLUMN 0x0200 -#define CPER_MEM_VALID_BIT_POSITION 0x0400 -#define CPER_MEM_VALID_REQUESTOR_ID 0x0800 -#define CPER_MEM_VALID_RESPONDER_ID 0x1000 -#define CPER_MEM_VALID_TARGET_ID 0x2000 -#define CPER_MEM_VALID_ERROR_TYPE 0x4000 -#define CPER_MEM_VALID_RANK_NUMBER 0x8000 -#define CPER_MEM_VALID_CARD_HANDLE 0x10000 -#define CPER_MEM_VALID_MODULE_HANDLE 0x20000 -#define CPER_MEM_VALID_ROW_EXT 0x40000 -#define CPER_MEM_VALID_BANK_GROUP 0x80000 -#define CPER_MEM_VALID_BANK_ADDRESS 0x100000 -#define CPER_MEM_VALID_CHIP_ID 0x200000 +#define CPER_PROC_VALID_TYPE BIT_ULL(0) +#define CPER_PROC_VALID_ISA BIT_ULL(1) +#define CPER_PROC_VALID_ERROR_TYPE BIT_ULL(2) +#define CPER_PROC_VALID_OPERATION BIT_ULL(3) +#define CPER_PROC_VALID_FLAGS BIT_ULL(4) +#define CPER_PROC_VALID_LEVEL BIT_ULL(5) +#define CPER_PROC_VALID_VERSION BIT_ULL(6) +#define CPER_PROC_VALID_BRAND_INFO BIT_ULL(7) +#define CPER_PROC_VALID_ID BIT_ULL(8) +#define CPER_PROC_VALID_TARGET_ADDRESS BIT_ULL(9) +#define CPER_PROC_VALID_REQUESTOR_ID BIT_ULL(10) +#define CPER_PROC_VALID_RESPONDER_ID BIT_ULL(11) +#define CPER_PROC_VALID_IP BIT_ULL(12) + +#define CPER_MEM_VALID_ERROR_STATUS BIT_ULL(0) +#define CPER_MEM_VALID_PA BIT_ULL(1) +#define CPER_MEM_VALID_PA_MASK BIT_ULL(2) +#define CPER_MEM_VALID_NODE BIT_ULL(3) +#define CPER_MEM_VALID_CARD BIT_ULL(4) +#define CPER_MEM_VALID_MODULE BIT_ULL(5) +#define CPER_MEM_VALID_BANK BIT_ULL(6) +#define CPER_MEM_VALID_DEVICE BIT_ULL(7) +#define CPER_MEM_VALID_ROW BIT_ULL(8) +#define CPER_MEM_VALID_COLUMN BIT_ULL(9) +#define CPER_MEM_VALID_BIT_POSITION BIT_ULL(10) +#define CPER_MEM_VALID_REQUESTOR_ID BIT_ULL(11) +#define CPER_MEM_VALID_RESPONDER_ID BIT_ULL(12) +#define CPER_MEM_VALID_TARGET_ID BIT_ULL(13) +#define CPER_MEM_VALID_ERROR_TYPE BIT_ULL(14) +#define CPER_MEM_VALID_RANK_NUMBER BIT_ULL(15) +#define CPER_MEM_VALID_CARD_HANDLE BIT_ULL(16) +#define CPER_MEM_VALID_MODULE_HANDLE BIT_ULL(17) +#define CPER_MEM_VALID_ROW_EXT BIT_ULL(18) +#define CPER_MEM_VALID_BANK_GROUP BIT_ULL(19) +#define CPER_MEM_VALID_BANK_ADDRESS BIT_ULL(20) +#define CPER_MEM_VALID_CHIP_ID BIT_ULL(21)#define CPER_MEM_EXT_ROW_MASK 0x3#define CPER_MEM_EXT_ROW_SHIFT 16
Signature · 1 line
2.43.0
PATCH v5 5/13 EDAC/ghes: Extract error report initialization
In reply to Pierre GondoisExtract a ghes_edac_init_error_desc() function to prepare for Memory Error Section 2 support (and re-usage).
Also use a guard in the caller ghes_edac_report_mem_error() function for code simplification.
--- drivers/edac/ghes_edac.c | 70 +++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 34 deletions(-)
drivers/edac/ghes_edac.c +36 -34
@@ -266,6 +266,39 @@ static int print_mem_error_other_detail(const struct cper_sec_mem_err *mem, charreturn n; } +static void ghes_edac_init_error_desc (struct edac_raw_error_desc *e, +unsigned long sev,char *msg,char *other_detail) +{ +lockdep_assert_held (&ghes_lock); + +/* Cleans the error report buffer */ +memset (e,0 ,sizeof (*e)); + e->error_count =1 ; + e->grain =1 ; + e->msg = msg; + e->other_detail = other_detail; + e->top_layer =-1 ; + e->mid_layer =-1 ; + e->low_layer =-1 ; + *msg ='\0' ; + *other_detail ='\0' ; + +switch (sev) { +case GHES_SEV_CORRECTED : + e->type =HW_EVENT_ERR_CORRECTED ; +break ; +case GHES_SEV_RECOVERABLE : + e->type =HW_EVENT_ERR_UNCORRECTED ; +break ; +case GHES_SEV_PANIC : + e->type =HW_EVENT_ERR_FATAL ; +break ; +default : +case GHES_SEV_NO : + e->type =HW_EVENT_ERR_INFO ; + } +} +static int ghes_edac_report_mem_error (struct notifier_block *nb,unsigned long val,void *data) {
@@ -273,10 +306,8 @@ static int ghes_edac_report_mem_error(struct notifier_block *nb,struct cper_mem_err_compact cmem;struct edac_raw_error_desc *e;struct mem_ctl_info *mci; -unsigned long sev = val;struct ghes_pvt *pvt;size_t len; -unsigned long flags;char *p;/*
@@ -287,41 +318,15 @@ static int ghes_edac_report_mem_error(struct notifier_block *nb,if (WARN_ON_ONCE (in_nmi ()))return NOTIFY_OK ; -spin_lock_irqsave (&ghes_lock, flags); +guard (spinlock_irqsave)(&ghes_lock); pvt = ghes_pvt;if (!pvt) - goto unlock; +return NOTIFY_OK ; mci = pvt->mci; e = &mci->error_desc; - -/* Cleans the error report buffer */ -memset (e,0 ,sizeof (*e)); - e->error_count =1 ; - e->grain =1 ; - e->msg = pvt->msg; - e->other_detail = pvt->other_detail; - e->top_layer =-1 ; - e->mid_layer =-1 ; - e->low_layer =-1 ; - *pvt->other_detail ='\0' ; - *pvt->msg ='\0' ; - -switch (sev) { -case GHES_SEV_CORRECTED : - e->type =HW_EVENT_ERR_CORRECTED ; -break ; -case GHES_SEV_RECOVERABLE : - e->type =HW_EVENT_ERR_UNCORRECTED ; -break ; -case GHES_SEV_PANIC : - e->type =HW_EVENT_ERR_FATAL ; -break ; -default : -case GHES_SEV_NO : - e->type =HW_EVENT_ERR_INFO ; - } +ghes_edac_init_error_desc (e, val, pvt->msg, pvt->other_detail);edac_dbg (1 ,"error validation_bits: 0x%08llx\n" , (long long )mem_err->validation_bits);
@@ -377,9 +382,6 @@ static int ghes_edac_report_mem_error(struct notifier_block *nb,edac_raw_mc_handle_error (e); -unlock: -spin_unlock_irqrestore (&ghes_lock, flags); -return NOTIFY_OK ; }
Signature · 1 line
2.43.0
PATCH v5 6/13 ACPI: APEI: Extract common memory failure handling
In reply to Pierre GondoisExtract ghes_handle_memory_failure_common() to share the severity checks and memory failure dispatch with the upcoming Memory Error Section 2 handler.
No functional change.
--- drivers/acpi/apei/ghes.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/acpi/apei/ghes.c +14 -7
@@ -528,15 +528,11 @@ static bool ghes_do_memory_failure(u64 physical_addr, int flags)return true; } -static bool ghes_handle_memory_failure (struct acpi_hest_generic_data *gdata, -int sev,bool sync) +static bool ghes_handle_memory_failure_common (struct acpi_hest_generic_data *gdata, +int sev,bool sync,u64 physical_addr) {int flags =-1 ;int sec_sev =ghes_severity (gdata->error_severity); -struct cper_sec_mem_err *mem_err =acpi_hest_get_payload (gdata); - -if (!(mem_err->validation_bits &CPER_MEM_VALID_PA )) -return false;/* iff following two events can be handled properly by now */ if (sec_sev == GHES_SEV_CORRECTED &&
@@ -546,11 +542,22 @@ static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, flags = sync ?MF_ACTION_REQUIRED :0 ;if (flags !=-1 ) -return ghes_do_memory_failure (mem_err->physical_addr, flags); +return ghes_do_memory_failure (physical_addr, flags);return false; } +static bool ghes_handle_memory_failure (struct acpi_hest_generic_data *gdata, +int sev,bool sync) +{ +struct cper_sec_mem_err *mem_err =acpi_hest_get_payload (gdata); + +if (!(mem_err->validation_bits &CPER_MEM_VALID_PA )) +return false; + +return ghes_handle_memory_failure_common (gdata, sev, sync, mem_err->physical_addr); +} +static bool ghes_handle_arm_hw_error (struct acpi_hest_generic_data *gdata,int sev,bool sync) {
Signature · 1 line
2.43.0
PATCH v5 7/13 efi/cper: Add Memory Error Section 2 structures
In reply to Pierre GondoisAdd CPER Memory Error Section 2 definitions to the CPER headers.
--- include/linux/cper.h | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
include/linux/cper.h +54 -0
@@ -199,6 +199,10 @@ enum {#define CPER_SEC_PLATFORM_MEM \ GUID_INIT(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \ 0xED, 0x7C, 0x83, 0xB1) +/* Platform Memory 2 */ +#define CPER_SEC_PLATFORM_MEM2 \ + GUID_INIT(0x61EC04FC, 0x48E6, 0xD813, 0x25, 0xC9, 0x8D, 0xAA, \ + 0x44, 0x75, 0x0B, 0x12)#define CPER_SEC_PCIE \ GUID_INIT(0xD995E954, 0xBBC1, 0x430F, 0xAD, 0x91, 0xB4, 0x4D, \ 0xCB, 0x3C, 0x6F, 0x35)
@@ -263,6 +267,30 @@ enum {#define CPER_MEM_VALID_BANK_ADDRESS BIT_ULL(20)#define CPER_MEM_VALID_CHIP_ID BIT_ULL(21) +/* Memory Error Section 2 validation bits, UEFI v2.11 sec N.2.6. */ +#define CPER_MEM2_VALID_ERROR_STATUS BIT_ULL(0) +#define CPER_MEM2_VALID_PA BIT_ULL(1) +#define CPER_MEM2_VALID_PA_MASK BIT_ULL(2) +#define CPER_MEM2_VALID_NODE BIT_ULL(3) +#define CPER_MEM2_VALID_CARD BIT_ULL(4) +#define CPER_MEM2_VALID_MODULE BIT_ULL(5) +#define CPER_MEM2_VALID_BANK BIT_ULL(6) +#define CPER_MEM2_VALID_DEVICE BIT_ULL(7) +#define CPER_MEM2_VALID_ROW BIT_ULL(8) +#define CPER_MEM2_VALID_COLUMN BIT_ULL(9) +#define CPER_MEM2_VALID_RANK_NUMBER BIT_ULL(10) +#define CPER_MEM2_VALID_BIT_POSITION BIT_ULL(11) +#define CPER_MEM2_VALID_CHIP_ID BIT_ULL(12) +#define CPER_MEM2_VALID_ERROR_TYPE BIT_ULL(13) +#define CPER_MEM2_VALID_STATUS BIT_ULL(14) +#define CPER_MEM2_VALID_REQUESTOR_ID BIT_ULL(15) +#define CPER_MEM2_VALID_RESPONDER_ID BIT_ULL(16) +#define CPER_MEM2_VALID_TARGET_ID BIT_ULL(17) +#define CPER_MEM2_VALID_CARD_HANDLE BIT_ULL(18) +#define CPER_MEM2_VALID_MODULE_HANDLE BIT_ULL(19) +#define CPER_MEM2_VALID_BANK_GROUP BIT_ULL(20) +#define CPER_MEM2_VALID_BANK_ADDRESS BIT_ULL(21) +#define CPER_MEM_EXT_ROW_MASK 0x3#define CPER_MEM_EXT_ROW_SHIFT 16
@@ -507,6 +535,32 @@ struct cper_sec_mem_err {u16 mem_dev_handle;/* "module handle" in UEFI 2.4 */ }; +/* Memory Error Section 2, UEFI v2.11 sec N.2.6 */ +struct cper_sec_mem_err2 { +u64 validation_bits; +u64 error_status; +u64 physical_addr; +u64 physical_addr_mask; +u16 node; +u16 card; +u16 module; +u16 bank; +u32 device; +u32 row; +u32 column; +u32 rank; +u32 bit_pos; +u8 chip_id; +u8 error_type; +u8 status; +u8 reserved; +u64 requestor_id; +u64 responder_id; +u64 target_id; +u32 mem_array_handle;/* "card handle" */ +u32 mem_dev_handle;/* "module handle" */ +}; +struct cper_mem_err_compact {u64 validation_bits;u16 node;
Signature · 1 line
2.43.0
PATCH v5 8/13 efi/cper: Increase memory error record buffer size
In reply to Pierre GondoisMemory Error Section 2 descriptions can exceed the 256-byte CPER record buffer. cper_mem_err2_location() needs about 263 characters when all location fields are valid, for example:
node:65535 card:65535 module:65535 rank:4294967295 bank_group:255
bank_address:255 device:4294967295 row:4294967295 column:4294967295
bit_position:4294967295 requestor_id:0xffffffffffffffff
responder_id:0xffffffffffffffff target_id:0xffffffffffffffff
chip_id:255cper_dimm_err2_location() needs 17 + strlen(bank) + strlen(device) characters for a DIMM name, or about 51 characters for the fallback:
DIMM location: not present. DMI handle: 0xffffffff
Increase CPER_REC_LEN to 512 to hold either helper's output.
--- include/linux/cper.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/cper.h +2 -2
@@ -29,9 +29,9 @@* 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. +* Allow room for the wider fields in Memory Error Section 2. */ -#define CPER_REC_LEN 256 +#define CPER_REC_LEN 512/* * Severity definition for error_severity in struct cper_record_header * and section_severity in struct cper_section_descriptor
Signature · 1 line
2.43.0
PATCH v5 9/13 efi/cper: Add helpers to handle Memory Error Section 2
In reply to Pierre GondoisAdd separate location and printing helpers for Memory Error Section 2:
- cper_mem_err2_location()
- cper_dimm_err2_location()
- cper_print_mem2()
Similar functions/logic exists for Memory Error Section (1), but require a compact version of the record. To avoid relying and propagating a non-standard record format, the new functions directly rely on struct cper_sec_mem_err2.
--- drivers/firmware/efi/cper.c | 107 ++++++++++++++++++++++++++++++++++++ include/linux/cper.h | 3 + 2 files changed, 110 insertions(+)
drivers/firmware/efi/cper.c +107 -0
@@ -461,6 +461,105 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem,printk ("%s%s\n" , pfx, rcd_decode_str); } +int cper_mem_err2_location (const struct cper_sec_mem_err2 *mem,char *msg,size_t len) +{ +u32 n; + +if (!msg || !len) +return 0 ; + + n =0 ; +if (mem->validation_bits &CPER_MEM2_VALID_NODE ) + n +=scnprintf (msg + n, len - n,"node:%d " , mem->node); +if (mem->validation_bits &CPER_MEM2_VALID_CARD ) + n +=scnprintf (msg + n, len - n,"card:%d " , mem->card); +if (mem->validation_bits &CPER_MEM2_VALID_MODULE ) + n +=scnprintf (msg + n, len - n,"module:%d " , mem->module); +if (mem->validation_bits &CPER_MEM2_VALID_RANK_NUMBER ) + n +=scnprintf (msg + n, len - n,"rank:%u " , mem->rank); +if (mem->validation_bits &CPER_MEM2_VALID_BANK ) + n +=scnprintf (msg + n, len - n,"bank:%d " , mem->bank); +if (mem->validation_bits &CPER_MEM2_VALID_BANK_GROUP ) + n +=scnprintf (msg + n, len - n,"bank_group:%d " , + mem->bank >>CPER_MEM_BANK_GROUP_SHIFT ); +if (mem->validation_bits &CPER_MEM2_VALID_BANK_ADDRESS ) + n +=scnprintf (msg + n, len - n,"bank_address:%d " , + mem->bank &CPER_MEM_BANK_ADDRESS_MASK ); +if (mem->validation_bits &CPER_MEM2_VALID_DEVICE ) + n +=scnprintf (msg + n, len - n,"device:%u " , mem->device); +if (mem->validation_bits &CPER_MEM2_VALID_ROW ) + n +=scnprintf (msg + n, len - n,"row:%u " , mem->row); +if (mem->validation_bits &CPER_MEM2_VALID_COLUMN ) + n +=scnprintf (msg + n, len - n,"column:%u " , mem->column); +if (mem->validation_bits &CPER_MEM2_VALID_BIT_POSITION ) + n +=scnprintf (msg + n, len - n,"bit_position:%u " , + mem->bit_pos); +if (mem->validation_bits &CPER_MEM2_VALID_REQUESTOR_ID ) + n +=scnprintf (msg + n, len - n,"requestor_id:0x%016llx " , + mem->requestor_id); +if (mem->validation_bits &CPER_MEM2_VALID_RESPONDER_ID ) + n +=scnprintf (msg + n, len - n,"responder_id:0x%016llx " , + mem->responder_id); +if (mem->validation_bits &CPER_MEM2_VALID_TARGET_ID ) + n +=scnprintf (msg + n, len - n,"target_id:0x%016llx " , + mem->target_id); +if (mem->validation_bits &CPER_MEM2_VALID_CHIP_ID ) + n +=scnprintf (msg + n, len - n,"chip_id:%d " , + mem->chip_id); + +return n; +} +EXPORT_SYMBOL_GPL (cper_mem_err2_location); + +int cper_dimm_err2_location (const struct cper_sec_mem_err2 *mem,char *msg,size_t len) +{ +u32 n; +const char *bank =NULL , *device =NULL ; + +if (!msg || !len || !(mem->validation_bits &CPER_MEM2_VALID_MODULE_HANDLE )) +return 0 ; + +/* SMBIOS handles are 16 bits; never truncate a Section 2 handle. */ +if (mem->mem_dev_handle <=U16_MAX ) +dmi_memdev_name (mem->mem_dev_handle, &bank, &device); +else +pr_warn_ratelimited (FW_WARN "Memory Error Section 2 module handle 0x%x exceeds SMBIOS range\n" , + mem->mem_dev_handle); + +if (bank && device) + n =scnprintf (msg, len,"DIMM location: %s %s " , bank, device); +else + n =scnprintf (msg, len, +"DIMM location: not present. DMI handle: 0x%.8x " , + mem->mem_dev_handle); + +return n; +} +EXPORT_SYMBOL_GPL (cper_dimm_err2_location); + +static void cper_print_mem2 (const char *pfx,const struct cper_sec_mem_err2 *mem) +{ +char rcd_decode_str[CPER_REC_LEN ]; + +if (mem->validation_bits &CPER_MEM2_VALID_ERROR_STATUS ) +printk ("%serror_status: %s (0x%016llx)\n" , pfx, +cper_mem_err_status_str (mem->error_status), mem->error_status); +if (mem->validation_bits &CPER_MEM2_VALID_PA ) +printk ("%sphysical_address: 0x%016llx\n" , pfx, mem->physical_addr); +if (mem->validation_bits &CPER_MEM2_VALID_PA_MASK ) +printk ("%sphysical_address_mask: 0x%016llx\n" , pfx, + mem->physical_addr_mask); +if (cper_mem_err2_location (mem, rcd_decode_str,sizeof (rcd_decode_str))) +printk ("%s%s\n" , pfx, rcd_decode_str); +if (mem->validation_bits &CPER_MEM2_VALID_ERROR_TYPE ) +printk ("%serror_type: %u, %s\n" , pfx, mem->error_type, +cper_mem_err_type_str (mem->error_type)); +if (mem->validation_bits &CPER_MEM2_VALID_STATUS ) +printk ("%sstatus: 0x%02x\n" , pfx, mem->status); +if (cper_dimm_err2_location (mem, rcd_decode_str,sizeof (rcd_decode_str))) +printk ("%s%s\n" , pfx, rcd_decode_str); +} +static const char *const pcie_port_type_strs[] = {"PCIe end point" ,"legacy PCI end point" ,
@@ -666,6 +765,14 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata gdata->error_data_length); else goto err_section_too_small; + }else if (guid_equal (sec_type, &CPER_SEC_PLATFORM_MEM2 )) { +struct cper_sec_mem_err2 *mem_err =acpi_hest_get_payload (gdata); + +printk ("%ssection_type: memory error 2\n" , newpfx); +if (gdata->error_data_length >=sizeof (*mem_err)) +cper_print_mem2 (newpfx, mem_err); +else + goto err_section_too_small; }else if (guid_equal (sec_type, &CPER_SEC_PCIE )) {struct cper_sec_pcie *pcie =acpi_hest_get_payload (gdata);
include/linux/cper.h +3 -0
@@ -657,6 +657,9 @@ void cper_print_proc_ia(const char *pfx,int cper_mem_err_location (struct cper_mem_err_compact *mem,char *msg,size_t len);int cper_dimm_err_location (struct cper_mem_err_compact *mem,char *msg,size_t len); +int cper_mem_err2_location (const struct cper_sec_mem_err2 *mem,char *msg,size_t len); +int cper_dimm_err2_location (const struct cper_sec_mem_err2 *mem,char *msg,size_t len); +struct acpi_hest_generic_status ;void cper_estatus_print (const char *pfx,const struct acpi_hest_generic_status *estatus);
Signature · 1 line
2.43.0
PATCH v5 10/13 ACPI: APEI: Handle Memory Error Section 2 records in GHES
In reply to Pierre GondoisHandle Memory Error Section 2 records through a dedicated GHES notifier chain. Log them as memory errors and pass valid physical addresses to the common memory failure path.
--- drivers/acpi/apei/ghes.c | 37 ++++++++++++++++++++++++++++++++++++- include/acpi/ghes.h | 2 ++ 2 files changed, 38 insertions(+), 1 deletion(-)
drivers/acpi/apei/ghes.c +36 -1
@@ -101,6 +101,7 @@#endif static ATOMIC_NOTIFIER_HEAD (ghes_report_chain); +static ATOMIC_NOTIFIER_HEAD (ghes_report_mem2_chain);static inline bool is_hest_type_generic_v2 (struct ghes *ghes) {
@@ -558,6 +559,17 @@ static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata,return ghes_handle_memory_failure_common (gdata, sev, sync, mem_err->physical_addr); } +static bool ghes_handle_memory_failure2 (struct acpi_hest_generic_data *gdata, +int sev,bool sync) +{ +struct cper_sec_mem_err2 *mem_err =acpi_hest_get_payload (gdata); + +if (!(mem_err->validation_bits &CPER_MEM2_VALID_PA )) +return false; + +return ghes_handle_memory_failure_common (gdata, sev, sync, mem_err->physical_addr); +} +static bool ghes_handle_arm_hw_error (struct acpi_hest_generic_data *gdata,int sev,bool sync) {
@@ -930,7 +942,8 @@ static void ghes_log_hwerr(int sev, guid_t *sec_type)return ; } -if (guid_equal (sec_type, &CPER_SEC_PLATFORM_MEM )) { +if (guid_equal (sec_type, &CPER_SEC_PLATFORM_MEM ) || +guid_equal (sec_type, &CPER_SEC_PLATFORM_MEM2 )) {hwerr_log_error_type (HWERR_RECOV_MEMORY );return ; }
@@ -1008,6 +1021,16 @@ static void ghes_do_proc(struct ghes *ghes,arch_apei_report_mem_error (sev, mem_err); queued |=ghes_handle_memory_failure (gdata, sev, sync); + }else if (guid_equal (sec_type, &CPER_SEC_PLATFORM_MEM2 )) { +struct cper_sec_mem_err2 *mem_err =acpi_hest_get_payload (gdata); + +if (gdata->error_data_length <sizeof (*mem_err)) { + pr_warn_ratelimited(FW_WARN GHES_PFX "Memory Error Section 2 length is too small\n"); +continue ; + } + +atomic_notifier_call_chain (&ghes_report_mem2_chain, sev, mem_err); + queued |=ghes_handle_memory_failure2 (gdata, sev, sync); }else if (guid_equal (sec_type, &CPER_SEC_PCIE )) {ghes_handle_aer (gdata); }else if (guid_equal (sec_type, &CPER_SEC_PROC_ARM )) {
@@ -2033,3 +2056,15 @@ void ghes_unregister_report_chain(struct notifier_block *nb)atomic_notifier_chain_unregister (&ghes_report_chain, nb); }EXPORT_SYMBOL_GPL (ghes_unregister_report_chain); + +void ghes_register_report_mem2_chain (struct notifier_block *nb) +{ +atomic_notifier_chain_register (&ghes_report_mem2_chain, nb); +} +EXPORT_SYMBOL_GPL (ghes_register_report_mem2_chain); + +void ghes_unregister_report_mem2_chain (struct notifier_block *nb) +{ +atomic_notifier_chain_unregister (&ghes_report_mem2_chain, nb); +} +EXPORT_SYMBOL_GPL (ghes_unregister_report_mem2_chain);
include/acpi/ghes.h +2 -0
@@ -147,4 +147,6 @@ static inline int ghes_notify_sea(void) { return -ENOENT; }struct notifier_block ;extern void ghes_register_report_chain (struct notifier_block *nb);extern void ghes_unregister_report_chain (struct notifier_block *nb); +extern void ghes_register_report_mem2_chain (struct notifier_block *nb); +extern void ghes_unregister_report_mem2_chain (struct notifier_block *nb);#endif /* GHES_H */
Signature · 1 line
2.43.0
PATCH v5 11/13 EDAC/ghes: Increase memory error location and detail buffers
In reply to Pierre GondoisMemory Error Section 2 can combine the roughly 263-character output of cper_mem_err2_location() with a DIMM description from cper_dimm_err2_location(). Increase LOCATION_SIZE to 512 to hold both.
print_mem_error2_other_detail() adds formatting text and a status description to the location. Its output can include ~65 chars:
APEI location: <location> status(0xffffffffffff13ff): <status>
section_status:0xffAllow about 65 chars plus the status description by sizing OTHER_DETAIL_LEN relative to LOCATION_SIZE.
--- drivers/edac/ghes_edac.c | 3 ++- include/linux/edac.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/edac/ghes_edac.c +2 -1
@@ -17,7 +17,8 @@#include <linux/notifier.h> #include <linux/string.h> -#define OTHER_DETAIL_LEN 400 +/* Allow 65 formatting characters plus the longest status description (63). */ +#define OTHER_DETAIL_LEN (LOCATION_SIZE + 128)struct ghes_pvt {struct mem_ctl_info *mci;
include/linux/edac.h +1 -1
@@ -48,7 +48,7 @@ static inline void opstate_init(void)#define EDAC_MC_LABEL_LEN 31/* Maximum size of the location string */ -#define LOCATION_SIZE 256 +#define LOCATION_SIZE 512/* Defines the maximum number of labels that can be reported */ #define EDAC_MAX_LABELS 8
Signature · 1 line
2.43.0
PATCH v5 12/13 EDAC/ghes: Handle Memory Error Section 2 records
In reply to Pierre GondoisRegister a separate EDAC callback for GHES Memory Error Section 2 records. Map the error type, address, grain, location, DIMM and status fields to an EDAC error report.
--- drivers/edac/ghes_edac.c | 118 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)
drivers/edac/ghes_edac.c +118 -0
@@ -391,6 +391,122 @@ static struct notifier_block ghes_edac_mem_err_nb = { .priority = 0, }; +static int print_mem_error2_other_detail (const struct cper_sec_mem_err2 *mem,char *msg, +const char *location,size_t len) +{ +u32 n; + +if (!msg || !len) +return 0 ; + + n =0 ; + + n +=scnprintf (msg + n, len - n,"APEI location: %s " , location); + +if (mem->validation_bits &CPER_MEM2_VALID_ERROR_STATUS ) { + n +=scnprintf (msg + n, len - n,"status(0x%016llx): " , mem->error_status); + n +=scnprintf (msg + n, len - n,"%s " , +cper_mem_err_status_str (mem->error_status)); + } +if (mem->validation_bits &CPER_MEM2_VALID_STATUS ) + n +=scnprintf (msg + n, len - n,"section_status:0x%02x " , + mem->status); + + msg[n] ='\0' ; + +return n; +} + +static int ghes_edac_report_mem_error2 (struct notifier_block *nb, +unsigned long val,void *data) +{ +struct cper_sec_mem_err2 *mem_err = data; +struct edac_raw_error_desc *e; +struct mem_ctl_info *mci; +struct ghes_pvt *pvt; +size_t len; +char *p; + +/* +* We can do the locking below because GHES defers error processing +* from NMI to IRQ context. Whenever that changes, we'd at least +* know. +*/ +if (WARN_ON_ONCE (in_nmi ())) +return NOTIFY_OK ; + +guard (spinlock_irqsave)(&ghes_lock); + + pvt = ghes_pvt; +if (!pvt) +return NOTIFY_OK ; + + mci = pvt->mci; + e = &mci->error_desc; +ghes_edac_init_error_desc (e, val, pvt->msg, pvt->other_detail); + +edac_dbg (1 ,"error validation_bits: 0x%08llx\n" , + (long long )mem_err->validation_bits); + +/* Error type, mapped on e->msg */ +if (mem_err->validation_bits &CPER_MEM2_VALID_ERROR_TYPE ) { +u8 etype = mem_err->error_type; + + p = pvt->msg; + p +=snprintf (p,sizeof (pvt->msg),"%s" ,cper_mem_err_type_str (etype)); + }else { +strscpy (pvt->msg,"unknown error" ); + } + +/* Error address */ +if (mem_err->validation_bits &CPER_MEM2_VALID_PA ) { + e->page_frame_number =PHYS_PFN (mem_err->physical_addr); + e->offset_in_page =offset_in_page (mem_err->physical_addr); + } + +/* Error grain */ +if (mem_err->validation_bits &CPER_MEM2_VALID_PA_MASK ) + e->grain = ~mem_err->physical_addr_mask +1 ; + +/* Memory error location, mapped on e->location */ + len =sizeof (e->location); + p = e->location; + p +=cper_mem_err2_location (mem_err, p, len); + +if (mem_err->validation_bits &CPER_MEM2_VALID_MODULE_HANDLE ) { +struct dimm_info *dimm =NULL ; + + p +=cper_dimm_err2_location (mem_err, p, len - (p - e->location)); +if (mem_err->mem_dev_handle <=U16_MAX ) { + dimm =find_dimm_by_handle (mci, mem_err->mem_dev_handle); +if (dimm) { + e->top_layer = dimm->idx; +strscpy (e->label, dimm->label); + } + } + } +if (p > e->location && p[-1 ] ==' ' ) + *(p -1 ) ='\0' ; + +if (!*e->label) +strscpy (e->label,"unknown memory" ); + +/* All other fields are mapped on e->other_detail */ + p = pvt->other_detail; + p +=print_mem_error2_other_detail (mem_err, p, e->location,sizeof (pvt->other_detail)); +if (p > pvt->other_detail && p[-1 ] ==' ' ) + *(p -1 ) ='\0' ; + +edac_raw_mc_handle_error (e); + +return NOTIFY_OK ; +} + +static struct notifier_block ghes_edac_mem_err2_nb = { + .notifier_call = ghes_edac_report_mem_error2, + .priority =0 , +}; +static int ghes_edac_register (struct device *dev) {bool fake = false;
@@ -495,6 +611,7 @@ static int ghes_edac_register(struct device *dev)spin_unlock_irqrestore (&ghes_lock, flags);ghes_register_report_chain (&ghes_edac_mem_err_nb); +ghes_register_report_mem2_chain (&ghes_edac_mem_err2_nb);/* only set on success */ refcount_set (&ghes_refcount,1 );
@@ -538,6 +655,7 @@ static void ghes_edac_unregister(struct ghes *ghes)if (mci)edac_mc_free (mci); +ghes_unregister_report_mem2_chain (&ghes_edac_mem_err2_nb);ghes_unregister_report_chain (&ghes_edac_mem_err_nb); unlock:
Signature · 1 line
2.43.0
PATCH v5 13/13 ACPI: extlog: Add Memory Error Section 2 trace event
In reply to Pierre GondoisAdd a separate handling for Memory Error Section 2 trace events. The fields of the record are individually printed so userspace can discover the layout more dynamically if a new field is added.
--- drivers/acpi/acpi_extlog.c | 6 +++ drivers/ras/ras.c | 1 + include/ras/ras_event.h | 102 +++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+)
drivers/acpi/acpi_extlog.c +6 -0
@@ -231,6 +231,12 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,if (gdata->error_data_length >=sizeof (*mem))trace_extlog_mem_event (mem, err_seq, fru_id, fru_text, (u8 )gdata->error_severity); + }else if (guid_equal (sec_type, &CPER_SEC_PLATFORM_MEM2 )) { +struct cper_sec_mem_err2 *mem =acpi_hest_get_payload (gdata); + +if (gdata->error_data_length >=sizeof (*mem)) +trace_extlog_mem2_event (mem, err_seq, fru_id, fru_text, + (u8 )gdata->error_severity); }else if (guid_equal (sec_type, &CPER_SEC_CXL_PROT_ERR )) {struct cxl_cper_sec_prot_err *prot_err =acpi_hest_get_payload (gdata);
drivers/ras/ras.c +1 -0
@@ -111,6 +111,7 @@ subsys_initcall(ras_init);#if defined(CONFIG_ACPI_EXTLOG ) || defined(CONFIG_ACPI_EXTLOG_MODULE )EXPORT_TRACEPOINT_SYMBOL_GPL (extlog_mem_event); +EXPORT_TRACEPOINT_SYMBOL_GPL (extlog_mem2_event);#endif EXPORT_TRACEPOINT_SYMBOL_GPL (mc_event);EXPORT_TRACEPOINT_SYMBOL_GPL (non_standard_event);
include/ras/ras_event.h +102 -0
108 lines not on this page · raw message
Signature · 1 line
2.43.0