summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPavel Dovgalyuk <pavel.dovgaluk@gmail.com>2019-09-17 12:54:06 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2019-10-03 12:58:02 +0200
commit86cf9e154632cb28d749db0ea47946fba8cf3f09 (patch)
tree086110b8cf0dbdeac2871d328c37cbdd8437a2c7
parentb2aca78cb2faf96c2c96993c2f0d4ef3440e1d84 (diff)
downloadfocaccia-qemu-86cf9e154632cb28d749db0ea47946fba8cf3f09.tar.gz
focaccia-qemu-86cf9e154632cb28d749db0ea47946fba8cf3f09.zip
replay: don't synchronize memory operations in replay mode
Commit 9458a9a1df1a4c719e24512394d548c1fc7abd22 added synchronization
of vCPU and migration operations through calling run_on_cpu operation.
However, in replay mode this synchronization is unneeded, because
I/O and vCPU threads are already synchronized.
This patch disables such synchronization for record/replay mode.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
-rw-r--r--exec.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/exec.c b/exec.c
index 8a0a6613b1..1d6e4d8608 100644
--- a/exec.c
+++ b/exec.c
@@ -2959,8 +2959,17 @@ static void tcg_log_global_after_sync(MemoryListener *listener)
      * by pushing the migration thread's memory read after the vCPU thread has
      * written the memory.
      */
-    cpuas = container_of(listener, CPUAddressSpace, tcg_as_listener);
-    run_on_cpu(cpuas->cpu, do_nothing, RUN_ON_CPU_NULL);
+    if (replay_mode == REPLAY_MODE_NONE) {
+        /*
+         * VGA can make calls to this function while updating the screen.
+         * In record/replay mode this causes a deadlock, because
+         * run_on_cpu waits for rr mutex. Therefore no races are possible
+         * in this case and no need for making run_on_cpu when
+         * record/replay is not enabled.
+         */
+        cpuas = container_of(listener, CPUAddressSpace, tcg_as_listener);
+        run_on_cpu(cpuas->cpu, do_nothing, RUN_ON_CPU_NULL);
+    }
 }
 
 static void tcg_commit(MemoryListener *listener)