diff mbox series

[v2,03/28] accel/tcg: Use more accurate max_insns for tb_overflow

Message ID 20230222232715.15034-4-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg: Simplify temporary usage | expand

Commit Message

Richard Henderson Feb. 22, 2023, 11:26 p.m. UTC
Write back the number of insns that we attempt to translate,
so that if we longjmp out we have a more accurate limit for
the next attempt.  This results in fewer restarts when some
limit is consumed by few instructions.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/translator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Feb. 24, 2023, 8:07 a.m. UTC | #1
On 23/2/23 00:26, Richard Henderson wrote:
> Write back the number of insns that we attempt to translate,
> so that if we longjmp out we have a more accurate limit for
> the next attempt.  This results in fewer restarts when some
> limit is consumed by few instructions.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   accel/tcg/translator.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index fac1e8c465..62e8f28025 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -78,7 +78,7 @@  void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns,
     plugin_enabled = plugin_gen_tb_start(cpu, db, cflags & CF_MEMI_ONLY);
 
     while (true) {
-        db->num_insns++;
+        *max_insns = ++db->num_insns;
         ops->insn_start(db, cpu);
         tcg_debug_assert(db->is_jmp == DISAS_NEXT);  /* no early exit */