coroutine-ucontext: use QEMU_DEFINE_STATIC_CO_TLS()
commit34145a307d849d0b6734d0222a7aa0bb9eef7407
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 7 Mar 2022 15:38:51 +0000 (7 15:38 +0000)
committerKevin Wolf <kwolf@redhat.com>
Wed, 4 May 2022 13:55:23 +0000 (4 15:55 +0200)
treef7a3b008ee2db53d3a41e97da2e606637c73087e
parentecf3200703df77f9f5ac95e3cc8e1379e40cb36a
coroutine-ucontext: use QEMU_DEFINE_STATIC_CO_TLS()

Thread-Local Storage variables cannot be used directly from coroutine
code because the compiler may optimize TLS variable accesses across
qemu_coroutine_yield() calls. When the coroutine is re-entered from
another thread the TLS variables from the old thread must no longer be
used.

Use QEMU_DEFINE_STATIC_CO_TLS() for the current and leader variables.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220307153853.602859-2-stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
util/coroutine-ucontext.c