From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: borntraeger@de.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH for-2.1] AioContext: do not rely on aio_poll(ctx, true) result to end a loop
Date: Wed, 9 Jul 2014 14:56:57 +0200 [thread overview]
Message-ID: <20140709125657.GC4537@noname.redhat.com> (raw)
In-Reply-To: <1404895786-15506-1-git-send-email-pbonzini@redhat.com>
Am 09.07.2014 um 10:49 hat Paolo Bonzini geschrieben:
> Currently, whenever aio_poll(ctx, true) has completed all pending
> work it returns true *and* the next call to aio_poll(ctx, true)
> will not block.
>
> This invariant has its roots in qemu_aio_flush()'s implementation
> as "while (qemu_aio_wait()) {}". However, qemu_aio_flush() does
> not exist anymore and bdrv_drain_all() is implemented differently;
> and this invariant is complicated to maintain and subtly different
> from the return value of GMainLoop's g_main_context_iteration.
>
> All calls to aio_poll(ctx, true) except one are guarded by a
> while() loop checking for a request to be incomplete, or a
> BlockDriverState to be idle. The one remaining call (in
> iothread.c) uses this to delay the aio_context_release/acquire
> pair until the AioContext is quiescent, however:
>
> - we can do the same just by using non-blocking aio_poll,
> similar to how vl.c invokes main_loop_wait
>
> - it is buggy, because it does not ensure that the AioContext
> is released between an aio_notify and the next time the
> iothread goes to sleep. This leads to hangs when stopping
> the dataplane thread.
>
> In the end, these semantics are a bad match for the current
> users of AioContext. So modify that one exception in iothread.c,
> which also fixes the hangs, as well as the testcase so that
> it use the same idiom as the actual QEMU code.
>
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Thanks, applied to the block branch.
Kevin
prev parent reply other threads:[~2014-07-09 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 8:49 [Qemu-devel] [PATCH for-2.1] AioContext: do not rely on aio_poll(ctx, true) result to end a loop Paolo Bonzini
2014-07-09 12:56 ` Kevin Wolf [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=20140709125657.GC4537@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=pbonzini@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.