Re: [PATCH 8/8] migration/rdma: annotate and simplify wait_comp_channel()

Peter Xu <[email protected]>
Newsgroups org.xenproject.lists.xen-devel,org.nongnu.qemu-devel
Message-ID <[email protected]>
On Mon, Jul 20, 2026 at 11:55:37AM +0400, Marc-André Lureau wrote:
> The function calls yield_until_fd_readable() (coroutine_fn) when in
> coroutine context, and polls with qemu_poll_ns() otherwise.
> 
> Replace the migration-state proxy check with qemu_in_coroutine(),
> which directly tests what matters.
> 
> Fixes: 2da776db4846 ("rdma: core logic")
> Signed-off-by: Marc-André Lureau <[email protected]>

Reviewed-by: Peter Xu <[email protected]>

Just to say we can also drop the var.  I have a patch did it already but I
didn't get chance to revisit the series:

https://lore.kernel.org/qemu-devel/[email protected]/

So we can also pick that single patch up, then this patch can be
annotation-only.  I'll leave it to you.

Thanks,

> ---
>  migration/rdma.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/migration/rdma.c b/migration/rdma.c
> index 3e37a1d4401..438419d1894 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -1348,17 +1348,13 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct ibv_cq *cq,
>  /* Wait for activity on the completion channel.
>   * Returns 0 on success, none-0 on error.
>   */
> -static int qemu_rdma_wait_comp_channel(RDMAContext *rdma,
> -                                       struct ibv_comp_channel *comp_channel)
> +static int coroutine_mixed_fn
> +qemu_rdma_wait_comp_channel(RDMAContext *rdma,
> +                            struct ibv_comp_channel *comp_channel)
>  {
>      struct rdma_cm_event *cm_event;
>  
> -    /*
> -     * Coroutine doesn't start until migration_fd_process_incoming()
> -     * so don't yield unless we know we're running inside of a coroutine.
> -     */
> -    if (rdma->migration_started_on_destination &&
> -        migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) {
> +    if (qemu_in_coroutine()) {
>          yield_until_fd_readable(comp_channel->fd);
>      } else {
>          /* This is the source side, we're in a separate thread
> 
> -- 
> 2.55.0
> 

-- 
Peter Xu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.