qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Bug 1855617 Save registers to haxm when vcpu_dirty flag is set a


From: Alexey Romko
Subject: [PATCH] Bug 1855617 Save registers to haxm when vcpu_dirty flag is set and clear it. vcpu_dirty flag was set in initialization code and not cleared, so read attempts were skipped and snapshots didn't contain correct register values.
Date: Mon, 22 Jun 2020 14:45:20 +0000 (UTC)

Bug 1855617 Save registers to haxm when vcpu_dirty flag is
set and clear it. vcpu_dirty flag was set in initialization code and not
cleared, so read attempts were skipped and snapshots didn't contain correct
register values.

Signed-off-by: Alexey Romko <nevilad@yahoo.com>
---
 target/i386/hax-all.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)


diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
index f9c83fff25..8aea72db07 100644
--- a/target/i386/hax-all.c
+++ b/target/i386/hax-all.c
@@ -504,16 +504,15 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
     if (cpu->interrupt_request & CPU_INTERRUPT_INIT) {
         DPRINTF("\nhax_vcpu_hax_exec: handling INIT for %d\n",
                 cpu->cpu_index);
+        hax_cpu_synchronize_state(cpu);
         do_cpu_init(x86_cpu);
-        hax_vcpu_sync_state(env, 1);
     }
 
     if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) {
         DPRINTF("hax_vcpu_hax_exec: handling SIPI for %d\n",
                 cpu->cpu_index);
-        hax_vcpu_sync_state(env, 0);
+        hax_cpu_synchronize_state(cpu);
         do_cpu_sipi(x86_cpu);
-        hax_vcpu_sync_state(env, 1);
     }
 
     if (cpu->halted) {
@@ -534,6 +533,11 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
             break;
         }
 
+        if (cpu->vcpu_dirty) {
+            hax_vcpu_sync_state(env, 1);
+            cpu->vcpu_dirty = false;
+        }
+
         hax_vcpu_interrupt(env);
 
         qemu_mutex_unlock_iothread();
@@ -621,8 +625,10 @@ static void do_hax_cpu_synchronize_state(CPUState *cpu, 
run_on_cpu_data arg)
 {
     CPUArchState *env = cpu->env_ptr;
 
-    hax_arch_get_registers(env);
-    cpu->vcpu_dirty = true;
+    if (!cpu->vcpu_dirty) {
+        hax_arch_get_registers(env);
+        cpu->vcpu_dirty = true;
+    }
 }
 
 void hax_cpu_synchronize_state(CPUState *cpu)
-- 
2.15.0.windows.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]