qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 3/3] aio-posix: call ->poll_end() when removing AioHandler


From: Paolo Bonzini
Subject: Re: [RFC 3/3] aio-posix: call ->poll_end() when removing AioHandler
Date: Wed, 13 Dec 2023 22:52:58 +0100

On Wed, Dec 13, 2023 at 10:15 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:
> -    /* If a read is in progress, just mark the node as deleted */
> -    if (ctx->walking_handlers > 0) {
> -        QLIST_INSERT_HEAD_RCU(&ctx->deleted_aio_handlers, node, 
> node_deleted);
> -        return false;
> +    /* If polling was started on the node then end it now */
> +    if (ctx->poll_started && node->io_poll_end) {
> +        node->io_poll_end(node->opaque);
> +
> +        /* Poll one last time in case ->io_poll_end() raced with the event */
> +        if (node->io_poll(node->opaque)) {
> +            poll_ready = true;
> +        }

Do you need this at all? If the caller is removing the handlers, they
should have put themselves in a state where they don't care about the
file descriptor becoming readable.

You still have to be careful because aio_bh_schedule_oneshot() can
trigger remote nested event loops (which can cause deadlocks and, I am
especially afraid, can take some time and invalidate the expectation
that you don't need to drop the BQL). But it does simplify this patch
quite a bit.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]