summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStefan Hajnoczi2022-02-22 15:01:49 +0100
committerKevin Wolf2022-03-04 18:14:40 +0100
commit17c78154b0ba2237c37f3e4a95140b754cb6ac8b (patch)
tree1360dd34b521b7673485629f74977323d754e7d7 /tests
parentutil/async: replace __thread with QEMU TLS macros (diff)
downloadqemu-17c78154b0ba2237c37f3e4a95140b754cb6ac8b.tar.gz
qemu-17c78154b0ba2237c37f3e4a95140b754cb6ac8b.tar.xz
qemu-17c78154b0ba2237c37f3e4a95140b754cb6ac8b.zip
rcu: use coroutine TLS macros
RCU may be used from coroutines. Standard __thread variables cannot be used by coroutines. Use the coroutine TLS macros instead. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20220222140150.27240-4-stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/rcutorture.c10
-rw-r--r--tests/unit/test-rcu-list.c4
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/unit/rcutorture.c b/tests/unit/rcutorture.c
index de6f649058..495a4e6f42 100644
--- a/tests/unit/rcutorture.c
+++ b/tests/unit/rcutorture.c
@@ -122,7 +122,7 @@ static void *rcu_read_perf_test(void *arg)
rcu_register_thread();
- *(struct rcu_reader_data **)arg = &rcu_reader;
+ *(struct rcu_reader_data **)arg = get_ptr_rcu_reader();
qatomic_inc(&nthreadsrunning);
while (goflag == GOFLAG_INIT) {
g_usleep(1000);
@@ -148,7 +148,7 @@ static void *rcu_update_perf_test(void *arg)
rcu_register_thread();
- *(struct rcu_reader_data **)arg = &rcu_reader;
+ *(struct rcu_reader_data **)arg = get_ptr_rcu_reader();
qatomic_inc(&nthreadsrunning);
while (goflag == GOFLAG_INIT) {
g_usleep(1000);
@@ -253,7 +253,7 @@ static void *rcu_read_stress_test(void *arg)
rcu_register_thread();
- *(struct rcu_reader_data **)arg = &rcu_reader;
+ *(struct rcu_reader_data **)arg = get_ptr_rcu_reader();
while (goflag == GOFLAG_INIT) {
g_usleep(1000);
}
@@ -304,7 +304,7 @@ static void *rcu_update_stress_test(void *arg)
struct rcu_stress *cp = qatomic_read(&rcu_stress_current);
rcu_register_thread();
- *(struct rcu_reader_data **)arg = &rcu_reader;
+ *(struct rcu_reader_data **)arg = get_ptr_rcu_reader();
while (goflag == GOFLAG_INIT) {
g_usleep(1000);
@@ -347,7 +347,7 @@ static void *rcu_fake_update_stress_test(void *arg)
{
rcu_register_thread();
- *(struct rcu_reader_data **)arg = &rcu_reader;
+ *(struct rcu_reader_data **)arg = get_ptr_rcu_reader();
while (goflag == GOFLAG_INIT) {
g_usleep(1000);
}
diff --git a/tests/unit/test-rcu-list.c b/tests/unit/test-rcu-list.c
index 49641e1936..64b81ae058 100644
--- a/tests/unit/test-rcu-list.c
+++ b/tests/unit/test-rcu-list.c
@@ -171,7 +171,7 @@ static void *rcu_q_reader(void *arg)
rcu_register_thread();
- *(struct rcu_reader_data **)arg = &rcu_reader;
+ *(struct rcu_reader_data **)arg = get_ptr_rcu_reader();
qatomic_inc(&nthreadsrunning);
while (qatomic_read(&goflag) == GOFLAG_INIT) {
g_usleep(1000);
@@ -206,7 +206,7 @@ static void *rcu_q_updater(void *arg)
long long n_removed_local = 0;
struct list_element *el, *prev_el;
- *(struct rcu_reader_data **)arg = &rcu_reader;
+ *(struct rcu_reader_data **)arg = get_ptr_rcu_reader();
qatomic_inc(&nthreadsrunning);
while (qatomic_read(&goflag) == GOFLAG_INIT) {
g_usleep(1000);