]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
accel/hvf: Guard hv_vcpu_run() between cpu_exec_start/end() calls
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 28 Oct 2025 05:41:58 +0000 (06:41 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 31 Oct 2025 16:26:46 +0000 (16:26 +0000)
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é <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/hvf/hvf.c
target/i386/hvf/hvf.c

index 79861dcacf9767be1666f40462a454a2280fca65..c882f4c89cf5feb3433f3803f2a735363676bb20 100644 (file)
@@ -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:
index 28d98659ec2b5ee239c6b0bf65db0777885439cc..16febbac48f3df4148c540242949b9f3c21080f5 100644 (file)
@@ -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);