[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 5/6] util/async: Only call icount_notify_exit() if icount is e
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 5/6] util/async: Only call icount_notify_exit() if icount is enabled |
Date: |
Fri, 8 Dec 2023 12:35:27 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/icount-common.c | 4 +++-
stubs/icount.c | 2 +-
util/async.c | 16 +++++++++-------
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c
index f0f8fc7f1c..a4a747d1dc 100644
--- a/accel/tcg/icount-common.c
+++ b/accel/tcg/icount-common.c
@@ -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);
}
diff --git a/stubs/icount.c b/stubs/icount.c
index 7055c13725..b060b03a73 100644
--- a/stubs/icount.c
+++ b/stubs/icount.c
@@ -37,7 +37,7 @@ void icount_account_warp_timer(void)
{
abort();
}
-
void icount_notify_exit(void)
{
+ abort();
}
diff --git a/util/async.c b/util/async.c
index 8f90ddc304..9007642c27 100644
--- a/util/async.c
+++ b/util/async.c
@@ -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() */
--
2.41.0
- [PATCH v3 0/6] sysemu/replay: Restrict icount to TCG system emulation, Philippe Mathieu-Daudé, 2023/12/08
- [PATCH v3 2/6] system/vl: Evaluate icount after accelerator options are parsed, Philippe Mathieu-Daudé, 2023/12/08
- [PATCH v3 3/6] sysemu/cpu-timers: Introduce ICountMode enumerator, Philippe Mathieu-Daudé, 2023/12/08
- [PATCH v3 1/6] sysemu/cpu-timers: Have icount_configure() return a boolean, Philippe Mathieu-Daudé, 2023/12/08
- [PATCH v3 4/6] target/arm: Ensure icount is enabled when emulating INST_RETIRED, Philippe Mathieu-Daudé, 2023/12/08
- [PATCH v3 5/6] util/async: Only call icount_notify_exit() if icount is enabled,
Philippe Mathieu-Daudé <=
- [PATCH v3 6/6] sysemu/replay: Restrict icount to system emulation, Philippe Mathieu-Daudé, 2023/12/08