qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH] aio-posix: split poll check from ready handler
Date: Thu, 2 Dec 2021 15:39:13 +0100	[thread overview]
Message-ID: <20211202143913.d3plt5oubyb24ca4@steredhat> (raw)
In-Reply-To: <YajFg9YW9wKulgqU@stefanha-x1.localdomain>

On Thu, Dec 02, 2021 at 01:09:23PM +0000, Stefan Hajnoczi wrote:
>On Wed, Dec 01, 2021 at 12:55:08PM +0100, Stefano Garzarella wrote:
>> On Tue, Nov 30, 2021 at 11:20:57AM +0000, Stefan Hajnoczi wrote:
>> > @@ -657,10 +704,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
>> >     }
>> >
>> >     progress |= aio_bh_poll(ctx);
>> > -
>> > -    if (ret > 0) {
>> > -        progress |= aio_dispatch_ready_handlers(ctx, &ready_list);
>> > -    }
>> > +    progress |= aio_dispatch_ready_handlers(ctx, &ready_list);
>>
>> I honestly don't know this code well, so this change isn't clear to me.
>>
>> IIUC this is necessary because we now use REVENTS_POLL_READY, so even if
>> `wait` is interrupted, we want to run the handlers ready so far.
>> Or maybe is it an unrelated optimization?
>
>Previously we didn't need to run aio_dispatch_ready_handlers() in
>polling mode (ret would be 0). Now we do, so the conditional needs to be
>removed.
>
>There is no change for the ctx->fdmon_ops->wait() -EINTR case. fdmon
>won't add handlers to ready_list when returning -EINTR and previously
>polling would run handlers immediately. In order to preserve that
>behavior we now need to call aio_dispatch_ready_handlers()
>unconditionally because polling may have added handlers.

Yeah, now I see.
Aside from not knowing the code, I had only considered the ret < 0 case.

Thanks for clarifying,
Stefano



      reply	other threads:[~2021-12-02 14:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 11:20 [PATCH] aio-posix: split poll check from ready handler Stefan Hajnoczi
2021-12-01 11:55 ` Stefano Garzarella
2021-12-02 13:09   ` Stefan Hajnoczi
2021-12-02 14:39     ` Stefano Garzarella [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211202143913.d3plt5oubyb24ca4@steredhat \
    --to=sgarzare@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).