[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/50] cpus: use coroutine TLS macros for iothread_locked
|
From: |
Kevin Wolf |
|
Subject: |
[PULL 09/50] cpus: use coroutine TLS macros for iothread_locked |
|
Date: |
Fri, 4 Mar 2022 17:46:30 +0100 |
From: Stefan Hajnoczi <stefanha@redhat.com>
qemu_mutex_iothread_locked() 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-5-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
softmmu/cpus.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 035395ae13..d1ff3cfea1 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "monitor/monitor.h"
+#include "qemu/coroutine-tls.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-misc.h"
@@ -473,11 +474,11 @@ bool qemu_in_vcpu_thread(void)
return current_cpu && qemu_cpu_is_self(current_cpu);
}
-static __thread bool iothread_locked = false;
+QEMU_DEFINE_STATIC_CO_TLS(bool, iothread_locked)
bool qemu_mutex_iothread_locked(void)
{
- return iothread_locked;
+ return get_iothread_locked();
}
/*
@@ -490,13 +491,13 @@ void qemu_mutex_lock_iothread_impl(const char *file, int
line)
g_assert(!qemu_mutex_iothread_locked());
bql_lock(&qemu_global_mutex, file, line);
- iothread_locked = true;
+ set_iothread_locked(true);
}
void qemu_mutex_unlock_iothread(void)
{
g_assert(qemu_mutex_iothread_locked());
- iothread_locked = false;
+ set_iothread_locked(false);
qemu_mutex_unlock(&qemu_global_mutex);
}
--
2.35.1
- [PULL 00/50] Block layer patches, Kevin Wolf, 2022/03/04
- [PULL 01/50] crypto: perform permission checks under BQL, Kevin Wolf, 2022/03/04
- [PULL 05/50] block: move BQL logic of bdrv_co_invalidate_cache in bdrv_activate, Kevin Wolf, 2022/03/04
- [PULL 04/50] block: rename bdrv_invalidate_cache_all, blk_invalidate_cache and test_sync_op_invalidate_cache, Kevin Wolf, 2022/03/04
- [PULL 06/50] tls: add macros for coroutine-safe TLS variables, Kevin Wolf, 2022/03/04
- [PULL 08/50] rcu: use coroutine TLS macros, Kevin Wolf, 2022/03/04
- [PULL 09/50] cpus: use coroutine TLS macros for iothread_locked,
Kevin Wolf <=
- [PULL 11/50] qsd: Add pre-init argument parsing pass, Kevin Wolf, 2022/03/04
- [PULL 14/50] main-loop.h: introduce qemu_in_main_thread(), Kevin Wolf, 2022/03/04
- [PULL 15/50] main loop: macros to mark GS and I/O functions, Kevin Wolf, 2022/03/04
- [PULL 10/50] os-posix: Add os_set_daemonize(), Kevin Wolf, 2022/03/04
- [PULL 12/50] qsd: Add --daemonize, Kevin Wolf, 2022/03/04
- [PULL 07/50] util/async: replace __thread with QEMU TLS macros, Kevin Wolf, 2022/03/04
- [PULL 13/50] iotests/185: Add post-READY quit tests, Kevin Wolf, 2022/03/04
- [PULL 21/50] block/block-backend.c: assertions for block-backend, Kevin Wolf, 2022/03/04