qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v5 00/73] per-CPU locks
@ 2018-12-13  5:03 Emilio G. Cota
  2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 01/73] cpu: convert queued work to a QSIMPLEQ Emilio G. Cota
                   ` (72 more replies)
  0 siblings, 73 replies; 82+ messages in thread
From: Emilio G. Cota @ 2018-12-13  5:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Paolo Bonzini, Alex Bennée

v4: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg05624.html

Changes since v4:

- Add R-b's -- thanks everyone!

- Rebase on v3.1.0
  + Add an additional conversion to cpu_interrupt_request in target/arm
    due to 89430fc6f8 ("target/arm: Correctly implement handling of
    HCR_EL2.{VI, VF}", 2018-11-13)

- s390x: add comment on why we explicitly acquire the cpu
  lock around cpu_halted and cpu_halted_set, as suggested
  by Alex and Cornelia.

- Drop the patch that reworked exclusive work.

- Add a couple of patches to finish the conversion of qom/cpu
  to cpu_halted and cpu_interrupt_request. I did this to try
  to reduce the diff of the main patch in this series (the
  one that converts the CPU loops to use per-CPU locks), but
  it's still pretty large.

- Rename all_cpu_threads_idle to qemu_tcg_rr_all_cpu_threads_idle.

- Upgrade from RFC to PATCH series. This series used to be an RFC because
  I was concerned about 3 issues:

  1. pause_all_vcpus() and start_exclusive() running at the same
  time, both called from vCPU threads. It turns out that
  pause_all_vcpus() is only called from a vCPU thread in KVM, and
  in KVM we don't use start/end_exclusive. So this should work fine,
  and in fact my concern is not new (we probably want to remove
  calls to pause_all_vcpus() from vCPU threads, but that is a
  fix that is orthogonal to this series).

  2. Possible deadlock if hotplug CPUs are added while
  pause_all_vcpus() executes, since after this series the latter
  function waits on the CPUs that are being shut down without the
  BQL held. I added a final check to pause_all_vcpus() to make sure
  that if such a race occurs, we detect it and redo the shut down
  for all vCPUs.

  3. TCG rr. Having a single condvar/mutex to wait on is very useful,
  since that way we can be woken up whenever _any_ CPU is kicked (via
  cpu->halt_cond). I managed to keep this logic by making the BQL recursive
  under the hood and pointing cpu->lock to the BQL. Note that the
  public interface of the BQL remains non-recursive (i.e. if we call
  qemu_mutex_lock_iothread() twice in a row, we'll hit an assert.);
  it is only in TCG rr mode where we use the BQL recursively.

I've tested all patches with `make check-qtest -j 30' for all targets.
The series is checkpatch-clean (just some warnings about __COVERITY__).

You can fetch it from:
  https://github.com/cota/qemu/tree/cpu-lock-v5

Thanks,

		Emilio
---
 accel/tcg/cpu-exec.c            |  40 ++--
 accel/tcg/cputlb.c              |  10 +-
 accel/tcg/tcg-all.c             |  12 +-
 accel/tcg/tcg-runtime.c         |   7 +
 accel/tcg/tcg-runtime.h         |   2 +
 accel/tcg/translate-all.c       |   2 +-
 cpus-common.c                   | 129 ++++++++----
 cpus.c                          | 422 ++++++++++++++++++++++++++++++++--------
 exec.c                          |   2 +-
 gdbstub.c                       |   2 +-
 hw/arm/omap1.c                  |   4 +-
 hw/arm/pxa2xx_gpio.c            |   2 +-
 hw/arm/pxa2xx_pic.c             |   2 +-
 hw/intc/s390_flic.c             |   4 +-
 hw/mips/cps.c                   |   2 +-
 hw/misc/mips_itu.c              |   4 +-
 hw/openrisc/cputimer.c          |   2 +-
 hw/ppc/e500.c                   |   4 +-
 hw/ppc/ppc.c                    |  12 +-
 hw/ppc/ppce500_spin.c           |   6 +-
 hw/ppc/spapr_cpu_core.c         |   4 +-
 hw/ppc/spapr_hcall.c            |   4 +-
 hw/ppc/spapr_rtas.c             |   6 +-
 hw/sparc/leon3.c                |   2 +-
 hw/sparc/sun4m.c                |   8 +-
 hw/sparc64/sparc64.c            |   8 +-
 include/qom/cpu.h               | 189 +++++++++++++++---
 qom/cpu.c                       |  25 ++-
 stubs/Makefile.objs             |   1 +
 stubs/cpu-lock.c                |  28 +++
 target/alpha/cpu.c              |   8 +-
 target/alpha/translate.c        |   6 +-
 target/arm/arm-powerctl.c       |   4 +-
 target/arm/cpu.c                |   8 +-
 target/arm/helper.c             |  16 +-
 target/arm/op_helper.c          |   2 +-
 target/cris/cpu.c               |   2 +-
 target/cris/helper.c            |   6 +-
 target/cris/translate.c         |   5 +-
 target/hppa/cpu.c               |   2 +-
 target/hppa/translate.c         |   3 +-
 target/i386/cpu.c               |   4 +-
 target/i386/cpu.h               |   2 +-
 target/i386/hax-all.c           |  36 ++--
 target/i386/helper.c            |   8 +-
 target/i386/hvf/hvf.c           |  16 +-
 target/i386/hvf/x86hvf.c        |  38 ++--
 target/i386/kvm.c               |  78 ++++----
 target/i386/misc_helper.c       |   2 +-
 target/i386/seg_helper.c        |  13 +-
 target/i386/svm_helper.c        |   6 +-
 target/i386/whpx-all.c          |  57 +++---
 target/lm32/cpu.c               |   2 +-
 target/lm32/op_helper.c         |   4 +-
 target/m68k/cpu.c               |   2 +-
 target/m68k/op_helper.c         |   2 +-
 target/m68k/translate.c         |   9 +-
 target/microblaze/cpu.c         |   2 +-
 target/microblaze/translate.c   |   4 +-
 target/mips/cpu.c               |  11 +-
 target/mips/kvm.c               |   4 +-
 target/mips/op_helper.c         |   8 +-
 target/mips/translate.c         |   4 +-
 target/moxie/cpu.c              |   2 +-
 target/nios2/cpu.c              |   2 +-
 target/openrisc/cpu.c           |   4 +-
 target/openrisc/sys_helper.c    |   4 +-
 target/ppc/excp_helper.c        |   8 +-
 target/ppc/helper_regs.h        |   2 +-
 target/ppc/kvm.c                |   8 +-
 target/ppc/translate.c          |   6 +-
 target/ppc/translate_init.inc.c |  36 ++--
 target/riscv/cpu.c              |   5 +-
 target/riscv/op_helper.c        |   2 +-
 target/s390x/cpu.c              |  28 ++-
 target/s390x/excp_helper.c      |   4 +-
 target/s390x/kvm.c              |   2 +-
 target/s390x/sigp.c             |   8 +-
 target/sh4/cpu.c                |   2 +-
 target/sh4/helper.c             |   2 +-
 target/sh4/op_helper.c          |   2 +-
 target/sparc/cpu.c              |   6 +-
 target/sparc/helper.c           |   2 +-
 target/unicore32/cpu.c          |   2 +-
 target/unicore32/softmmu.c      |   2 +-
 target/xtensa/cpu.c             |   6 +-
 target/xtensa/helper.c          |   2 +-
 target/xtensa/op_helper.c       |   2 +-
 88 files changed, 1015 insertions(+), 453 deletions(-)

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

end of thread, other threads:[~2018-12-17 12:59 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-13  5:03 [Qemu-devel] [PATCH v5 00/73] per-CPU locks Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 01/73] cpu: convert queued work to a QSIMPLEQ Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 02/73] cpu: rename cpu->work_mutex to cpu->lock Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 03/73] cpu: introduce cpu_mutex_lock/unlock Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 04/73] cpu: make qemu_work_cond per-cpu Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 05/73] cpu: move run_on_cpu to cpus-common Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 06/73] cpu: introduce process_queued_cpu_work_locked Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 07/73] cpu: make per-CPU locks an alias of the BQL in TCG rr mode Emilio G. Cota
2018-12-15  1:51   ` Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 08/73] tcg-runtime: define helper_cpu_halted_set Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 09/73] ppc: convert to helper_cpu_halted_set Emilio G. Cota
2018-12-15  9:00   ` David Gibson
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 10/73] cris: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 11/73] hppa: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 12/73] m68k: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 13/73] alpha: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 14/73] microblaze: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 15/73] cpu: define cpu_halted helpers Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 16/73] tcg-runtime: convert to cpu_halted_set Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 17/73] arm: convert to cpu_halted Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 18/73] ppc: " Emilio G. Cota
2018-12-15  9:02   ` David Gibson
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 19/73] sh4: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 20/73] i386: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 21/73] lm32: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 22/73] m68k: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 23/73] mips: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 24/73] riscv: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 25/73] s390x: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 26/73] sparc: " Emilio G. Cota
2018-12-17 12:53   ` Mark Cave-Ayland
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 27/73] xtensa: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 28/73] gdbstub: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 29/73] openrisc: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 30/73] cpu-exec: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 31/73] cpu: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 32/73] cpu: define cpu_interrupt_request helpers Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 33/73] ppc: use cpu_reset_interrupt Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 34/73] exec: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 35/73] i386: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 36/73] s390x: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 37/73] openrisc: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 38/73] arm: convert to cpu_interrupt_request Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 39/73] i386: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 40/73] i386/kvm: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 41/73] i386/hax-all: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 42/73] i386/whpx-all: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 43/73] i386/hvf: convert to cpu_request_interrupt Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 44/73] ppc: convert to cpu_interrupt_request Emilio G. Cota
2018-12-15  9:06   ` David Gibson
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 45/73] sh4: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 46/73] cris: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 47/73] hppa: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 48/73] lm32: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 49/73] m68k: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 50/73] mips: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 51/73] nios: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 52/73] s390x: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 53/73] alpha: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 54/73] moxie: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 55/73] sparc: " Emilio G. Cota
2018-12-17 12:57   ` Mark Cave-Ayland
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 56/73] openrisc: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 57/73] unicore32: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 58/73] microblaze: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 59/73] accel/tcg: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 60/73] cpu: convert to interrupt_request Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 61/73] cpu: call .cpu_has_work with the CPU lock held Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 62/73] cpu: introduce cpu_has_work_with_iothread_lock Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 63/73] ppc: convert to cpu_has_work_with_iothread_lock Emilio G. Cota
2018-12-15  9:07   ` David Gibson
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 64/73] mips: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 65/73] s390x: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 66/73] riscv: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 67/73] sparc: " Emilio G. Cota
2018-12-17 12:58   ` Mark Cave-Ayland
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 68/73] xtensa: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 69/73] cpu: rename all_cpu_threads_idle to qemu_tcg_rr_all_cpu_threads_idle Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 70/73] cpu: protect CPU state with cpu->lock instead of the BQL Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 71/73] cpus-common: release BQL earlier in run_on_cpu Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 72/73] cpu: add async_run_on_cpu_no_bql Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 73/73] cputlb: queue async flush jobs without the BQL Emilio G. Cota

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