Re: [PATCH] block-qdict: Fix -Werror=maybe-uninitialized build failure

2022-03-10 Thread Daniel Henrique Barboza
On 3/10/22 17:05, Murilo Opsfelder Araujo wrote: Building QEMU on Fedora 37 (Rawhide Prerelease) ppc64le failed with the following error: $ ../configure --prefix=/usr/local/qemu-disabletcg --target-list=ppc-softmmu,ppc64-softmmu --disable-tcg --disable-linux-user ... $ make

Re: [PATCH experiment 00/35] stackless coroutine backend

2022-03-10 Thread Paolo Bonzini
On 3/10/22 18:42, Stefan Hajnoczi wrote: There are a lot of details to decide on in the translator tool and runtime to optimize the code. I think the way the stack frames are organized in this patch series is probably for convenience rather than performance. Yes, sometimes the optimizations

[PATCH] block-qdict: Fix -Werror=maybe-uninitialized build failure

2022-03-10 Thread Murilo Opsfelder Araujo
Building QEMU on Fedora 37 (Rawhide Prerelease) ppc64le failed with the following error: $ ../configure --prefix=/usr/local/qemu-disabletcg --target-list=ppc-softmmu,ppc64-softmmu --disable-tcg --disable-linux-user ... $ make -j$(nproc) ... FAILED:

Re: [PATCH-for-6.2 0/2] hw/block/fdc: Fix CVE-2021-3507

2022-03-10 Thread Jon Maloy
On 3/10/22 12:14, Thomas Huth wrote: On 06/02/2022 20.19, Jon Maloy wrote: Trying again with correct email address. ///jon On 2/6/22 14:15, Jon Maloy wrote: On 1/27/22 15:14, Jon Maloy wrote: On 11/18/21 06:57, Philippe Mathieu-Daudé wrote: Trivial fix for CVE-2021-3507. Philippe

Re: [PATCH experiment 00/35] stackless coroutine backend

2022-03-10 Thread Stefan Hajnoczi
On Thu, Mar 10, 2022 at 01:43:38PM +0100, Paolo Bonzini wrote: > 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.

Re: [PATCH-for-6.2 0/2] hw/block/fdc: Fix CVE-2021-3507

2022-03-10 Thread Thomas Huth
On 06/02/2022 20.19, Jon Maloy wrote: Trying again with correct email address. ///jon On 2/6/22 14:15, Jon Maloy wrote: On 1/27/22 15:14, Jon Maloy wrote: On 11/18/21 06:57, Philippe Mathieu-Daudé wrote: Trivial fix for CVE-2021-3507. Philippe Mathieu-Daudé (2):    hw/block/fdc: Prevent

Re: [RFC PATCH 0/5] Removal of AioContext lock, bs->parents and ->children: proof of concept

2022-03-10 Thread Stefan Hajnoczi
On Wed, Mar 09, 2022 at 02:26:28PM +0100, Emanuele Giuseppe Esposito wrote: > Am 02/03/2022 um 10:47 schrieb Stefan Hajnoczi: > > On Tue, Mar 01, 2022 at 09:21:08AM -0500, Emanuele Giuseppe Esposito wrote: > >> Possible scenarios > >> --- > >> Keeping in mind that we can only have

Re: [PATCH 05/35] coroutine: small code cleanup in qemu_co_rwlock_wrlock

2022-03-10 Thread Philippe Mathieu-Daudé
On 10/3/22 13:43, Paolo Bonzini wrote: qemu_co_rwlock_wrlock stores the current coroutine in a local variable, use it instead of calling qemu_coroutine_self() again. Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH 30/35] qemu_co_rwlock_unlock

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c index e7eb446566..c164cf6b15 100644 --- a/util/qemu-coroutine-lock.c +++

[PATCH 29/35] qemu_co_rwlock_rdlock

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 40 +- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c index 3b50e1dd5b..e7eb446566 100644 --- a/util/qemu-coroutine-lock.c +++

[PATCH 21/35] /perf/yield

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 75d54e5d29..0b7b4d6ef8 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 20/35] /perf/nesting

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 439bd269c9..75d54e5d29 100644 --- a/tests/unit/test-coroutine.c +++ b/tests/unit/test-coroutine.c

[PATCH 12/35] define magic macros for stackless coroutines

2022-03-10 Thread Paolo Bonzini
Because conversion to stackless coroutines is incredibly repetitive, define some magic variable-argument macros that simplify the task: - CO_DECLARE_FRAME() declares a frame structure, with a couple common fields and the extras coming from variable arguments - CO_INIT_FRAME() allocates the

[PATCH 05/35] coroutine: small code cleanup in qemu_co_rwlock_wrlock

2022-03-10 Thread Paolo Bonzini
qemu_co_rwlock_wrlock stores the current coroutine in a local variable, use it instead of calling qemu_coroutine_self() again. Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/qemu-coroutine-lock.c

[PATCH 35/35] /locking/co-rwlock/downgrade

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 123 1 file changed, 98 insertions(+), 25 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 39d0f31492..174ea8d579 100644 --- a/tests/unit/test-coroutine.c

[PATCH 34/35] /locking/co-rwlock/upgrade

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 68 ++--- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index db6718db40..39d0f31492 100644 --- a/tests/unit/test-coroutine.c

[PATCH 33/35] qemu_co_rwlock_upgrade

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 30 +++--- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c index c0541171d4..9674e8e3e3 100644 --- a/util/qemu-coroutine-lock.c +++

[PATCH 28/35] qemu_co_rwlock_maybe_wake_one

2022-03-10 Thread Paolo Bonzini
This is optimized a bit based on the assumption that qemu_co_mutex_unlock() never yields. In other words, qemu_co_mutex_unlock() and qemu_co_rwlock_maybe_wake_one() could be declared coroutine_only_fn instead of coroutine_fn. Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 11

[PATCH 25/35] /locking/co-mutex

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 35 --- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 0fe9226b86..642ef36bc3 100644 --- a/tests/unit/test-coroutine.c

[PATCH 23/35] /perf/cost

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index c44287bcb0..080ee76dde 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 22/35] /perf/function-call

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 0b7b4d6ef8..c44287bcb0 100644 --- a/tests/unit/test-coroutine.c +++ b/tests/unit/test-coroutine.c

[PATCH 32/35] qemu_co_rwlock_wrlock

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 36 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c index 5a7b99cfaf..c0541171d4 100644 --- a/util/qemu-coroutine-lock.c +++

[PATCH 31/35] qemu_co_rwlock_downgrade

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 26 ++ 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c index c164cf6b15..5a7b99cfaf 100644 --- a/util/qemu-coroutine-lock.c +++

[PATCH 27/35] /locking/co-mutex/lockable

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 35 ++- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 642ef36bc3..db6718db40 100644 --- a/tests/unit/test-coroutine.c

[PATCH 26/35] convert qemu_co_mutex_lock_slowpath to magic macros

2022-03-10 Thread Paolo Bonzini
Replace the hand-written frame structure with one built with the CO_* macros, just to shake them a bit. The produced code is exactly the same (except for CO_INIT_FRAME using a statement expression to keep the "return" statement visible in the code). Signed-off-by: Paolo Bonzini ---

[PATCH 15/35] /basic/self

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 7aaadfd31a..c701113d77 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 24/35] /basic/no-dangling-access

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 080ee76dde..0fe9226b86 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 18/35] /basic/order

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 6ad653adda..3d898d50c6 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 13/35] /basic/yield

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 27 +++ 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 3670750c5b..ae06e97c95 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 11/35] convert CoMutex to stackless coroutines

2022-03-10 Thread Paolo Bonzini
Build the frame for qemu_co_mutex_lock_slowpath, because it has code that runs after qemu_coroutine_yield(). For qemu_co_mutex_lock() and qemu_co_mutex_unlock(), just return COROUTINE_CONTINUE on paths that do not go through an awaitable function, which is all of them in the case of

[PATCH 19/35] /perf/lifecycle

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 44 - 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 3d898d50c6..439bd269c9 100644 --- a/tests/unit/test-coroutine.c

[PATCH 17/35] /basic/in_coroutine

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index bc75050463..6ad653adda 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 16/35] /basic/entered

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index c701113d77..bc75050463 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 14/35] /basic/nesting

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index ae06e97c95..7aaadfd31a 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 10/35] enable tail call optimization of qemu_co_mutex_lock

2022-03-10 Thread Paolo Bonzini
Make qemu_co_mutex_lock_slowpath a tail call, so that qemu_co_mutex_lock does not need to build a stack frame of its own. Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/qemu-coroutine-lock.c

[PATCH 02/35] coroutine: qemu_coroutine_get_aio_context is not a coroutine_fn

2022-03-10 Thread Paolo Bonzini
Since it operates on a given coroutine, qemu_coroutine_get_aio_context can be called from outside coroutine context. This is for example how qio_channel_restart_read uses it. Signed-off-by: Paolo Bonzini --- include/qemu/coroutine.h | 2 +- util/qemu-coroutine.c| 2 +- 2 files changed, 2

[PATCH experiment 00/35] stackless coroutine backend

2022-03-10 Thread Paolo Bonzini
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

[PATCH 09/35] convert qemu-coroutine-sleep.c to stackless coroutines

2022-03-10 Thread Paolo Bonzini
The main change is to qemu_co_sleep_ns_wakeable, which gets the full conversion treatment. It's important to note that variables that escape (have their address taken), such as "QEMUTimer ts" in this case, move entirely to the frame structure and do not have local variables anymore. For the

[PATCH 08/35] /basic/lifecycle

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index c230c2fa6e..3670750c5b 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 07/35] coroutine: introduce the "stackless coroutine" backend

2022-03-10 Thread Paolo Bonzini
This backend is similar to the one that was written for the "Continuation Passing C" precompiler[1]. The main advantages of stackless coroutines, in the context of QEMU, are two. First, they do not make any assumption on the layout of the stack (e.g. they do not need any special treatment for

[PATCH 03/35] coroutine: introduce QemuCoLockable

2022-03-10 Thread Paolo Bonzini
In preparation for splitting "from coroutine" ("awaitable" in other languages) and "not from coroutine" functions, remove the CoMutex case from QemuLockable---thus making qemu_lockable_lock and qemu_lockable_unlock "not awaitable". To satisfy the qemu_co_queue_wait use case, introduce

[PATCH 06/35] disable some code

2022-03-10 Thread Paolo Bonzini
Disable a lot of code that I can't be bothered to convert right now. Signed-off-by: Paolo Bonzini --- tests/unit/meson.build | 2 +- tests/unit/test-coroutine.c | 6 ++ util/meson.build| 10 +- util/qemu-coroutine-lock.c | 2 ++ util/qemu-coroutine-sleep.c | 2

[PATCH 01/35] coroutine: add missing coroutine_fn annotations for CoRwlock functions

2022-03-10 Thread Paolo Bonzini
CoRwlock can only be taken or released from a coroutine, and it can yield. Mark it as coroutine_fn. Signed-off-by: Paolo Bonzini --- include/qemu/coroutine.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index

[PATCH 04/35] coroutine: introduce coroutine_only_fn

2022-03-10 Thread Paolo Bonzini
Some functions only make sense from coroutine context, but never yield. Mark them as "coroutine_only_fn". Signed-off-by: Paolo Bonzini --- include/qemu/coroutine.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index

Re: [PATCH v2 4/4] util/event-loop-base: Introduce options to set the thread pool size

2022-03-10 Thread Stefan Hajnoczi
On Thu, Mar 03, 2022 at 04:13:07PM +0100, Nicolas Saenz Julienne wrote: > @@ -537,10 +546,19 @@ > # 0 means that the engine will use its default > # (default:0, since 6.1) > # > +# @thread-pool-min: minimum number of threads readily available in the thread > +#

Re: [PATCH v2 3/4] util/main-loop: Introduce the main loop into QOM

2022-03-10 Thread Stefan Hajnoczi
On Thu, Mar 03, 2022 at 03:58:21PM +0100, Nicolas Saenz Julienne wrote: > 'event-loop-base' provides basic property handling for all 'AioContext' > based event loops. So let's define a new 'MainLoopClass' that inherits > from it. This will permit tweaking the main loop's properties through > qapi

Re: [PATCH v5 19/20] job.c: enable job lock/unlock and remove Aiocontext locks

2022-03-10 Thread Emanuele Giuseppe Esposito
Am 08/03/2022 um 15:04 schrieb Stefan Hajnoczi: > On Tue, Feb 08, 2022 at 09:35:12AM -0500, Emanuele Giuseppe Esposito wrote: >> diff --git a/include/qemu/job.h b/include/qemu/job.h >> index ca46e46f5b..574110a1f2 100644 >> --- a/include/qemu/job.h >> +++ b/include/qemu/job.h >> @@ -75,11

Re: [PATCH v2 2/4] Introduce event-loop-base abstract class

2022-03-10 Thread Stefan Hajnoczi
On Thu, Mar 03, 2022 at 03:58:20PM +0100, Nicolas Saenz Julienne wrote: > @@ -2935,13 +2947,6 @@ qemu_syms = custom_target('qemu.syms', output: > 'qemu.syms', > capture: true, > command: [undefsym, nm, '@INPUT@']) > > -qom_ss =

Re: [PATCH v2 1/4] util/thread-pool: Fix thread pool freeing locking

2022-03-10 Thread Nicolas Saenz Julienne
On Thu, 2022-03-10 at 09:20 +, Stefan Hajnoczi wrote: > On Thu, Mar 03, 2022 at 03:58:19PM +0100, Nicolas Saenz Julienne wrote: > > Upon freeing a thread pool we need to get rid of any remaining worker. > > This is achieved by setting the thread pool's topping flag, waking the > >

Re: [PATCH v5 18/20] jobs: protect job.aio_context with BQL and job_mutex

2022-03-10 Thread Emanuele Giuseppe Esposito
Am 08/03/2022 um 14:41 schrieb Stefan Hajnoczi: > It's not clear to me that .get_parent_aio_context() should only be > called from the main thread. The API is read-only so someone might try > to call from I/O code in the future expecting it to work like other > read-only graph APIs that are

Re: [PATCH v2 1/4] util/thread-pool: Fix thread pool freeing locking

2022-03-10 Thread Stefan Hajnoczi
On Thu, Mar 03, 2022 at 03:58:19PM +0100, Nicolas Saenz Julienne wrote: > Upon freeing a thread pool we need to get rid of any remaining worker. > This is achieved by setting the thread pool's topping flag, waking the s/topping/stopping/ > workers up, and waiting for them to exit one by one. The