summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorPavel Dovgalyuk2022-05-27 12:46:13 +0200
committerPaolo Bonzini2022-06-06 09:26:53 +0200
commit75bbe5e5ec2867f098a31bfd553a1fb084289cc2 (patch)
tree895f50a89f5f2505921e4d5d4b763527c643f0fb /util
parentreplay: fix event queue flush for qemu shutdown (diff)
downloadqemu-75bbe5e5ec2867f098a31bfd553a1fb084289cc2.tar.gz
qemu-75bbe5e5ec2867f098a31bfd553a1fb084289cc2.tar.xz
qemu-75bbe5e5ec2867f098a31bfd553a1fb084289cc2.zip
replay: notify vCPU when BH is scheduled
vCPU execution should be suspended when new BH is scheduled. This is needed to avoid guest timeouts caused by the long cycles of the execution. In replay mode execution may hang when vCPU sleeps and block event comes to the queue. This patch adds notification which wakes up vCPU or interrupts execution of guest code. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> -- v2: changed first_cpu to current_cpu (suggested by Richard Henderson) v4: moved vCPU notification to aio_bh_enqueue (suggested by Paolo Bonzini) Message-Id: <165364837317.688121.17680519919871405281.stgit@pasha-ThinkPad-X280> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/async.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/async.c b/util/async.c
index 554ba70cca..63434ddae4 100644
--- a/util/async.c
+++ b/util/async.c
@@ -33,6 +33,7 @@
#include "block/raw-aio.h"
#include "qemu/coroutine_int.h"
#include "qemu/coroutine-tls.h"
+#include "sysemu/cpu-timers.h"
#include "trace.h"
/***********************************************************/
@@ -84,6 +85,13 @@ static void aio_bh_enqueue(QEMUBH *bh, unsigned new_flags)
}
aio_notify(ctx);
+ /*
+ * Workaround for record/replay.
+ * vCPU execution should be suspended when new BH is set.
+ * This is needed to avoid guest timeouts caused
+ * by the long cycles of the execution.
+ */
+ icount_notify_exit();
}
/* Only called from aio_bh_poll() and aio_ctx_finalize() */