aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Dovgalyuk <Pavel.Dovgaluk@gmail.com>2020-05-22 09:47:58 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-26 06:45:30 -0400
commit255ae6e2158c743717bed76c9a2365ee4bcd326e (patch)
treedc7f618e37866f5cf1b402e29cb7e59b8d2de094
parent5d971f9e672507210e77d020d89e0e89165c8fc9 (diff)
replay: notify the main loop when there are no instructions
When QEMU is executed in console mode without any external event sources, main loop may sleep for a very long time. But in case of replay there is another event source - event log. This patch adds main loop notification when the vCPU loop has nothing to do and main loop should process the inputs from the event log. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> Message-Id: <159013007895.28110.2020104406699709721.stgit@pasha-ThinkPad-X280> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--cpus.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/cpus.c b/cpus.c
index 7317ae06b9..41d1c5099f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1374,6 +1374,13 @@ static int64_t tcg_get_icount_limit(void)
}
}
+static void notify_aio_contexts(void)
+{
+ /* Wake up other AioContexts. */
+ qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
+ qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL);
+}
+
static void handle_icount_deadline(void)
{
assert(qemu_in_vcpu_thread());
@@ -1382,9 +1389,7 @@ static void handle_icount_deadline(void)
QEMU_TIMER_ATTR_ALL);
if (deadline == 0) {
- /* Wake up other AioContexts. */
- qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
- qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL);
+ notify_aio_contexts();
}
}
}
@@ -1407,6 +1412,10 @@ static void prepare_icount_for_run(CPUState *cpu)
cpu->icount_extra = cpu->icount_budget - insns_left;
replay_mutex_lock();
+
+ if (cpu->icount_budget == 0 && replay_has_checkpoint()) {
+ notify_aio_contexts();
+ }
}
}