From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 00/30] Memory API changes for 1.6: RCU-protected address space dispatch
Date: Fri, 28 Jun 2013 20:26:19 +0200 [thread overview]
Message-ID: <1372444009-11544-1-git-send-email-pbonzini@redhat.com> (raw)
These are the next part in the unlocked address space dispatch work.
At the end of this series, address space dispatch runs under an RCU
critical section (RCU is hopefully well documented in patch 8).
It becomes then possible to add unlocked variants of address_space_rw.
Compared to Liu Ping Fan's approach posted last year, the path I followed
is more long-winded but requires much less changes in device models that
choose to adopt lockless MMIO dispatching. This is nice, because it
produces an API that is easier to use.
In addition, I decided to sidestep complicated locking discussions by
using RCU. RCU can bulk-protect the read side of all data structures
while remaining extremely light-weight. The write side needs its own
lock, but in many cases it can simply be the BQL (very useful for things
that perform updates in callbacks!).
Patches 1-3 add reference counting to FlatView, which is independent
from the other patches but a necessary prerequisite to protect
as->current_map with RCU.
Patches 4-17 implement RCU and update existing threads to be RCU-friendly
(again, more information is in docs/rcu.txt) whenever necessary.
A lot of the code here comes from the URCU library.
Patches 18-30 do the rest of the work, using fresh copies of the dispatch
data structures on every update. Several patches in this series are
based on Liu Ping Fan's work, which I made more fine-grained.
The diffstat looks daunting; however, note that ~50% of the new lines
are documentation and test cases. Available from branch rcu of my
github repository.
I don't plan to send a pull request for this series anytime soon,
but reviews and testing are welcome.
Paolo
Liu Ping Fan (1):
exec: change well-known physical sections to macros
Paolo Bonzini (29):
memory: access FlatView from a local variable
memory: use a new FlatView pointer on every topology update
memory: add reference counting to FlatView
add a header file for atomic operations
exec: do not use qemu/tls.h
qemu-thread: add TLS wrappers
qemu-thread: add QemuEvent
rcu: add rcu library
qemu-thread: register threads with RCU
rcu: add call_rcu
rcu: add rcutorture
rcu: allow nested calls to rcu_thread_offline/rcu_thread_online
qemu-thread: report RCU quiescent states
event loop: report RCU quiescent states
cpus: report RCU quiescent states
block: report RCU quiescent states
migration: report RCU quiescent states
memory: protect current_map by RCU
memory: avoid ref/unref in memory_region_find
exec: separate current memory map from the one being built
memory: move MemoryListener declaration earlier
exec: move listener from AddressSpaceDispatch to AddressSpace
exec: separate current radix tree from the one being built
exec: put memory map in AddressSpaceDispatch
exec: remove cur_map
exec: change some APIs to take AddressSpaceDispatch
exec: change iotlb APIs to take AddressSpaceDispatch
exec: add a reference to the region returned by
address_space_translate
exec: put address space dispatch under RCU critical section
aio-posix.c | 8 +
aio-win32.c | 11 +-
block/raw-posix.c | 3 +
block/raw-win32.c | 3 +
configure | 21 +++
cpus.c | 3 +
cputlb.c | 9 +-
docs/atomics.txt | 345 ++++++++++++++++++++++++++++++++++
docs/rcu.txt | 440 ++++++++++++++++++++++++++++++++++++++++++++
exec.c | 244 ++++++++++++++++--------
hw/9pfs/virtio-9p-synth.c | 1 +
hw/display/qxl.c | 3 +-
hw/ppc/spapr_iommu.c | 10 +-
hw/virtio/vhost.c | 9 +-
include/exec/cpu-all.h | 14 +-
include/exec/cputlb.h | 9 +-
include/exec/memory.h | 77 ++++----
include/qemu/atomic.h | 190 +++++++++++++++----
include/qemu/queue.h | 13 ++
include/qemu/rcu-pointer.h | 110 +++++++++++
include/qemu/rcu.h | 180 ++++++++++++++++++
include/qemu/thread-posix.h | 8 +
include/qemu/thread-win32.h | 4 +
include/qemu/thread.h | 10 +-
include/qemu/tls.h | 125 +++++++++++--
kvm-all.c | 3 +
libcacard/Makefile | 3 +-
main-loop.c | 6 +
memory.c | 127 +++++++++----
migration.c | 5 +-
tests/Makefile | 10 +-
tests/rcutorture.c | 439 +++++++++++++++++++++++++++++++++++++++++++
tests/test-thread-pool.c | 8 +-
tests/test-tls.c | 87 +++++++++
util/Makefile.objs | 1 +
util/qemu-thread-posix.c | 174 +++++++++++++++++-
util/qemu-thread-win32.c | 61 +++++-
util/rcu.c | 312 +++++++++++++++++++++++++++++++
38 files changed, 2857 insertions(+), 229 deletions(-)
create mode 100644 docs/atomics.txt
create mode 100644 docs/rcu.txt
create mode 100644 include/qemu/rcu-pointer.h
create mode 100644 include/qemu/rcu.h
create mode 100644 tests/rcutorture.c
create mode 100644 tests/test-tls.c
create mode 100644 util/rcu.c
--
1.8.1.4
next reply other threads:[~2013-06-28 18:27 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 18:26 Paolo Bonzini [this message]
2013-06-28 18:26 ` [Qemu-devel] [PATCH 01/30] memory: access FlatView from a local variable Paolo Bonzini
2013-06-28 20:01 ` Anthony Liguori
2013-06-28 18:26 ` [Qemu-devel] [PATCH 02/30] memory: use a new FlatView pointer on every topology update Paolo Bonzini
2013-06-28 20:02 ` Anthony Liguori
2013-06-28 18:26 ` [Qemu-devel] [PATCH 03/30] memory: add reference counting to FlatView Paolo Bonzini
2013-06-28 20:07 ` Anthony Liguori
2013-06-28 18:26 ` [Qemu-devel] [PATCH 04/30] add a header file for atomic operations Paolo Bonzini
2013-06-28 20:41 ` Anthony Liguori
2013-07-01 10:21 ` Paolo Bonzini
2013-07-01 13:00 ` Anthony Liguori
2013-07-01 13:04 ` Paolo Bonzini
2013-07-01 13:20 ` Anthony Liguori
2013-07-04 5:24 ` liu ping fan
2013-07-01 11:08 ` Peter Maydell
2013-07-03 2:24 ` liu ping fan
2013-07-03 5:59 ` Paolo Bonzini
2013-07-03 7:07 ` liu ping fan
2013-06-28 18:26 ` [Qemu-devel] [PATCH 05/30] exec: do not use qemu/tls.h Paolo Bonzini
2013-06-28 20:43 ` Anthony Liguori
2013-06-28 23:53 ` Ed Maste
2013-07-01 10:16 ` Paolo Bonzini
2013-06-29 10:55 ` Peter Maydell
2013-07-01 10:45 ` Paolo Bonzini
2013-07-01 11:05 ` Peter Maydell
2013-07-01 16:21 ` Paolo Bonzini
2013-07-01 16:26 ` Peter Maydell
2013-07-01 20:52 ` Paolo Bonzini
2013-07-01 21:34 ` Peter Maydell
2013-07-02 13:40 ` Andreas Färber
2013-07-02 14:06 ` Alexander Graf
2013-06-28 18:26 ` [Qemu-devel] [PATCH 06/30] qemu-thread: add TLS wrappers Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 07/30] qemu-thread: add QemuEvent Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 08/30] rcu: add rcu library Paolo Bonzini
2013-07-01 9:47 ` Jan Kiszka
2013-06-28 18:26 ` [Qemu-devel] [PATCH 09/30] qemu-thread: register threads with RCU Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 10/30] rcu: add call_rcu Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 11/30] rcu: add rcutorture Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 12/30] rcu: allow nested calls to rcu_thread_offline/rcu_thread_online Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 13/30] qemu-thread: report RCU quiescent states Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 14/30] event loop: " Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 15/30] cpus: " Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 16/30] block: " Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 17/30] migration: " Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 18/30] memory: protect current_map by RCU Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 19/30] memory: avoid ref/unref in memory_region_find Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 20/30] exec: change well-known physical sections to macros Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 21/30] exec: separate current memory map from the one being built Paolo Bonzini
2013-07-02 14:41 ` Jan Kiszka
2013-06-28 18:26 ` [Qemu-devel] [PATCH 22/30] memory: move MemoryListener declaration earlier Paolo Bonzini
2013-07-02 14:41 ` Jan Kiszka
2013-06-28 18:26 ` [Qemu-devel] [PATCH 23/30] exec: move listener from AddressSpaceDispatch to AddressSpace Paolo Bonzini
2013-07-02 14:41 ` Jan Kiszka
2013-06-28 18:26 ` [Qemu-devel] [PATCH 24/30] exec: separate current radix tree from the one being built Paolo Bonzini
2013-07-02 14:41 ` Jan Kiszka
2013-06-28 18:26 ` [Qemu-devel] [PATCH 25/30] exec: put memory map in AddressSpaceDispatch Paolo Bonzini
2013-07-02 14:42 ` Jan Kiszka
2013-07-02 15:08 ` Paolo Bonzini
2013-07-02 15:48 ` Jan Kiszka
2013-06-28 18:26 ` [Qemu-devel] [PATCH 26/30] exec: remove cur_map Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 27/30] exec: change some APIs to take AddressSpaceDispatch Paolo Bonzini
2013-07-02 14:47 ` Jan Kiszka
2013-06-28 18:26 ` [Qemu-devel] [PATCH 28/30] exec: change iotlb " Paolo Bonzini
2013-07-02 10:00 ` Jan Kiszka
2013-06-28 18:26 ` [Qemu-devel] [PATCH 29/30] exec: add a reference to the region returned by address_space_translate Paolo Bonzini
2013-06-28 18:26 ` [Qemu-devel] [PATCH 30/30] exec: put address space dispatch under RCU critical section Paolo Bonzini
2013-06-28 19:38 ` Jan Kiszka
2013-07-01 11:48 ` Paolo Bonzini
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=1372444009-11544-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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).