Here is an RCU implementation based on liburcu. I had posted something like this a couple years ago, but there have been many changes:
- more portable code - adjusted for all the threads that we have now - updated atomic operations for GCC 4.8 - lots of documentation There is plenty of documentation in the patches, so I'm not being too verbose here... Giving a shot to rcutorture on a weak memory-model machine (PPC) would be nice. It's available on my github repo as branch rcu. rcutorture works on Linux-x86. My WINE setup has some problem with glib right now. Paolo Paolo Bonzini (12): add a header file for atomic operations 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 aio-posix.c | 7 + aio-win32.c | 10 +- block/raw-posix.c | 3 + block/raw-win32.c | 3 + cpus.c | 3 + docs/atomics.txt | 322 ++++++++++++++++++++++++++++++++ docs/rcu.txt | 435 ++++++++++++++++++++++++++++++++++++++++++++ hw/9pfs/virtio-9p-synth.c | 1 + hw/display/qxl.c | 3 +- hw/virtio/vhost.c | 9 +- include/qemu/atomic.h | 223 +++++++++++++++++++---- include/qemu/queue.h | 13 ++ include/qemu/rcu-pointer.h | 110 +++++++++++ include/qemu/rcu.h | 207 +++++++++++++++++++++ include/qemu/thread-posix.h | 8 + include/qemu/thread-win32.h | 4 + include/qemu/thread.h | 10 +- kvm-all.c | 3 + libcacard/Makefile | 3 +- main-loop.c | 5 + migration.c | 5 +- tests/Makefile | 5 +- tests/rcutorture.c | 387 +++++++++++++++++++++++++++++++++++++++ tests/test-thread-pool.c | 8 +- util/Makefile.objs | 1 + util/qemu-thread-posix.c | 174 +++++++++++++++++- util/qemu-thread-win32.c | 44 ++++- util/rcu.c | 320 ++++++++++++++++++++++++++++++++ 28 files changed, 2270 insertions(+), 56 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 util/rcu.c -- 1.8.1.4