[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH experiment 00/35] stackless coroutine backend
From: |
Paolo Bonzini |
Subject: |
[PATCH experiment 00/35] stackless coroutine backend |
Date: |
Thu, 10 Mar 2022 13:43:38 +0100 |
Here is an experiment with using stackless coroutines in QEMU. It
only compiles enough code to run tests/unit/test-coroutine, but at
least it proves that it's possible to quickly test ideas in the
area of coroutine runtimes. Another idea that could be toyed with
in a similar manner could be (whoa) C++ coroutines.
As expected, this also found some issues in existing code, so I
plan to submit patches 1-5 separately.
The new backend (which is the only one that works, due to the required
code changes) is in patch 7. For the big description of what stackless
coroutines are, please refer to that patch.
Patches 8-11 do some initial conversions. Patch 12 introduce some
preprocessor magic that greatly eases the rest of the work, and then
the tests are converted one at a time, until patch 27 where the only
ones missing are the CoRwlock tests.
Therefore, patches 28-33 convert CoRwlock and pathces 34-35 take care
of the corresponding tests, thus concluding the experiment.
Paolo
Paolo Bonzini (35):
coroutine: add missing coroutine_fn annotations for CoRwlock functions
coroutine: qemu_coroutine_get_aio_context is not a coroutine_fn
coroutine: introduce QemuCoLockable
coroutine: introduce coroutine_only_fn
coroutine: small code cleanup in qemu_co_rwlock_wrlock
disable some code
coroutine: introduce the "stackless coroutine" backend
/basic/lifecycle
convert qemu-coroutine-sleep.c to stackless coroutines
enable tail call optimization of qemu_co_mutex_lock
convert CoMutex to stackless coroutines
define magic macros for stackless coroutines
/basic/yield
/basic/nesting
/basic/self
/basic/entered
/basic/in_coroutine
/basic/order
/perf/lifecycle
/perf/nesting
/perf/yield
/perf/function-call
/perf/cost
/basic/no-dangling-access
/locking/co-mutex
convert qemu_co_mutex_lock_slowpath to magic macros
/locking/co-mutex/lockable
qemu_co_rwlock_maybe_wake_one
qemu_co_rwlock_rdlock
qemu_co_rwlock_unlock
qemu_co_rwlock_downgrade
qemu_co_rwlock_wrlock
qemu_co_rwlock_upgrade
/locking/co-rwlock/upgrade
/locking/co-rwlock/downgrade
configure | 44 +---
include/qemu/co-lockable.h | 110 +++++++++
include/qemu/coroutine.h | 99 ++++++--
include/qemu/coroutine_int.h | 6 -
include/qemu/lockable.h | 13 +-
include/qemu/typedefs.h | 1 +
tests/unit/meson.build | 2 +-
tests/unit/test-coroutine.c | 425 +++++++++++++++++++++++++++++------
util/coroutine-stackless.c | 159 +++++++++++++
util/meson.build | 10 +-
util/qemu-coroutine-lock.c | 215 ++++++++++++++----
util/qemu-coroutine-sleep.c | 57 ++++-
util/qemu-coroutine.c | 18 +-
13 files changed, 932 insertions(+), 227 deletions(-)
create mode 100644 include/qemu/co-lockable.h
create mode 100644 util/coroutine-stackless.c
--
2.35.1
- [PATCH experiment 00/35] stackless coroutine backend,
Paolo Bonzini <=
- [PATCH 02/35] coroutine: qemu_coroutine_get_aio_context is not a coroutine_fn, Paolo Bonzini, 2022/03/10
- [PATCH 05/35] coroutine: small code cleanup in qemu_co_rwlock_wrlock, Paolo Bonzini, 2022/03/10
- [PATCH 08/35] /basic/lifecycle, Paolo Bonzini, 2022/03/10
- [PATCH 01/35] coroutine: add missing coroutine_fn annotations for CoRwlock functions, Paolo Bonzini, 2022/03/10
- [PATCH 09/35] convert qemu-coroutine-sleep.c to stackless coroutines, Paolo Bonzini, 2022/03/10
- [PATCH 14/35] /basic/nesting, Paolo Bonzini, 2022/03/10
- [PATCH 03/35] coroutine: introduce QemuCoLockable, Paolo Bonzini, 2022/03/10
- [PATCH 07/35] coroutine: introduce the "stackless coroutine" backend, Paolo Bonzini, 2022/03/10
- [PATCH 16/35] /basic/entered, Paolo Bonzini, 2022/03/10