qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] linux-user: Call tcg_flush_jmp_cache() before re-using threads
@ 2025-01-02 18:25 Philippe Mathieu-Daudé
  2025-01-02 18:25 ` [PATCH 1/3] linux-user: Only include 'exec/tb-flush.h' header when necessary Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-02 18:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Ilya Leoshkevich, Alex Bennée, Paolo Bonzini,
	Pierrick Bouvier, Riku Voipio, Richard Henderson, Laurent Vivier,
	Philippe Mathieu-Daudé

Fix a bug reported by Ilya in:
https://lore.kernel.org/qemu-devel/uuuk6a2vo24yrrqrchjxaeko3utqshrdu6txcnqziokpg7dkom@4l4kd3dqh6jc/

Commit bb6cf6f0168 ("accel/tcg: Factor tcg_cpu_reset_hold()
out") wanted to restrict tlb_flush() to system emulation,
but inadvertently also restricted tcg_flush_jmp_cache(),
which was before called on user emulation via:

  Realize -> Reset -> cpu_common_reset_hold()

Since threads (vCPUs) use a common CPUJumpCache, when many
threads are created / joined, they eventually end re-using
a CPUJumpCache entry, which was cleared when the first vCPU
was allocated (via Realize) but then stayed dirty.

Have cpu_exec_reset_hold() call the common tcg_exec_reset()
helper on user emulation, eventually calling tcg_flush_jmp_cache().

Philippe Mathieu-Daudé (3):
  linux-user: Only include 'exec/tb-flush.h' header when necessary
  accel/tcg: Factor out common tcg_exec_reset() helper
  accel/tcg: Implement cpu_exec_reset_hold() on user emulation

 accel/tcg/internal-common.h | 1 +
 linux-user/user-internals.h | 1 -
 accel/tcg/cpu-exec-common.c | 6 ++++++
 accel/tcg/tcg-accel-ops.c   | 4 ++--
 accel/tcg/user-exec-stub.c  | 4 ----
 accel/tcg/user-exec.c       | 5 +++++
 linux-user/mmap.c           | 1 +
 linux-user/syscall.c        | 1 +
 8 files changed, 16 insertions(+), 7 deletions(-)

-- 
2.47.1



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-01-22  0:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-02 18:25 [PATCH 0/3] linux-user: Call tcg_flush_jmp_cache() before re-using threads Philippe Mathieu-Daudé
2025-01-02 18:25 ` [PATCH 1/3] linux-user: Only include 'exec/tb-flush.h' header when necessary Philippe Mathieu-Daudé
2025-01-09 22:13   ` Ilya Leoshkevich
2025-01-22  0:41   ` Pierrick Bouvier
2025-01-02 18:25 ` [PATCH 2/3] accel/tcg: Factor out common tcg_exec_reset() helper Philippe Mathieu-Daudé
2025-01-09 22:16   ` Ilya Leoshkevich
2025-01-22  0:41   ` Pierrick Bouvier
2025-01-02 18:25 ` [PATCH 3/3] accel/tcg: Implement cpu_exec_reset_hold() on user emulation Philippe Mathieu-Daudé
2025-01-09 23:43   ` Ilya Leoshkevich
2025-01-14 20:52     ` Ilya Leoshkevich
2025-01-22  0:46   ` Pierrick Bouvier
2025-01-09 10:59 ` [PATCH 0/3] linux-user: Call tcg_flush_jmp_cache() before re-using threads Philippe Mathieu-Daudé

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).