[PATCH v3 4/4] arm64: ghes: pass MF_ACTION_REQUIRED to memory_failure when sea

From: Xie XiuQi
Date: Mon Dec 05 2022 - 10:44:01 EST


For synchronous external data abort case, pass MF_ACTION_REQUIRED to
memory_failure, ensure that error recovery is performed before
return to the user space.

Synchronous external data abort happened in current execution context,
so as the description for 'action required', MF_ACTION_REQUIRED flag
is needed.

``action optional'' if they are not immediately affected by the error
``action required'' if error happened in current execution context

Signed-off-by: Xie XiuQi <xiexiuqi@xxxxxxxxxx>
---
drivers/acpi/apei/ghes.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index ddc4da603215..043a91a7dd17 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -463,7 +463,7 @@ static bool ghes_do_memory_failure(u64 physical_addr, int flags)
}

static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata,
- int sev)
+ int sev, int notify_type)
{
int flags = -1;
int sec_sev = ghes_severity(gdata->error_severity);
@@ -472,6 +472,9 @@ static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata,
if (!(mem_err->validation_bits & CPER_MEM_VALID_PA))
return false;

+ if (notify_type == ACPI_HEST_NOTIFY_SEA)
+ flags |= MF_ACTION_REQUIRED;
+
/* iff following two events can be handled properly by now */
if (sec_sev == GHES_SEV_CORRECTED &&
(gdata->flags & CPER_SEC_ERROR_THRESHOLD_EXCEEDED))
@@ -513,7 +516,12 @@ static bool ghes_handle_arm_hw_error(struct acpi_hest_generic_data *gdata,
* and don't filter out 'corrected' error here.
*/
if (is_cache && has_pa) {
- queued = ghes_do_memory_failure(err_info->physical_fault_addr, 0);
+ int flags = 0;
+
+ if (notify_type == ACPI_HEST_NOTIFY_SEA)
+ flags |= MF_ACTION_REQUIRED;
+
+ queued = ghes_do_memory_failure(err_info->physical_fault_addr, flags);
p += err_info->length;
continue;
}
@@ -657,7 +665,7 @@ static bool ghes_do_proc(struct ghes *ghes,
ghes_edac_report_mem_error(sev, mem_err);

arch_apei_report_mem_error(sev, mem_err);
- queued = ghes_handle_memory_failure(gdata, sev);
+ queued = ghes_handle_memory_failure(gdata, sev, notify_type);
}
else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
ghes_handle_aer(gdata);
--
2.20.1