cpu->exit_request is used to kick vCPU threads into qemu_wait_io_event(). The code that handles the signaling of cpu->exit_request is messy, mostly due to no one ever taking a look at it as a whole. In fact already in commit 4b8523ee896 ("kvm: First step to push iothread lock out of inner run loop", 2015-07-01), the read of cpu->exit_request was placed outside the BQL critical section without much attention to ordering; and it only got worse from that point, in no small part due to a young and naive me.
This series is complementary to the cpu->interrupt_request cleanups that Igor did in "memory: reintroduce BQL-free fine-grained PIO/MMIO" (https://lore.kernel.org/qemu-devel/20250808120137.2208800-1-imamm...@redhat.com/T/), and is organized like this: - patches 1-3 clean up accesses to the variable to properly use qatomic_* accessors - patches 4-6 makes it possible to use cpu_exit() for all accelerators - patch 7 removes from user-mode emulation a hack that is only needed by system emulation - patch 8 cleans up the way in which exit_request is cleared. Paolo Paolo Bonzini (8): accel: use store_release/load_acquire for cross-thread exit_request accel/hvf: check exit_request before running the vCPU accel: use atomic accesses for exit_request accel/tcg: introduce tcg_kick_vcpu_thread cpus: remove TCG-ism from cpu_exit() cpus: properly kick CPUs out of inner execution loop tcg/user: do not set exit_request gratuitously accel: make all calls to qemu_wait_io_event look the same docs/devel/tcg-icount.rst | 2 +- accel/tcg/tcg-accel-ops-mttcg.h | 3 --- include/exec/cpu-common.h | 1 + accel/dummy-cpus.c | 2 +- accel/hvf/hvf-accel-ops.c | 2 +- accel/kvm/kvm-accel-ops.c | 3 ++- accel/kvm/kvm-all.c | 21 +++++++--------- accel/tcg/cpu-exec.c | 27 +++++++++++++++++--- accel/tcg/tcg-accel-ops-mttcg.c | 12 ++------- accel/tcg/tcg-accel-ops-rr.c | 42 ++++++++++++++++--------------- accel/tcg/tcg-accel-ops.c | 4 +-- bsd-user/main.c | 2 +- cpu-common.c | 3 ++- hw/core/cpu-common.c | 7 +++--- hw/ppc/ppc.c | 2 ++ hw/ppc/spapr_hcall.c | 7 +++--- hw/ppc/spapr_rtas.c | 2 +- linux-user/main.c | 2 +- replay/replay-events.c | 3 ++- system/cpu-timers.c | 6 ++--- system/cpus.c | 6 +++-- target/arm/hvf/hvf.c | 3 +++ target/arm/tcg/mte_helper.c | 2 +- target/i386/hvf/hvf.c | 3 +++ target/i386/kvm/hyperv.c | 1 - target/i386/kvm/kvm.c | 2 +- target/i386/nvmm/nvmm-accel-ops.c | 8 +++--- target/i386/nvmm/nvmm-all.c | 9 +++---- target/i386/whpx/whpx-accel-ops.c | 6 ++--- target/i386/whpx/whpx-all.c | 11 ++++---- 30 files changed, 106 insertions(+), 98 deletions(-) -- 2.50.1