[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] coroutine: Make qemu_coroutine_self() return NULL if not in
From: |
Kevin Wolf |
Subject: |
Re: [PATCH] coroutine: Make qemu_coroutine_self() return NULL if not in coroutine |
Date: |
Wed, 5 Oct 2022 18:34:09 +0200 |
Am 05.10.2022 um 16:20 hat Alberto Faria geschrieben:
> qemu_coroutine_self() is used in several places outside of coroutine
> context (mostly in qcow2 tracing calls).
>
> Ensure qemu_coroutine_self() works properly when not called from
> coroutine context, returning NULL in that case, and remove its
> coroutine_fn annotation.
>
> Signed-off-by: Alberto Faria <afaria@redhat.com>
The coroutine_fn annotation for qemu_coroutine_self() is wrong, but I
think it already works outside of coroutine context, and consistently in
all three backends, by returning &leader.
Changing that to NULL makes me kind of nervous because the callers might
actually access the leader Coroutine object, and after this change they
would crash. (And even if they didn't crash, they wouldn't be able to
distinguish the leader coroutines of different threads any more.)
Do we have an actual reason to make this chance? That is, do we have any
case that was broken before?
Kevin