To ensure the vCPU state is flushed on each inner loop iteration, move the flush_cpu_state() inside it, right after the interrupt injection check (catching any interrupt changes from previous loop). Since flush_cpu_state() uses CPUState::vcpu_dirty field as a lazy synchronization mechanism, there is no performance penalty if the cache is clean. This got missed while refactoring the inner loop in commit 93ac76507. Fixes: 93ac765076a ("target/arm/hvf: Keep calling hv_vcpu_run() in loop") Signed-off-by: Philippe Mathieu-Daudé --- target/arm/hvf/hvf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 3eeb9f70de4..c14ea54a67f 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2598,8 +2598,6 @@ int hvf_arch_vcpu_exec(CPUState *cpu) } } - flush_cpu_state(cpu); - /* Inner vCPU loop */ do { if (!(cpu->singlestep_flags & SSTEP_NOIRQ) && @@ -2607,6 +2605,8 @@ int hvf_arch_vcpu_exec(CPUState *cpu) return EXCP_INTERRUPT; } + flush_cpu_state(cpu); + bql_unlock(); cpu_exec_start(cpu); r = hv_vcpu_run(cpu->accel->fd); -- 2.53.0