[PATCH v2 00/12] accel/tcg: Improve tb_flush usage

Richard Henderson posted 12 patches 5 days, 12 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250923023922.3102471-1-richard.henderson@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Laurent Vivier <laurent@vivier.eu>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
There is a newer version of this series
include/exec/cpu-common.h       |  1 +
include/exec/tb-flush.h         | 18 ++++++--------
target/alpha/helper.h           |  1 -
accel/tcg/tb-maint.c            | 43 +++++++++++----------------------
accel/tcg/tcg-accel-ops-mttcg.c |  7 ++++++
accel/tcg/tcg-accel-ops-rr.c    |  9 +++++--
accel/tcg/tcg-all.c             | 21 ++++++++++++++++
accel/tcg/translate-all.c       |  5 +---
gdbstub/system.c                |  4 ---
gdbstub/user.c                  |  3 ---
hw/core/cpu-system.c            |  8 ------
hw/ppc/spapr_hcall.c            |  4 +--
linux-user/mmap.c               |  4 +--
linux-user/syscall.c            |  2 +-
plugins/core.c                  |  6 ++---
plugins/loader.c                |  2 +-
target/alpha/sys_helper.c       |  6 -----
target/alpha/translate.c        | 21 +++++-----------
target/riscv/csr.c              |  3 ---
target/riscv/tcg/tcg-cpu.c      |  3 ++-
20 files changed, 75 insertions(+), 96 deletions(-)
[PATCH v2 00/12] accel/tcg: Improve tb_flush usage
Posted by Richard Henderson 5 days, 12 hours ago
It is too easy to mis-use tb_flush().  For instance, because of
the cpu argument, some parts assumed that it needed to call the
global flush function for every cpu.  It is easy to forget that
the flush is not complete when the call returns: we have merely
queued work to the cpu run loop.  So: remove tb_flush and expose
only the core as tb_flush__exclusive, to be used only when we
are already within an exclusive context.

In some cases (gdbstub, alpha, riscv, ppc spapr),
we can eliminate the need for tb_flush completely.

Changes for v2:
  - Assert exclusivity in tb_flush__exclusive (pbo)


r~


Richard Henderson (12):
  gdbstub: Remove tb_flush uses
  accel/tcg: Split out tb_flush__exclusive
  target/alpha: Simplify call_pal implementation
  target/riscv: Record misa_ext in TCGTBCPUState.cs_base
  accel/tcg: Move post-load tb_flush to vm_change_state hook
  hw/ppc/spapr: Use tb_invalidate_phys_range in h_page_init
  linux-user: Use tb_flush_exclusive to start second thread
  plugins: Use tb_flush__exclusive
  accel/tcg: Introduce EXCP_TB_FLUSH
  accel/tcg: Use EXCP_TB_FLUSH in tb_gen_code
  accel/tcg: Remove tb_flush
  accel/tcg: Tighten assert in tb_flush__exclusive

 include/exec/cpu-common.h       |  1 +
 include/exec/tb-flush.h         | 18 ++++++--------
 target/alpha/helper.h           |  1 -
 accel/tcg/tb-maint.c            | 43 +++++++++++----------------------
 accel/tcg/tcg-accel-ops-mttcg.c |  7 ++++++
 accel/tcg/tcg-accel-ops-rr.c    |  9 +++++--
 accel/tcg/tcg-all.c             | 21 ++++++++++++++++
 accel/tcg/translate-all.c       |  5 +---
 gdbstub/system.c                |  4 ---
 gdbstub/user.c                  |  3 ---
 hw/core/cpu-system.c            |  8 ------
 hw/ppc/spapr_hcall.c            |  4 +--
 linux-user/mmap.c               |  4 +--
 linux-user/syscall.c            |  2 +-
 plugins/core.c                  |  6 ++---
 plugins/loader.c                |  2 +-
 target/alpha/sys_helper.c       |  6 -----
 target/alpha/translate.c        | 21 +++++-----------
 target/riscv/csr.c              |  3 ---
 target/riscv/tcg/tcg-cpu.c      |  3 ++-
 20 files changed, 75 insertions(+), 96 deletions(-)

-- 
2.43.0