qemu-e2k/scripts
Emanuele Giuseppe Esposito e6d3f7a602 block-coroutine-wrapper.py: introduce annotations that take the graph rdlock
Add co_wrapper_bdrv_rdlock and co_wrapper_mixed_bdrv_rdlock option to
the block-coroutine-wrapper.py script.

This "_bdrv_rdlock" option takes and releases the graph rdlock when a
coroutine function is created.

This means that when used together with "_mixed", the function marked
with co_wrapper_mixed_bdrv_rdlock will support both coroutine and
non-coroutine case, and in the latter case it will create a coroutine
that takes and releases the rdlock. When called from a coroutine, the
caller must already hold the graph lock.

Example:
void co_wrapper_mixed_bdrv_rdlock bdrv_f1();

Becomes

static void bdrv_co_enter_f1()
{
    bdrv_graph_co_rdlock();
    bdrv_co_function();
    bdrv_graph_co_rdunlock();
}

void bdrv_f1()
{
    if (qemu_in_coroutine) {
        assume_graph_lock();
        bdrv_co_function();
    } else {
        qemu_co_enter(bdrv_co_enter_f1);
        ...
    }
}

When used alone, the function will not work in coroutine context, and
when called in non-coroutine context it will create a new coroutine that
takes care of taking and releasing the rdlock automatically.

Example:
void co_wrapper_bdrv_rdlock bdrv_f1();

Becomes

static void bdrv_co_enter_f1()
{
    bdrv_graph_co_rdlock();
    bdrv_co_function();
    bdrv_graph_co_rdunlock();
}

void bdrv_f1()
{
    assert(!qemu_in_coroutine());
    qemu_co_enter(bdrv_co_enter_f1);
    ...
}

About their usage:
- co_wrapper does not take the rdlock, so it can be used also outside
  the block layer.
- co_wrapper_mixed will be used by many blk_* functions, since the
  coroutine function needs to call blk_wait_while_drained() and
  the rdlock *must* be taken afterwards, otherwise it's a deadlock.
  In the future this annotation will go away, and blk_* will use
  co_wrapper directly.
- co_wrapper_bdrv_rdlock will be used by BlockDriver callbacks, ideally
  by all of them in the future.
- co_wrapper_mixed_bdrv_rdlock will be used by the remaining functions
  that are still called by coroutine and non-coroutine context. In the
  future this annotation will go away, as we will split such mixed
  functions.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20221207131838.239125-17-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-12-15 16:08:23 +01:00
..
ci scripts/ci/setup: spice-server only on x86 aarch64 2022-10-06 11:53:20 +01:00
coccinelle cleanup: Tweak and re-run return_directly.cocci 2022-12-14 16:19:35 +01:00
codeconverter
coverity-scan coverity: put NUBus under m68k component 2022-09-18 09:17:40 +02:00
kvm vmxcap: add tertiary execution controls 2022-05-12 14:23:19 +02:00
modules
oss-fuzz oss-fuzz: ensure base_copy is a generic-fuzzer 2022-07-22 19:01:44 +02:00
performance
qapi qapi: Drop temporary logic to support conversion step by step 2022-12-14 20:05:07 +01:00
qemu-guest-agent
qemugdb
qmp python: rename qemu.aqmp to qemu.qmp 2022-04-21 11:01:00 -04:00
simplebench python: rename qemu.aqmp to qemu.qmp 2022-04-21 11:01:00 -04:00
tracetool trace: fix compilation with lttng-ust >= 2.13 2022-04-01 13:06:07 +02:00
analyse-9p-simpletrace.py
analyse-locks-simpletrace.py
analyze-inclusions scripts/analyze-inclusions: drop qemu-common.h from analysis 2022-04-21 16:56:55 +04:00
analyze-migration.py analyze-migration.py: fix extract contents ('-x') errors 2021-10-23 20:28:56 +02:00
archive-source.sh Remove the slirp submodule (i.e. compile only with an external libslirp) 2022-09-26 17:23:47 +02:00
block-coroutine-wrapper.py block-coroutine-wrapper.py: introduce annotations that take the graph rdlock 2022-12-15 16:08:23 +01:00
check_sparse.py
checkpatch.pl checkpatch: typo fix 2022-11-10 10:17:07 -05:00
clean-header-guards.pl disas: Remove libvixl disassembler 2022-07-05 10:15:49 +02:00
clean-includes disas: Remove libvixl disassembler 2022-07-05 10:15:49 +02:00
cleanup-trace-events.pl
cocci-macro-file.h compiler.h: replace QEMU_NORETURN with G_NORETURN 2022-04-21 17:03:51 +04:00
cpu-x86-uarch-abi.py python: rename qemu.aqmp to qemu.qmp 2022-04-21 11:01:00 -04:00
decodetree.py
device-crash-test tests: run 'device-crash-test' from tests/venv 2022-06-06 09:26:54 +02:00
disas-objdump.pl
dump-guest-memory.py
entitlement.sh scripts/entitlement.sh: Use backward-compatible cp flags 2021-11-30 22:25:58 +01:00
extract-vsssdk-headers
feature_to_c.sh Add missing include statement for global xml_builtin 2022-11-06 09:48:42 +01:00
fix-multiline-comments.sh
gensyscalls.sh linux-user: Add LoongArch syscall support 2022-07-04 11:08:57 +05:30
get_maintainer.pl
git-submodule.sh scripts: check if .git exists before checking submodule status 2022-10-27 11:54:37 +01:00
git.orderfile
hxtool
kernel-doc
main.c configure, meson: move C++ compiler detection to meson.build 2022-10-01 21:16:36 +02:00
make-config-poison.sh configure, meson: move config-poison.h to meson 2022-01-12 14:09:06 +01:00
make-release roms/edk2: Only initialize required submodules 2021-10-20 16:26:19 -07:00
meson-buildoptions.py meson: Prefix each element of firmware path 2022-07-13 16:58:57 +02:00
meson-buildoptions.sh gtk: disable GTK Clipboard with a new meson option 2022-11-23 12:15:06 +01:00
meson.build trace: move configuration from configure to Meson 2021-10-14 09:50:56 +02:00
minikconf.py
modinfo-collect.py scripts/modinfo-collect: remove unused/dead code 2022-03-22 14:46:17 +04:00
modinfo-generate.py modules: generates per-target modinfo 2022-06-06 09:26:53 +02:00
mtest2make.py build: add a more generic way to specify make->ninja dependencies 2022-06-01 15:47:43 +01:00
nsis.py scripts/nsis.py: Automatically package required DLLs of QEMU executables 2022-10-31 10:06:11 +01:00
qapi-gen.py
qemu-binfmt-conf.sh scripts/qemu-binfmt-conf: Add LoongArch to qemu_get_family() 2022-07-05 16:17:53 +05:30
qemu-gdb.py
qemu-stamp.py meson, configure: move --with-pkgversion, CONFIG_STAMP to meson 2022-05-07 07:46:58 +02:00
qemu-trace-stap qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful. 2021-07-12 17:37:06 +01:00
qemu-version.sh
refresh-pxe-roms.sh
render_block_graph.py python: rename qemu.aqmp to qemu.qmp 2022-04-21 11:01:00 -04:00
replay-dump.py
shaderinclude.pl
signrom.py
simpletrace.py
symlink-install-tree.py cutils: Introduce bundle mechanism 2022-07-13 16:58:57 +02:00
test-driver.py
tracetool.py
u2f-setup-gen.py
undefsym.py
update-linux-headers.sh linux-headers: Add vduse.h 2022-06-24 17:07:06 +02:00
update-mips-syscall-args.sh linux-user, mips: update syscall-args-o32.c.inc to Linux v5.13 2021-07-13 13:59:59 +02:00
update-syscalltbl.sh
userfaultfd-wrlat.py
vmstate-static-checker.py vmstate-static-checker:remove this redundant return 2022-10-22 23:19:11 +02:00
xen-detect.c meson, configure: move Xen detection to meson 2022-05-07 07:46:58 +02:00