qemu-e2k/tests
Paolo Bonzini 5f50be9b58 async: the main AioContext is only "current" if under the BQL
If we want to wake up a coroutine from a worker thread, aio_co_wake()
currently does not work.  In that scenario, aio_co_wake() calls
aio_co_enter(), but there is no current AioContext and therefore
qemu_get_current_aio_context() returns the main thread.  aio_co_wake()
then attempts to call aio_context_acquire() instead of going through
aio_co_schedule().

The default case of qemu_get_current_aio_context() was added to cover
synchronous I/O started from the vCPU thread, but the main and vCPU
threads are quite different.  The main thread is an I/O thread itself,
only running a more complicated event loop; the vCPU thread instead
is essentially a worker thread that occasionally calls
qemu_mutex_lock_iothread().  It is only in those critical sections
that it acts as if it were the home thread of the main AioContext.

Therefore, this patch detaches qemu_get_current_aio_context() from
iothreads, which is a useless complication.  The AioContext pointer
is stored directly in the thread-local variable, including for the
main loop.  Worker threads (including vCPU threads) optionally behave
as temporary home threads if they have taken the big QEMU lock,
but if that is not the case they will always schedule coroutines
on remote threads via aio_co_schedule().

With this change, the stub qemu_mutex_iothread_locked() must be changed
from true to false.  The previous value of true was needed because the
main thread did not have an AioContext in the thread-local variable,
but now it does have one.

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210609122234.544153-1-pbonzini@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
[eblake: tweak commit message per Vladimir's review]
Signed-off-by: Eric Blake <eblake@redhat.com>
2021-06-18 10:59:52 -05:00
..
acceptance tests/acceptance: tag various arm tests as TCG only 2021-06-07 14:42:47 +01:00
bench
data
decode decodetree: Extend argument set syntax to allow types 2021-05-01 11:45:35 -07:00
docker * Update the references to some doc files (use *.rst instead of *.txt) 2021-06-02 17:08:11 +01:00
fp tests/fp: Enable more tests 2021-06-03 14:09:03 -07:00
guest-debug
image-fuzzer
include
keys
migration tests/migration: introduce multifd into guestperf 2021-05-13 18:21:14 +01:00
multiboot
perf/block/qcow2
plugin plugins/syscall: Added a table-like summary output 2021-05-25 16:52:50 +01:00
qapi-schema docs: fix references to docs/devel/build-system.rst 2021-06-02 06:51:09 +02:00
qemu-iotests Block layer patches 2021-06-02 19:34:03 +01:00
qtest hw/audio/sb16: Avoid assertion by restricting I/O sampling rate range 2021-06-17 11:55:23 +02:00
rocker
tcg target/arm: Fix mte page crossing test 2021-06-16 14:33:51 +01:00
tsan
uefi-test-tools
unit async: the main AioContext is only "current" if under the BQL 2021-06-18 10:59:52 -05:00
vm tests/vm: expose --source-path to scripts to find extra files 2021-06-07 14:42:47 +01:00
vmstate-static-checker-data
check-block.sh
dbus-vmstate-daemon.sh
Makefile.include
meson.build
requirements.txt acceptance tests: bump Avocado version to 88.1 2021-06-01 16:21:21 -04:00
test-qht-par.c
vhost-user-bridge.c