qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: imammedo@redhat.com, richard.henderson@linaro.org, peterx@redhat.com
Subject: [PATCH 0/8] accel, cpus: clean up cpu->exit_request
Date: Fri,  8 Aug 2025 20:58:57 +0200	[thread overview]
Message-ID: <20250808185905.62776-1-pbonzini@redhat.com> (raw)

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-imammedo@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



             reply	other threads:[~2025-08-08 19:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 18:58 Paolo Bonzini [this message]
2025-08-08 18:58 ` [PATCH 1/8] accel: use store_release/load_acquire for cross-thread exit_request Paolo Bonzini
2025-08-09 22:41   ` Richard Henderson
2025-08-11 19:31   ` Peter Xu
2025-08-08 18:58 ` [PATCH 2/8] accel/hvf: check exit_request before running the vCPU Paolo Bonzini
2025-08-08 21:28   ` Philippe Mathieu-Daudé
2025-08-09 23:09   ` Richard Henderson
2025-08-11  7:06     ` Paolo Bonzini
2025-08-08 18:59 ` [PATCH 3/8] accel: use atomic accesses for exit_request Paolo Bonzini
2025-08-08 21:04   ` Philippe Mathieu-Daudé
2025-08-09 23:10   ` Richard Henderson
2025-08-11 14:49   ` Alex Bennée
2025-08-11 19:33   ` Peter Xu
2025-08-08 18:59 ` [PATCH 4/8] accel/tcg: introduce tcg_kick_vcpu_thread Paolo Bonzini
2025-08-08 21:15   ` Philippe Mathieu-Daudé
2025-08-09 23:16     ` Richard Henderson
2025-08-09 23:26   ` Richard Henderson
2025-08-11  6:10     ` Paolo Bonzini
2025-08-11  8:33       ` Philippe Mathieu-Daudé
2025-08-11 13:34         ` Philippe Mathieu-Daudé
2025-08-08 18:59 ` [PATCH 5/8] cpus: remove TCG-ism from cpu_exit() Paolo Bonzini
2025-08-08 21:17   ` Philippe Mathieu-Daudé
2025-08-09 23:17   ` Richard Henderson
2025-08-08 18:59 ` [PATCH 6/8] cpus: properly kick CPUs out of inner execution loop Paolo Bonzini
2025-08-11 12:56   ` Alex Bennée
2025-08-08 18:59 ` [PATCH 7/8] tcg/user: do not set exit_request gratuitously Paolo Bonzini
2025-08-08 21:21   ` Philippe Mathieu-Daudé
2025-08-08 21:45     ` Paolo Bonzini
2025-08-08 18:59 ` [PATCH 8/8] accel: make all calls to qemu_wait_io_event look the same Paolo Bonzini
2025-08-08 21:24   ` Philippe Mathieu-Daudé
2025-08-09 23:34   ` Richard Henderson

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=20250808185905.62776-1-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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).