[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] target/arm: Retry pushing CPER error if necessary
From: |
Gavin Shan |
Subject: |
[PATCH 4/4] target/arm: Retry pushing CPER error if necessary |
Date: |
Fri, 14 Feb 2025 14:16:35 +1000 |
The error -1 is returned if the previously reported CPER error
hasn't been claimed. The virtual machine is terminated due to
abort(). It's conflicting to the ideal behaviour that the affected
vCPU retries pushing the CPER error in this case since the vCPU
can't proceed its execution.
Move the chunk of code to push CPER error to a separate helper
report_memory_errors() and retry the request when the return
value from acpi_ghes_memory_errors() is greater than zero.
Signed-off-by: Gavin Shan <gshan@redhat.com>
---
target/arm/kvm.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 5c0bf99aec..9f063f6053 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -2362,6 +2362,30 @@ int kvm_arch_get_registers(CPUState *cs, Error **errp)
return ret;
}
+static void report_memory_error(CPUState *c, hwaddr paddr)
+{
+ int ret;
+
+ while (true) {
+ /* Retry if the previously report error hasn't been claimed */
+ ret = acpi_ghes_memory_errors(ACPI_HEST_SRC_ID_SEA, paddr, true);
+ if (ret <= 0) {
+ break;
+ }
+
+ bql_unlock();
+ g_usleep(1000);
+ bql_lock();
+ }
+
+ if (ret == 0) {
+ kvm_inject_arm_sea(c);
+ } else {
+ error_report("Error %d to report memory error", ret);
+ abort();
+ }
+}
+
void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)
{
ram_addr_t ram_addr;
@@ -2387,12 +2411,7 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void
*addr)
*/
if (code == BUS_MCEERR_AR) {
kvm_cpu_synchronize_state(c);
- if (!acpi_ghes_memory_errors(ACPI_HEST_SRC_ID_SEA, paddr,
false)) {
- kvm_inject_arm_sea(c);
- } else {
- error_report("failed to record the error");
- abort();
- }
+ report_memory_error(c, paddr);
}
return;
}
--
2.48.1
- [PATCH 0/4] target/arm: Improvement on memory error handling, Gavin Shan, 2025/02/13
- [PATCH 1/4] acpi/ghes: Make ghes_record_cper_errors() static, Gavin Shan, 2025/02/13
- [PATCH 2/4] acpi/ghes: Use error_report() in ghes_record_cper_errors(), Gavin Shan, 2025/02/13
- [PATCH 3/4] acpi/ghes: Allow retry to write CPER errors, Gavin Shan, 2025/02/13
- [PATCH 4/4] target/arm: Retry pushing CPER error if necessary,
Gavin Shan <=
- Re: [PATCH 4/4] target/arm: Retry pushing CPER error if necessary, Igor Mammedov, 2025/02/19
- Re: [PATCH 4/4] target/arm: Retry pushing CPER error if necessary, Gavin Shan, 2025/02/21
- Re: [PATCH 4/4] target/arm: Retry pushing CPER error if necessary, Jonathan Cameron, 2025/02/21
- Re: [PATCH 4/4] target/arm: Retry pushing CPER error if necessary, Igor Mammedov, 2025/02/25
- Re: [PATCH 4/4] target/arm: Retry pushing CPER error if necessary, Gavin Shan, 2025/02/25
- Re: [PATCH 4/4] target/arm: Retry pushing CPER error if necessary, Jonathan Cameron, 2025/02/27
- Re: [PATCH 4/4] target/arm: Retry pushing CPER error if necessary, Gavin Shan, 2025/02/26
Re: [PATCH 0/4] target/arm: Improvement on memory error handling, Jonathan Cameron, 2025/02/14
Re: [PATCH 0/4] target/arm: Improvement on memory error handling, Jonathan Cameron, 2025/02/14