]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
accel/tcg: Improve buffer overflow in tb_gen_code
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 23 Sep 2025 20:26:53 +0000 (13:26 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 24 Sep 2025 17:29:43 +0000 (10:29 -0700)
If we only have one vcpu, or within cpu_exec_step_atomic,
we needn't jump all the way back out to the cpu loop to
empty the code gen buffer.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
accel/tcg/translate-all.c

index 31bc0f8bc586a7c25b17605ec0ec8863a6bca5dd..da9d7f1675276a2e0b24630f25c1cc719dbf80c0 100644 (file)
@@ -289,6 +289,10 @@ TranslationBlock *tb_gen_code(CPUState *cpu, TCGTBCPUState s)
     tb = tcg_tb_alloc(tcg_ctx);
     if (unlikely(!tb)) {
         /* flush must be done */
+        if (cpu_in_serial_context(cpu)) {
+            tb_flush__exclusive_or_serial();
+            goto buffer_overflow;
+        }
         queue_tb_flush(cpu);
         mmap_unlock();
         /* Make the execution loop process the flush as soon as possible.  */