From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, lersek@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com, rjones@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] AioContext: fix broken placement of event_notifier_test_and_clear
Date: Mon, 20 Jul 2015 18:06:48 +0800 [thread overview]
Message-ID: <20150720100648.GA22650@ad.nay.redhat.com> (raw)
In-Reply-To: <20150720074625.GA20738@ad.nay.redhat.com>
On Mon, 07/20 15:46, Fam Zheng wrote:
> On Mon, 07/20 07:27, Paolo Bonzini wrote:
> > diff --git a/aio-win32.c b/aio-win32.c
> > index ea655b0..7afc999 100644
> > --- a/aio-win32.c
> > +++ b/aio-win32.c
> > @@ -337,10 +337,11 @@ bool aio_poll(AioContext *ctx, bool blocking)
> > aio_context_acquire(ctx);
> > }
> >
> > - if (first && aio_bh_poll(ctx)) {
> > - progress = true;
> > + if (first) {
> > + event_notifier_test_and_clear(&ctx->notifier);
>
> I'm looking at optimizing it but I don't fully understand the relationship
> between aio_prepare and WaitForMultipleObjects. Do they get the same set of
> events? What if a new event comes in between, for example, thread worker calls
> aio_notify()?
>
After some reading I think WaitForMultipleObjects is for event notifiers and
aio_prepare is for select() on fd events.
It's a bit trickier than aio-posix, in the first iteration there could be
another event masking ctx->notifier so we don't know if we need to clear it.
But since MSDN says:
"""
... the return value minus WAIT_OBJECT_0 indicates the lpHandles array index of
the object that satisfied the wait. If more than one object became signaled
during the call, this is the array index of the signaled object with the
smallest index value of all the signaled objects.
"""
Maybe we can reverse events[] so that ctx->notifier will be the 0th one. And I
think we can always remove it after first iteration, am I right?
Fam
next prev parent reply other threads:[~2015-07-20 10:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 5:27 [Qemu-devel] [PATCH v2] AioContext: fix broken placement of event_notifier_test_and_clear Paolo Bonzini
2015-07-20 7:46 ` Fam Zheng
2015-07-20 10:06 ` Fam Zheng [this message]
2015-07-20 12:42 ` [Qemu-devel] R: " Paolo Bonzini
2015-07-21 1:19 ` [Qemu-devel] " Fam Zheng
2015-07-21 6:51 ` Paolo Bonzini
2015-07-20 16:36 ` Stefan Hajnoczi
2015-07-20 19:50 ` Paolo Bonzini
2015-07-21 11:04 ` Stefan Hajnoczi
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=20150720100648.GA22650@ad.nay.redhat.com \
--to=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--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).