qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 00/13] RCU implementation for QEMU


From: Paolo Bonzini
Subject: [Qemu-devel] [RFC PATCH 00/13] RCU implementation for QEMU
Date: Mon, 15 Aug 2011 14:08:27 -0700

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 via email to

[Prev in Thread] Current Thread [Next in Thread]