Hello, This patchset should be applied on top of [1].
GHES and acpi_extlog handle many of the same CPER sections, but have separate implementations that do not always report errors in the same way. This series brings that code together so both paths can use the same reporting helpers. Most of the patches prepare for that move. MCE reporting for Memory Error Section 2 is also added. In the MCE extended-log policy, tracing and PCIe/CXL handling no longer depend on whether a RAS daemon is registered. Only fatal CPER records are printed to the console, as briefly suggested at [2]. For nonfatal records, users need tracing enabled or a subsystem handler that reports the error. With the common helper, GHES can emit memory trace events even without an EDAC driver registered. CXL media records that cannot be queued are reported through the nonstandard trace event instead of being dropped. [1] https://lore.kernel.org/lkml/[email protected]/ [2] https://lore.kernel.org/lkml/20240521183913.GGZkzqUSN1hdE-_OEY@fat_crate.local/ ++++++++++++ + Testing: + ++++++++++++ Some examples of kernel logs, tested on x86/arm64: CPER Memory Error section: {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1 {1}[Hardware Error]: event severity: recoverable {1}[Hardware Error]: Error 0, type: recoverable {1}[Hardware Error]: fru_text: ABCDEFGHIJKLMNOPQRST {1}[Hardware Error]: section_type: memory error {1}[Hardware Error]: error_status: A read was issued to data that has been poisoned (0x00000000007f1a00) {1}[Hardware Error]: physical_address: 0xffffffffffffffff {1}[Hardware Error]: physical_address_mask: 0xffffffffffffffff {1}[Hardware Error]: node:65535 card:65535 module:65535 rank:65535 bank_group:255 bank_address:255 device:65535 row:262143 column:65535 bit_position:65535 requestor_id:0xffffffffffffffff responder_id:0xffffffffffffffff target_id:0xffffffffffffffff chip_id:7 {1}[Hardware Error]: error_type: 15, physical memory map-out event {1}[Hardware Error]: DIMM location: not present. DMI handle: 0xfeff $ [arm64 specific log] EDAC MC0: 1 UE physical memory map-out event on unknown memory (node:65535 card:65535 module:65535 rank:65535 bank_group:255 bank_address:255 device:65535 row:262143 column:65535 bit_position:65535 requestor_id:0xffffffffffffffff responder_id:0xffffffffffffffff target_id:0xffffffffffffffff chip_id:7 DIMM location: not present. DMI handle: 0xfeff page:0xfffffffffffff offset:0xfff grain:1 - APEI location: node:65535 card:65535 module:65535 rank:65535 bank_group:255 bank_address:255 device:65535 row:262143 column:65535 bit_position:65535 requestor_id:0xffffffffffffffff responder_id:0xffffffffffffffff target_id:0xffffffffffffffff chip_id:7 DIMM location: not present. DMI handle: 0xfeff status(0x00000000007f1a00): A read was issued to data that has been poisoned) Memory failure: 0xfffffffffffff: recovery action for non struct page pfn: Ignored CPER Memory Error section 2: {2}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1 {2}[Hardware Error]: event severity: recoverable {2}[Hardware Error]: Error 0, type: recoverable {2}[Hardware Error]: fru_text: ABCDEFGHIJKLMNOPQRST {2}[Hardware Error]: section_type: memory error 2 {2}[Hardware Error]: error_status: A read was issued to data that has been poisoned (0x00000000007f1a00) {2}[Hardware Error]: physical_address: 0xffffffffffffffff {2}[Hardware Error]: physical_address_mask: 0xffffffffffffffff {2}[Hardware Error]: 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:255 {2}[Hardware Error]: error_type: 15, physical memory map-out event {2}[Hardware Error]: status: 0x01 {2}[Hardware Error]: DIMM location: not present. DMI handle: 0x0000feff $ [arm64 specific log] EDAC MC0: 1 UE physical memory map-out event on unknown memory (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:255 DIMM location: not present. DMI handle: 0x0000feff page:0xfffffffffffff offset:0xfff grain:1 - APEI location: 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:255 DIMM location: not present. DMI handle: 0x0000feff status(0x00000000007f1a00): A read was issued to data that has been poisoned section_status:0x01) Memory failure: 0xfffffffffffff: recovery action for non struct page pfn: Ignored Non standard (i.e. random GUID): {3}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1 {3}[Hardware Error]: event severity: recoverable {3}[Hardware Error]: Error 0, type: recoverable {3}[Hardware Error]: fru_text: ABCDEFGHIJKLMNOPQRST {3}[Hardware Error]: section type: unknown, 12345678-1234-5678-9abc-def012345679 {3}[Hardware Error]: section length: 0x21 {3}[Hardware Error]: 00000000: 746e7953 69746568 6f6e2063 6174736e Synthetic nonsta {3}[Hardware Error]: 00000010: 7261646e 50432064 65205245 746e6576 ndard CPER event {3}[Hardware Error]: 00000020: 00 . PCI: {4}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1 {4}[Hardware Error]: event severity: recoverable {4}[Hardware Error]: Error 0, type: recoverable {4}[Hardware Error]: fru_text: ABCDEFGHIJKLMNOPQRST {4}[Hardware Error]: section_type: PCIe error {4}[Hardware Error]: port_type: 0, PCIe end point {4}[Hardware Error]: device_id: 0000:01:00.0 {4}[Hardware Error]: slot: 0 {4}[Hardware Error]: secondary_bus: 0x00 {4}[Hardware Error]: vendor_id: 0x1234, device_id: 0x5678 {4}[Hardware Error]: class_code: 000000 {4}[Hardware Error]: aer_cor_status: 0x00000000, aer_cor_mask: 0x00000000 {4}[Hardware Error]: aer_uncor_status: 0x00004000, aer_uncor_mask: 0x00000000 {4}[Hardware Error]: aer_uncor_severity: 0x00000000 {4}[Hardware Error]: TLP Header: 00000000 00000000 00000000 00000000 AER: 0000:01:00.0: no pci_dev found Tracing: x86: extlog_mem_event: {1} recoverable error: physical memory map-out event physical addr: ffffffffffffffff (mask lsb: 0) node:65535 card:65535 module:65535 rank:65535 bank_group:255 bank_address:255 device:65535 row:262143 column:65535 bit_position:65535 requestor_id:0xffffffffffffffff responder_id:0xffffffffffffffff target_id:0xffffffffffffffff chip_id:7 DIMM location: not present. DMI handle: 0xfeff FRU: 00000000-0000-0000-0000-000000000000 ABCDEFGHIJKLMNOPQRST mce_record: CPU: 0, MCGc/s: 100010a/0, MC255: bc0000000000009f, IPID: 0000000000000000, ADDR: ffffffffffffffff, MISC: 0000000000000080, SYND: 0000000000000000, RIP: 00:<0000000000000000>, TSC: 0, PPIN: 0, vendor: 2, CPUID: 663, time: 1794906879, socket: 0, APIC: 0, microcode: 1000065, vendor data: {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} extlog_mem2_event: {2} recoverable error: validation_bits: 0x3fffbf error_status: 0x7f1a00 physical_addr: 0xffffffffffffffff physical_addr_mask: 0xffffffffffffffff node: 65535 card: 65535 module: 65535 bank: 65535 device: 4294967295 row: 4294967295 column: 4294967295 rank: 4294967295 bit_pos: 4294967295 chip_id: 255 error_type: 15 status: 0x1 requestor_id: 0xffffffffffffffff responder_id: 0xffffffffffffffff target_id: 0xffffffffffffffff mem_array_handle: 0xfeff mem_dev_handle: 0xfeff FRU: 00000000-0000-0000-0000-000000000000 ABCDEFGHIJKLMNOPQRST mce_record: CPU: 0, MCGc/s: 100010a/0, MC255: bc0000000000009f, IPID: 0000000000000000, ADDR: ffffffffffffffff, MISC: 0000000000000080, SYND: 0000000000000000, RIP: 00:<0000000000000000>, TSC: 0, PPIN: 0, vendor: 2, CPUID: 663, time: 1794906882, socket: 0, APIC: 0, microcode: 1000065, vendor data: {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} non_standard_event: severity: 2; sec type:78563412-3412-7856-9abc-def012345679; FRU: 00000000-0000-0000-0000-000000000000 ABCDEFGHIJKLMNOPQRST; data len:33; raw data:53 79 6e 74 68 65 74 69 63 20 6e 6f 6e 73 74 61 6e 64 61 72 64 20 43 50 45 52 20 65 76 65 6e 74 00 arm64: extlog_mem_event: {1} recoverable error: physical memory map-out event physical addr: ffffffffffffffff (mask lsb: 0) node:65535 card:65535 module:65535 rank:65535 bank_group:255 bank_address:255 device:65535 row:262143 column:65535 bit_position:65535 requestor_id:0xffffffffffffffff responder_id:0xffffffffffffffff target_id:0xffffffffffffffff chip_id:7 DIMM location: not present. DMI handle: 0xfeff FRU: 00000000-0000-0000-0000-000000000000 ABCDEFGHIJKLMNOPQRST mc_event: 1 Uncorrected error: physical memory map-out event on unknown memory (mc:0 location:-1:-1:-1 address:0xffffffffffffffff grain:1 syndrome:0x00000000 APEI location: node:65535 card:65535 module:65535 rank:65535 bank_group:255 bank_address:255 device:65535 row:262143 column:65535 bit_position:65535 requestor_id:0xffffffffffffffff responder_id:0xffffffffffffffff target_id:0xffffffffffffffff chip_id:7 DIMM location: not present. DMI handle: 0xfeff status(0x00000000007f1a00): A read was issued to data that has been poisoned) memory_failure_event: pfn 0xfffffffffffff: recovery action for non struct page pfn: Ignored extlog_mem2_event: {2} recoverable error: validation_bits: 0x3fffbf error_status: 0x7f1a00 physical_addr: 0xffffffffffffffff physical_addr_mask: 0xffffffffffffffff node: 65535 card: 65535 module: 65535 bank: 65535 device: 4294967295 row: 4294967295 column: 4294967295 rank: 4294967295 bit_pos: 4294967295 chip_id: 255 error_type: 15 status: 0x1 requestor_id: 0xffffffffffffffff responder_id: 0xffffffffffffffff target_id: 0xffffffffffffffff mem_array_handle: 0xfeff mem_dev_handle: 0xfeff FRU: 00000000-0000-0000-0000-000000000000 ABCDEFGHIJKLMNOPQRST mc_event: 1 Uncorrected error: physical memory map-out event on unknown memory (mc:0 location:-1:-1:-1 address:0xffffffffffffffff grain:1 syndrome:0x00000000 APEI location: 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:255 DIMM location: not present. DMI handle: 0x0000feff status(0x00000000007f1a00): A read was issued to data that has been poisoned section_status:0x01) memory_failure_event: pfn 0xfffffffffffff: recovery action for non struct page pfn: Ignored non_standard_event: severity: 2; sec type:78563412-3412-7856-9abc-def012345679; FRU: 00000000-0000-0000-0000-000000000000 ABCDEFGHIJKLMNOPQRST; data len:33; raw data:53 79 6e 74 68 65 74 69 63 20 6e 6f 6e 73 74 61 6e 64 61 72 64 20 43 50 45 52 20 65 76 65 6e 74 00 Pierre Gondois (19): x86/APEI: Extract common CPER memory error reporting helper x86/APEI: Report Memory Error Section 2 through MCE ras: Bound CPER FRU strings in trace events ACPI: APEI: Use empty FRU values if valid bit is absent PCI/AER: Embed aer_capability_regs copy in struct aer_recover_entry ACPI: APEI: Remove aer allocation in ghes_handle_aer() ACPI: extlog: Provide HEST generic data to extlog_print_pcie() ACPI: extlog: Align extlog_print_pcie() and ghes_handle_aer() ACPI: extlog: Report errors independently of RAS consumers ACPI: extlog: Simplify fatal record printing RAS: Remove unused ras_userspace_consumers() ACPI: extlog: Extract CPER reporting from acpi_extlog ACPI: APEI: Share helpers with the common CPER reporter ACPI: APEI: Return status from cxl_cper_post_event() ACPI: APEI: Extend common CPER reporting for GHES section types ACPI: extlog: Report error severity using GHES bindings in MCE ACPI: APEI: Share the extlog PCIe handler with GHES ACPI: APEI: Route GHES section reporting through extlog PCI/ERR: Avoid NULL bridge pointer arch/x86/include/asm/mce.h | 5 +- arch/x86/kernel/acpi/apei.c | 7 + arch/x86/kernel/cpu/mce/apei.c | 43 ++++-- drivers/acpi/acpi_extlog.c | 138 ++--------------- drivers/acpi/apei/Makefile | 2 +- drivers/acpi/apei/apei-base.c | 5 + drivers/acpi/apei/apei-internal.h | 7 + drivers/acpi/apei/extlog.c | 236 ++++++++++++++++++++++++++++++ drivers/acpi/apei/ghes.c | 168 +++------------------ drivers/pci/pcie/aer.c | 34 ++--- drivers/pci/pcie/err.c | 5 + drivers/ras/debugfs.c | 10 -- drivers/ras/ras.c | 2 +- include/acpi/apei.h | 1 + include/acpi/ghes.h | 4 - include/linux/aer.h | 2 +- include/linux/ras.h | 2 - include/ras/ras_event.h | 8 +- 18 files changed, 345 insertions(+), 334 deletions(-) create mode 100644 drivers/acpi/apei/extlog.c -- 2.43.0
