From: Philippe Mathieu-Daudé Date: Tue, 28 Oct 2025 05:41:58 +0000 (+0100) Subject: accel/hvf: Guard hv_vcpu_run() between cpu_exec_start/end() calls X-Git-Tag: v10.2.0-rc1~28^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f34a5b6428f86944342498adc67d56e876d1003;p=thirdparty%2Fqemu.git accel/hvf: Guard hv_vcpu_run() between cpu_exec_start/end() calls Similarly to 1d78a3c3ab8 for KVM, wrap hv_vcpu_run() with cpu_exec_start/end(), so that the accelerator can perform pending operations while all vCPUs are quiescent. See also explanation in commit c265e976f46 ("cpus-common: lock-free fast path for cpu_exec_start/end"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell --- diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 79861dcacf..c882f4c89c 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2026,7 +2026,9 @@ int hvf_arch_vcpu_exec(CPUState *cpu) } bql_unlock(); + cpu_exec_start(cpu); r = hv_vcpu_run(cpu->accel->fd); + cpu_exec_end(cpu); bql_lock(); switch (r) { case HV_SUCCESS: diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 28d98659ec..16febbac48 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -992,9 +992,13 @@ int hvf_arch_vcpu_exec(CPUState *cpu) return EXCP_HLT; } + cpu_exec_start(cpu); + hv_return_t r = hv_vcpu_run_until(cpu->accel->fd, HV_DEADLINE_FOREVER); assert_hvf_ok(r); + cpu_exec_end(cpu); + ret = hvf_handle_vmexit(cpu); } while (ret == 0);