Introduce RCU-enabled DQs
RFC PATCH v3 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.
Changes since V2:
* reverted QLIST_FOREACH_REVERSE_RCU, it's not needed in the interface file. (But it is used in the test program.)
* added g_test support to the test program
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
--- docs/rcu.txt | 2 +- include/qemu/queue.h | 11 -- include/qemu/rcu_queue.h | 137 +++++++++++++++++++ tests/Makefile | 5 +- tests/rcuq_test.c | 337 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 479 insertions(+), 13 deletions(-) create mode 100644 include/qemu/rcu_queue.h create mode 100644 tests/rcuq_test.c
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 +4 -1
@@ -53,6 +53,8 @@ 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-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
@@ -105,7 +107,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 +133,7 @@ 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-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 +337 -0
337 lines not on this page · raw message
Signature · 1 line
1.8.3.1