From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
lersek@redhat.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 2/2] aio: Do aio_notify_accept only during blocking aio_poll
Date: Tue, 7 Aug 2018 22:11:03 +0800 [thread overview]
Message-ID: <20180807141031.GA12064@lemon.usersys.redhat.com> (raw)
In-Reply-To: <3ca9cf3e-6b95-76f4-e729-8abdc9a2c0b8@redhat.com>
On Tue, 08/07 12:15, Paolo Bonzini wrote:
> On 07/08/2018 11:16, Fam Zheng wrote:
> > main thread IO Thread
> > ===============================================================
> > bdrv_drained_begin()
> > aio_disable_external(ctx)
> > aio_poll(ctx, true)
> > ctx->notify_me += 2
> > ppoll() /* blocked */
> > ...
> > bdrv_drained_end()
> > ...
> > aio_notify()
[2] ^^^^^
> > ...
> > bdrv_set_aio_context()
> > aio_poll(ctx, false)
> > [1] aio_notify_accept(ctx)
> > /* Hang! */
>
> Should ppoll() rather be after [1]? Otherwise the new commit message
> and patches look great.
Good point. They race and I think aio_notify_accept() is indeed done before
ppoll() starts its waiting. I will finish testing and send v3.
Fam
>
> > aio_notify() only injects an event when ctx->notify_me is set,
> > correspondingly aio_notify_accept() is only useful when ctx->notify_me
> > _was_ set.
>
> Very good point.
>
> (Please Cc qemu-stable on the second patch too).
>
> Paolo
prev parent reply other threads:[~2018-08-07 14:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-07 9:16 [Qemu-devel] [PATCH v2 0/2] Fix aio_notify_accept() Fam Zheng
2018-08-07 9:16 ` [Qemu-devel] [PATCH v2 1/2] aio-posix: Don't count ctx->notifier as progress when polling Fam Zheng
2018-08-07 9:16 ` [Qemu-devel] [PATCH v2 2/2] aio: Do aio_notify_accept only during blocking aio_poll Fam Zheng
2018-08-07 10:15 ` Paolo Bonzini
2018-08-07 14:11 ` Fam Zheng [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=20180807141031.GA12064@lemon.usersys.redhat.com \
--to=famz@redhat.com \
--cc=lersek@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).