qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH] async: Fix aio_notify_accept
Date: Fri, 3 Aug 2018 18:51:35 +0200	[thread overview]
Message-ID: <4ac9be27-7775-1863-c34c-cdce85eab53e@redhat.com> (raw)
In-Reply-To: <20180803154955.25251-1-famz@redhat.com>

On 03/08/2018 17:49, Fam Zheng wrote:
>  void aio_notify_accept(AioContext *ctx)
>  {
> -    if (atomic_xchg(&ctx->notified, false)) {
> +    /* If ctx->notify_me >= 2, another aio_poll() is waiting which may need the
> +     * ctx->notifier event to wake up, so don't already clear it just because "we" are
> +     * done iterating. */
> +    if (atomic_read(&ctx->notify_me) < 2
> +        && atomic_xchg(&ctx->notified, false)) {
>          event_notifier_test_and_clear(&ctx->notifier);
>      }
>  }

I'm worried that this would this cause a busy wait, and I don't
understand the issue.

When aio_poll()s are nested, outer calls are in the "dispatch" phase and
therefore do not need notification.

In your situation is notify_me actually ever >2?

Paolo

  reply	other threads:[~2018-08-03 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 15:49 [Qemu-devel] [RFC PATCH] async: Fix aio_notify_accept Fam Zheng
2018-08-03 16:51 ` Paolo Bonzini [this message]
2018-08-03 17:08 ` Paolo Bonzini
2018-08-07  1:01   ` Fam Zheng

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=4ac9be27-7775-1863-c34c-cdce85eab53e@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@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).