Introduce RCU-enabled DQs.
RFC PATCH 1/1 Introduce RCU-enabled DQs.
Add RCU-enabled variants on the existing bsd DQ facility. Each Q operation has the same interface as the existing (non-RCU) version. Also, each operation is implemented as macro for now.
Using the RCU-enabled DQ, existing DQ users will be able to convert to RCU without using a different list interface.
To accompany the RCU-enabled DQ, there is also a test file that uses concurrent readers to contend with a single updater.
This patchset builds on top of Paolo Bonzini's rcu tree:
https://github.com/bonzini/qemu/tree/rcu
Signed-off-by Mike Day <[email protected]>
--- docs/rcu.txt | 2 +- include/qemu/queue.h | 11 -- include/qemu/rcu_queue.h | 137 +++++++++++++++++++++++ tests/Makefile | 14 ++- tests/rcuq_test.c | 279 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 430 insertions(+), 13 deletions(-)
docs/rcu.txt +1 -1
@@ -106,7 +106,7 @@ The core RCU API is small: so that the reclaimer function can fetch the struct foo address and free it: - call_rcu1(foo_reclaim, &foo.rcu); + call_rcu1(&foo.rcu, foo_reclaim); void foo_reclaim(struct rcu_head *rp) {
include/qemu/queue.h +0 -11
@@ -139,17 +139,6 @@ struct { \ (elm)->field.le_prev = &(head)->lh_first; \ } while (/*CONSTCOND*/0) -#define QLIST_INSERT_HEAD_RCU (head, elm, field) do { \ - (elm)->field.le_prev = &(head)->lh_first; \ - (elm)->field.le_next = (head)->lh_first; \ - smp_wmb();/* fill elm before linking it */ \ -if ((head)->lh_first !=NULL ) { \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next; \ - } \ - (head)->lh_first = (elm); \ -smp_wmb (); \ -} while (/* CONSTCOND*/0) -#define QLIST_REMOVE (elm, field) do { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \
include/qemu/rcu_queue.h new file +137 -0
137 lines not on this page · raw message
tests/Makefile +13 -1
@@ -43,6 +43,8 @@ gcov-files-test-xbzrle-y = xbzrle.c check-unit-y += tests/test-cutils$(EXESUF) gcov-files-test-cutils-y += util/cutils.c check-unit-y += tests/test-mul64$(EXESUF) +check-unit-y += tests/test-tls$(EXESUF) +# all code tested by test-tls is inside tls.h gcov-files-test-mul64-y = util/host-utils.c check-unit-y += tests/test-tls$(EXESUF) # all code tested by test-tls is inside tls.h
@@ -53,6 +55,9 @@ gcov-files-test-int128-y = check-unit-y += tests/test-bitops$(EXESUF) check-unit-y += tests/rcutorture$(EXESUF) gcov-files-rcutorture-y = util/rcu.c +check-unit-y += tests/rcuq_test$(EXESUF) +gcov-files-rcuq_test-y = util/rcu.c +check-unit-y += tests/test-qdev-global-props$(EXESUF) check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
@@ -105,7 +110,7 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \ tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \ tests/test-qmp-commands.o tests/test-visitor-serialization.o \ tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \ - tests/test-tls.o tests/rcutorture.o + tests/test-tls.o tests/rcutorture.o tests/rcuq_test.o test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o
@@ -131,6 +136,13 @@ tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o tests/test-int128$(EXESUF): tests/test-int128.o tests/test-tls$(EXESUF): tests/test-tls.o libqemuutil.a tests/rcutorture$(EXESUF): tests/rcutorture.o libqemuutil.a +tests/rcuq_test$(EXESUF): tests/rcuq_test.o libqemuutil.a +tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ + hw/core/qdev.o hw/core/qdev-properties.o \ + hw/core/irq.o \ + qom/object.o qom/container.o qom/qom-qobject.o \ + $(test-qapi-obj-y) \ + libqemuutil.a libqemustub.a tests/test-qapi-types.c tests/test-qapi-types.h :\ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
tests/rcuq_test.c new file +279 -0
279 lines not on this page · raw message
Signature · 1 line
1.8.3.1