diff options
author | Stefan Hajnoczi | 2022-03-07 16:38:52 +0100 |
---|---|---|
committer | Kevin Wolf | 2022-05-04 15:55:23 +0200 |
commit | ac387a08a9c9f6b36757da912f0339c25f421f90 (patch) | |
tree | ffa9b6c7c13e59bcab5c6ad511a4c4b2d318c74b /util/block-helpers.c | |
parent | coroutine-ucontext: use QEMU_DEFINE_STATIC_CO_TLS() (diff) | |
download | qemu-ac387a08a9c9f6b36757da912f0339c25f421f90.tar.gz qemu-ac387a08a9c9f6b36757da912f0339c25f421f90.tar.xz qemu-ac387a08a9c9f6b36757da912f0339c25f421f90.zip |
coroutine: 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.
The alloc_pool QSLIST needs a typedef so the return value of
get_ptr_alloc_pool() can be stored in a local variable.
One example of why this code is necessary: a coroutine that yields
before calling qemu_coroutine_create() to create another coroutine is
affected by the TLS issue.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220307153853.602859-3-stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'util/block-helpers.c')
0 files changed, 0 insertions, 0 deletions