aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/rcu.h
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2022-02-22 14:01:49 +0000
committerKevin Wolf <kwolf@redhat.com>2022-03-04 18:14:40 +0100
commit17c78154b0ba2237c37f3e4a95140b754cb6ac8b (patch)
tree1360dd34b521b7673485629f74977323d754e7d7 /include/qemu/rcu.h
parent47b74464565713208c218f115918bf760a528afb (diff)
downloadqemu-17c78154b0ba2237c37f3e4a95140b754cb6ac8b.zip
qemu-17c78154b0ba2237c37f3e4a95140b754cb6ac8b.tar.gz
qemu-17c78154b0ba2237c37f3e4a95140b754cb6ac8b.tar.bz2
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 'include/qemu/rcu.h')
-rw-r--r--include/qemu/rcu.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index e69efbd..b063c6f 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -29,6 +29,7 @@
#include "qemu/atomic.h"
#include "qemu/notify.h"
#include "qemu/sys_membarrier.h"
+#include "qemu/coroutine-tls.h"
#ifdef __cplusplus
extern "C" {
@@ -76,11 +77,11 @@ struct rcu_reader_data {
NotifierList force_rcu;
};
-extern __thread struct rcu_reader_data rcu_reader;
+QEMU_DECLARE_CO_TLS(struct rcu_reader_data, rcu_reader)
static inline void rcu_read_lock(void)
{
- struct rcu_reader_data *p_rcu_reader = &rcu_reader;
+ struct rcu_reader_data *p_rcu_reader = get_ptr_rcu_reader();
unsigned ctr;
if (p_rcu_reader->depth++ > 0) {
@@ -96,7 +97,7 @@ static inline void rcu_read_lock(void)
static inline void rcu_read_unlock(void)
{
- struct rcu_reader_data *p_rcu_reader = &rcu_reader;
+ struct rcu_reader_data *p_rcu_reader = get_ptr_rcu_reader();
assert(p_rcu_reader->depth != 0);
if (--p_rcu_reader->depth > 0) {