Skip to content

Commit

Permalink
util/async: Only call icount_notify_exit() if icount is enabled
Browse files Browse the repository at this point in the history
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20231208113529.74067-6-philmd@linaro.org>
  • Loading branch information
philmd committed Jan 19, 2024
1 parent 2412813 commit 72c603f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion accel/tcg/icount-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@ bool icount_configure(QemuOpts *opts, Error **errp)

void icount_notify_exit(void)
{
if (icount_enabled() && current_cpu) {
assert(icount_enabled());

if (current_cpu) {
qemu_cpu_kick(current_cpu);
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
}
Expand Down
2 changes: 1 addition & 1 deletion stubs/icount.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void icount_account_warp_timer(void)
{
abort();
}

void icount_notify_exit(void)
{
abort();
}
16 changes: 9 additions & 7 deletions util/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ 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();
if (unlikely(icount_enabled())) {
/*
* 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() */
Expand Down

0 comments on commit 72c603f

Please sign in to comment.