This is the first step of pushing down the AioContext lock. Bottom halves are already protected by their own lock, use it also for walking_bh and for the handlers list (including walking_handlers). The (lock, walking_foo) pair is wrapped into the QemuLockCnt primitive.
Paolo Paolo Bonzini (10): aio: rename bh_lock to list_lock qemu-thread: introduce QemuLockCnt aio: make ctx->list_lock a QemuLockCnt, subsuming ctx->walking_bh qemu-thread: optimize QemuLockCnt with futexes on Linux aio: tweak walking in dispatch phase aio-posix: remove walking_handlers, protecting AioHandler list with list_lock aio-win32: remove walking_handlers, protecting AioHandler list with list_lock aio: document locking aio: push aio_context_acquire/release down to dispatching async: optimize aio_bh_poll aio-posix.c | 81 ++++----- aio-win32.c | 107 ++++++------ async.c | 47 +++--- docs/lockcnt.txt | 342 ++++++++++++++++++++++++++++++++++++++ docs/multiple-iothreads.txt | 5 +- include/block/aio.h | 38 ++--- include/qemu/futex.h | 36 ++++ include/qemu/thread.h | 19 +++ util/Makefile.objs | 1 + util/lockcnt.c | 395 ++++++++++++++++++++++++++++++++++++++++++++ util/qemu-thread-posix.c | 25 +-- util/trace-events | 10 ++ 12 files changed, 955 insertions(+), 151 deletions(-) create mode 100644 docs/lockcnt.txt create mode 100644 include/qemu/futex.h create mode 100644 util/lockcnt.c -- 2.9.3