On Tue, 17 Nov 2026 12:10:28 +0100 Pierre Gondois <[email protected]> wrote:
> Use acpi_extlog_report() for GHES section reporting and remove the > duplicate dispatch code. > > GHES memory sections now emit extlog trace events independently of EDAC > registration, using the CPER section severity and one sequence number > per status block. CXL events that cannot be queued fall back to the > nonstandard trace event. > > Report all sections before running the remaining GHES handlers. Keep > memory recovery, SIGBUS handling and notifier calls in GHES. This mix and match of where things are handled leaves me wondering a bit if the unification is a good idea. Sure there is a bit of duplication reduction, but we still end up with slightly diverging flows. The ordering of reporting could also change due to a mixture of sections being handled by each loop. Not necessarily a problem, but that needs some thought. I'll wait to see if others are more in favour. Jonathan > > Signed-off-by: Pierre Gondois <[email protected]> > --- > drivers/acpi/apei/apei-internal.h | 1 - > drivers/acpi/apei/extlog.c | 2 +- > drivers/acpi/apei/ghes.c | 57 +++++++------------------------ > 3 files changed, 13 insertions(+), 47 deletions(-) > > diff --git a/drivers/acpi/apei/apei-internal.h > b/drivers/acpi/apei/apei-internal.h > index 22a33a21017a3..5063c743b4cf0 100644 > --- a/drivers/acpi/apei/apei-internal.h > +++ b/drivers/acpi/apei/apei-internal.h > @@ -14,7 +14,6 @@ int ghes_severity(int severity); > int cxl_cper_post_event(enum cxl_event_type event_type, > struct cxl_cper_event_rec *rec, u32 len); > u32 acpi_extlog_mem_err_min_len(u64 validation_bits); > -void extlog_print_pcie(struct acpi_hest_generic_data *gdata); > void acpi_extlog_report(const struct acpi_hest_generic_status *estatus); > > struct apei_exec_context; > diff --git a/drivers/acpi/apei/extlog.c b/drivers/acpi/apei/extlog.c > index 42ba8ba13804f..d1677d299e389 100644 > --- a/drivers/acpi/apei/extlog.c > +++ b/drivers/acpi/apei/extlog.c > @@ -31,7 +31,7 @@ > * CPER_SEV_FATAL or CPER_SEC_RESET -> AER_FATAL > * These both need to be reported and recovered from by the AER driver. > */ > -void extlog_print_pcie(struct acpi_hest_generic_data *gdata) > +static void extlog_print_pcie(struct acpi_hest_generic_data *gdata) > { > #ifdef CONFIG_ACPI_APEI_PCIEAER > struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata); > diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c > index 7d2864fa14503..221f0a81c94f6 100644 > --- a/drivers/acpi/apei/ghes.c > +++ b/drivers/acpi/apei/ghes.c > @@ -566,9 +566,7 @@ static bool ghes_handle_arm_hw_error(struct > acpi_hest_generic_data *gdata, > char *p; > > sec_sev = ghes_severity(gdata->error_severity); > - if (length >= sizeof(*err)) { > - log_arm_hw_error(err, sec_sev); > - } else { > + if (length < sizeof(*err)) { > pr_warn(FW_BUG "arm error length: %d\n", length); > pr_warn(FW_BUG "length is too small\n"); > pr_warn(FW_BUG "firmware-generated error record is > incorrect\n"); > @@ -884,34 +882,23 @@ static void ghes_log_hwerr(int sev, guid_t *sec_type) > static void ghes_do_proc(struct ghes *ghes, > const struct acpi_hest_generic_status *estatus) > { > - int sev, sec_sev; > + int sev; > struct acpi_hest_generic_data *gdata; > guid_t *sec_type; > - const guid_t *fru_id; > - const char *fru_text; > bool queued = false; > bool sync = is_hest_sync_notify(ghes); > > + acpi_extlog_report(estatus); > + > sev = ghes_severity(estatus->error_severity); > apei_estatus_for_each_section(estatus, gdata) { > sec_type = (guid_t *)gdata->section_type; > - sec_sev = ghes_severity(gdata->error_severity); > - if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID) > - fru_id = (guid_t *)gdata->fru_id; > - else > - fru_id = &guid_null; > - > - if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT) > - fru_text = gdata->fru_text; > - else > - fru_text = ""; > - > ghes_log_hwerr(sev, sec_type); > if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { > struct cper_sec_mem_err *mem_err = > acpi_hest_get_payload(gdata); > > /* > - * Check once for all three consumers below. The 73-byte > + * Check once for all consumers below. The 73-byte > * UEFI 2.1/2.2 layout is the floor, matching > * cper_estatus_print_section() and making > * validation_bits safe to read. > @@ -944,37 +931,17 @@ static void ghes_do_proc(struct ghes *ghes, > atomic_notifier_call_chain(&ghes_report_mem2_chain, > sev, mem_err); > arch_apei_report_mem_error2(sev, mem_err); > queued |= ghes_handle_memory_failure2(gdata, sev, sync); > - } else if (guid_equal(sec_type, &CPER_SEC_PCIE)) { > - extlog_print_pcie(gdata); > } else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { > queued |= ghes_handle_arm_hw_error(gdata, sev, sync); > - } else if (guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR)) { > - struct cxl_cper_sec_prot_err *prot_err = > acpi_hest_get_payload(gdata); > - > - cxl_cper_post_prot_err(prot_err, gdata->error_severity, > - gdata->error_data_length); > - } else if (guid_equal(sec_type, &CPER_SEC_CXL_GEN_MEDIA_GUID)) { > - struct cxl_cper_event_rec *rec = > acpi_hest_get_payload(gdata); > - > - cxl_cper_post_event(CXL_CPER_EVENT_GEN_MEDIA, rec, > - gdata->error_data_length); > - } else if (guid_equal(sec_type, &CPER_SEC_CXL_DRAM_GUID)) { > - struct cxl_cper_event_rec *rec = > acpi_hest_get_payload(gdata); > - > - cxl_cper_post_event(CXL_CPER_EVENT_DRAM, rec, > - gdata->error_data_length); > - } else if (guid_equal(sec_type, &CPER_SEC_CXL_MEM_MODULE_GUID)) > { > - struct cxl_cper_event_rec *rec = > acpi_hest_get_payload(gdata); > - > - cxl_cper_post_event(CXL_CPER_EVENT_MEM_MODULE, rec, > - gdata->error_data_length); > + } else if (guid_equal(sec_type, &CPER_SEC_PCIE) || > + guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR) || > + guid_equal(sec_type, &CPER_SEC_CXL_GEN_MEDIA_GUID) || > + guid_equal(sec_type, &CPER_SEC_CXL_DRAM_GUID) || > + guid_equal(sec_type, &CPER_SEC_CXL_MEM_MODULE_GUID)) > { > + /* Reporting and subsystem delivery are handled by > extlog. */ > + continue; > } else { > - void *err = acpi_hest_get_payload(gdata); > - > ghes_defer_non_standard_event(gdata, sev); > - log_non_standard_event(sec_type, fru_id, fru_text, > - sec_sev, err, > - gdata->error_data_length); > } > } >
