[PATCH] block: mark aio_poll as non-coroutine

Paolo Bonzini posted 1 patch 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230908075458.527013-1-pbonzini@redhat.com
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
include/block/aio.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] block: mark aio_poll as non-coroutine
Posted by Paolo Bonzini 1 year, 2 months ago
It is forbidden to block on the event loop during a coroutine, as that
can cause deadlocks due to recursive locking.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/block/aio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/block/aio.h b/include/block/aio.h
index 32042e8905a..f1d0a37d68f 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -468,7 +468,7 @@ void aio_dispatch(AioContext *ctx);
  * or more AIO events have completed, to ensure something has moved
  * before returning.
  */
-bool aio_poll(AioContext *ctx, bool blocking);
+bool no_coroutine_fn aio_poll(AioContext *ctx, bool blocking);
 
 /* Register a file descriptor and associated callbacks.  Behaves very similarly
  * to qemu_set_fd_handler.  Unlike qemu_set_fd_handler, these callbacks will
-- 
2.41.0
Re: [PATCH] block: mark aio_poll as non-coroutine
Posted by Kevin Wolf 1 year, 2 months ago
Am 08.09.2023 um 09:54 hat Paolo Bonzini geschrieben:
> It is forbidden to block on the event loop during a coroutine, as that
> can cause deadlocks due to recursive locking.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Thanks, applied to the block branch.

Kevin
Re: [PATCH] block: mark aio_poll as non-coroutine
Posted by Michael Tokarev 1 year, 2 months ago
08.09.2023 10:54, Paolo Bonzini wrote:
> It is forbidden to block on the event loop during a coroutine, as that
> can cause deadlocks due to recursive locking.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   include/block/aio.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/block/aio.h b/include/block/aio.h
> index 32042e8905a..f1d0a37d68f 100644
> --- a/include/block/aio.h
> +++ b/include/block/aio.h
> @@ -468,7 +468,7 @@ void aio_dispatch(AioContext *ctx);
>    * or more AIO events have completed, to ensure something has moved
>    * before returning.
>    */
> -bool aio_poll(AioContext *ctx, bool blocking);
> +bool no_coroutine_fn aio_poll(AioContext *ctx, bool blocking);
>   
>   /* Register a file descriptor and associated callbacks.  Behaves very similarly
>    * to qemu_set_fd_handler.  Unlike qemu_set_fd_handler, these callbacks will

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>

While this is a no-op change for the code and trivial syntactically,
I'm skeptical it should go through trivial-patches@.

/mjt