qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [RFC PATCH 00/13] RCU implementation for QEMU
Date: Mon, 15 Aug 2011 14:08:27 -0700	[thread overview]
Message-ID: <1313442520-12062-1-git-send-email-pbonzini@redhat.com> (raw)

Hi,

this is a proof of concept of embedding RCU within QEMU.  While I had
already played a bit with liburcu (from which the algorithms are taken)
a while ago, discussions on the migration thread motivated me to
"finish" this series on the way to KVM Forum.

Unfortunately we cannot use liburcu directly for three reasons: 1) it
is not portable to Windows; 2) it is hardly packaged by distributions;
3) we have special needs for call_rcu to run callbacks under the global
lock, so we need to reimplement at least that part.  The amount of
duplicated code is quite small (around 400 lines of heavily-commented
code), so I think it is acceptable to do that.  The APIs are of course
compatible, so we can always switch later on.

Patches 1 to 4 are preparatory and add some synchronization primitives
that are missing in qemu-threads and used later on.  These wrap liburcu's
use of futexes so that we can make the code portable.  It should be
possible, but not easy, to convince upstream to switch.

Patches 5 to 6 add the main library and a test program.

Patches 7 and 8 add the QEMU-specific call_rcu implementation.  It also
uses some techniques from upstream, but it is more or less self-contained.

Patch 9 is an optimization that I have submitted upstream and will
hopefully be included there too.

Patch 10 marks quiescent states in QEMU's threads.  Patch 11 converts
the iohandlers to RCU---not particularly useful, but it lets us test
all this nice stuff, and especially the call_rcu machinery.  Finally,
patches 12 and 13 are an initial attempt at RCUifying the memory list
with zero overhead for the _write_ sides of the TCG execution threads.

Incomplet, but hopefully not incorrekt (upstream has a formal model of
the core RCU wakeup functionality, and I could adapt to model this
stuff too), so I thought I'd just throw this out.

Paolo Bonzini (13):
  add smp_mb()
  rename qemu_event_{init,read}
  qemu-threads: add QemuEvent
  qemu-threads: add QemuOnce
  add rcu library
  rcu: add rcutorture
  osdep: add qemu_msleep
  add call_rcu support
  rcu: avoid repeated system calls
  rcu: report quiescent states
  rcuify iohandlers
  split MRU ram list
  RCUify ram_list

 Makefile.objs       |    4 +-
 arch_init.c         |   14 ++
 compiler.h          |    2 +
 cpu-all.h           |    8 +-
 cpus.c              |   24 ++-
 exec.c              |  140 +++++++++++-----
 iohandler.c         |   45 +++---
 kvm-all.c           |    3 +
 os-win32.c          |    3 +
 osdep.h             |    1 +
 oslib-posix.c       |    7 +-
 oslib-win32.c       |    5 +
 qemu-barrier.h      |    2 +
 qemu-queue.h        |   11 ++
 qemu-thread-posix.c |  129 +++++++++++++++
 qemu-thread-posix.h |   13 ++
 qemu-thread-win32.c |   45 ++++++
 qemu-thread-win32.h |    9 +
 qemu-thread.h       |   11 ++
 rcu-call.c          |  189 ++++++++++++++++++++++
 rcu-pointer.h       |  119 ++++++++++++++
 rcu.c               |  226 +++++++++++++++++++++++++++
 rcu.h               |  145 +++++++++++++++++
 rcutorture.c        |  433 +++++++++++++++++++++++++++++++++++++++++++++++++++
 vl.c                |    4 +
 25 files changed, 1513 insertions(+), 79 deletions(-)
 create mode 100644 rcu-call.c
 create mode 100644 rcu-pointer.h
 create mode 100644 rcu.c
 create mode 100644 rcu.h
 create mode 100644 rcutorture.c

-- 
1.7.6

             reply	other threads:[~2011-08-15 21:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-15 21:08 Paolo Bonzini [this message]
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 01/13] add smp_mb() Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 02/13] rename qemu_event_{init,read} Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 03/13] qemu-threads: add QemuEvent Paolo Bonzini
2011-08-17 17:09   ` Blue Swirl
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 04/13] qemu-threads: add QemuOnce Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 05/13] add rcu library Paolo Bonzini
2011-08-17 17:04   ` Blue Swirl
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 06/13] rcu: add rcutorture Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 07/13] osdep: add qemu_msleep Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 08/13] add call_rcu support Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 09/13] rcu: avoid repeated system calls Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 10/13] rcu: report quiescent states Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 11/13] rcuify iohandlers Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 12/13] split MRU ram list Paolo Bonzini
2011-08-15 21:08 ` [Qemu-devel] [RFC PATCH 13/13] RCUify ram_list 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=1313442520-12062-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).