diff mbox series

[v2,3/5] util/async: Only call icount_notify_exit() if icount is enabled

Message ID 20231207154550.65087-4-philmd@linaro.org
State New
Headers show
Series sysemu/replay: Restrict icount to TCG system emulation | expand

Commit Message

Philippe Mathieu-Daudé Dec. 7, 2023, 3:45 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 stubs/icount.c |  2 +-
 util/async.c   | 16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

Comments

Richard Henderson Dec. 7, 2023, 10:17 p.m. UTC | #1
On 12/7/23 07:45, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   stubs/icount.c |  2 +-
>   util/async.c   | 16 +++++++++-------
>   2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/stubs/icount.c b/stubs/icount.c
> index f8e6a014b8..a5202e2dd9 100644
> --- a/stubs/icount.c
> +++ b/stubs/icount.c
> @@ -43,7 +43,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();
> +    }

If you're going to do this, remove the test in the non-stub icount_notify_exit.


r~
diff mbox series

Patch

diff --git a/stubs/icount.c b/stubs/icount.c
index f8e6a014b8..a5202e2dd9 100644
--- a/stubs/icount.c
+++ b/stubs/icount.c
@@ -43,7 +43,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() */