From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <laurent@vivier.eu>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Kyle Evans" <kevans@freebsd.org>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Warner Losh" <imp@bsdimp.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Riku Voipio" <riku.voipio@iki.fi>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-stable@nongnu.org
Subject: [PATCH v2 4/4] accel/tcg: Always call tcg_flush_jmp_cache() on reset
Date: Fri, 3 May 2024 14:25:26 +0200 [thread overview]
Message-ID: <20240503122526.28312-5-philmd@linaro.org> (raw)
In-Reply-To: <20240503122526.28312-1-philmd@linaro.org>
In commit bb6cf6f016 ("accel/tcg: Factor tcg_cpu_reset_hold() out")
we unfortunately restricted the tcg_flush_jmp_cache() to system
emulation. Move it to the common tcg_exec_cpu_reset_hold() handler
so user emulation gets the jmp_cache initialized when threads
are created.
Remove the NULL check in tcg_flush_jmp_cache() from commit 4e4fa6c12d
("accel/tcg: Complete cpu initialization before registration") which
was a band-aid fix for incorrect commit bb6cf6f016.
Cc: qemu-stable@nongnu.org
Fixes: bb6cf6f016 ("accel/tcg: Factor tcg_cpu_reset_hold() out")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/cpu-exec.c | 2 ++
accel/tcg/sysemu/tcg-accel-ops.c | 2 --
accel/tcg/translate-all.c | 5 -----
3 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 1bf85c324d..7e04df2902 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -36,6 +36,7 @@
#include "exec/replay-core.h"
#include "sysemu/tcg.h"
#include "exec/helper-proto-common.h"
+#include "exec/tb-flush.h"
#include "tb-jmp-cache.h"
#include "tb-hash.h"
#include "tb-context.h"
@@ -1099,4 +1100,5 @@ void tcg_exec_unrealizefn(CPUState *cpu)
void tcg_exec_cpu_reset_hold(CPUState *cpu)
{
+ tcg_flush_jmp_cache(cpu);
}
diff --git a/accel/tcg/sysemu/tcg-accel-ops.c b/accel/tcg/sysemu/tcg-accel-ops.c
index 82c8368f87..13e450c088 100644
--- a/accel/tcg/sysemu/tcg-accel-ops.c
+++ b/accel/tcg/sysemu/tcg-accel-ops.c
@@ -34,7 +34,6 @@
#include "qemu/timer.h"
#include "exec/exec-all.h"
#include "exec/hwaddr.h"
-#include "exec/tb-flush.h"
#include "exec/gdbstub.h"
#include "../internal-common.h"
#include "hw/core/cpu.h"
@@ -83,7 +82,6 @@ int tcg_cpu_exec(CPUState *cpu)
static void tcg_cpu_reset_hold(CPUState *cpu)
{
tcg_exec_cpu_reset_hold(cpu);
- tcg_flush_jmp_cache(cpu);
tlb_flush(cpu);
}
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 83cc14fbde..93202fa3c1 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -663,11 +663,6 @@ void tcg_flush_jmp_cache(CPUState *cpu)
{
CPUJumpCache *jc = cpu->tb_jmp_cache;
- /* During early initialization, the cache may not yet be allocated. */
- if (unlikely(jc == NULL)) {
- return;
- }
-
for (int i = 0; i < TB_JMP_CACHE_SIZE; i++) {
qatomic_set(&jc->array[i].tb, NULL);
}
--
2.41.0
prev parent reply other threads:[~2024-05-03 12:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 12:25 [PATCH v2 0/4] accel/tcg: Call tcg_flush_jmp_cache() again when creating user-mode cpu Philippe Mathieu-Daudé
2024-05-03 12:25 ` [PATCH v2 1/4] accel/tcg: Move system emulation files under sysemu/ subdirectory Philippe Mathieu-Daudé
2024-05-03 12:30 ` Philippe Mathieu-Daudé
2024-05-03 12:25 ` [PATCH v2 2/4] accel/tcg: Do not define cpu_exec_reset_hold() as stub Philippe Mathieu-Daudé
2024-05-03 12:25 ` [PATCH v2 3/4] accel/tcg: Introduce common tcg_exec_cpu_reset_hold() method Philippe Mathieu-Daudé
2024-05-03 12:25 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240503122526.28312-5-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=iii@linux.ibm.com \
--cc=imp@bsdimp.com \
--cc=kevans@freebsd.org \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).