diff mbox

[12/17] kvm: use atomic_read/atomic_set to access cpu->exit_request

Message ID 20170227124551.8673-13-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Feb. 27, 2017, 12:45 p.m. UTC
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 kvm-all.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/kvm-all.c b/kvm-all.c
index 5bbdc44..1c6f117 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1931,7 +1931,7 @@  int kvm_cpu_exec(CPUState *cpu)
     DPRINTF("kvm_cpu_exec()\n");
 
     if (kvm_arch_process_async_events(cpu)) {
-        cpu->exit_request = 0;
+        atomic_set(&cpu->exit_request, 0);
         return EXCP_HLT;
     }
 
@@ -1946,7 +1946,7 @@  int kvm_cpu_exec(CPUState *cpu)
         }
 
         kvm_arch_pre_run(cpu, run);
-        if (cpu->exit_request) {
+        if (atomic_read(&cpu->exit_request)) {
             DPRINTF("interrupt exit requested\n");
             /*
              * KVM requires us to reenter the kernel after IO exits to complete
@@ -2069,7 +2069,7 @@  int kvm_cpu_exec(CPUState *cpu)
         vm_stop(RUN_STATE_INTERNAL_ERROR);
     }
 
-    cpu->exit_request = 0;
+    atomic_set(&cpu->exit_request, 0);
     return ret;
 }