From: Stefan Hajnoczi <stefanha@gmail.com>
To: Bin Wu <wu.wubin@huawei.com>
Cc: qemu-block@nongnu.org, Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] mirror: hold aio_context before bdrv_drain
Date: Wed, 1 Apr 2015 12:59:01 +0100 [thread overview]
Message-ID: <20150401115901.GB7625@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <551BB123.9050909@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]
On Wed, Apr 01, 2015 at 04:49:39PM +0800, Bin Wu wrote:
>
> On 2015/4/1 16:19, Fam Zheng wrote:
> > On Wed, 04/01 12:42, Bin Wu wrote:
> >> From: Bin Wu <wu.wubin@huawei.com>
> >
> > What's the issue are you fixing? I think the coroutine already is running in
> > the AioContext of bs.
> >
> > Fam
> >
> In the current implementation of bdrv_drain, it should be placed in a critical
> section as suggested in the comments above the function: "Note that unlike
> bdrv_drain_all(), the caller must hold the BlockDriverState AioContext".
>
> However, the mirror coroutine starting with mirror_run doesn't do this. I just
> found qmp_drive_mirror protects the AioCentext, but it is out of the scope of
> the mirror coroutine.
There are 3 possibilities:
1. qmp_drive_mirror() under QEMU main loop thread. AioContext is held.
2. IOThread aio_poll(). AioContext is held.
3. QEMU main loop thread when IOThread (dataplane) is not used. Here
the AioContext is the global qemu_aio_context. We don't need to
acquire it explicitly, we're protected by the global mutex.
If #3 was a problem then virtio-blk.c's bdrv_aio_writev() would also be
a problem, for example.
This patch is unnecessary.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-04-01 11:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 4:42 [Qemu-devel] [PATCH] mirror: hold aio_context before bdrv_drain Bin Wu
2015-04-01 8:19 ` Fam Zheng
2015-04-01 8:49 ` Bin Wu
2015-04-01 11:59 ` Stefan Hajnoczi [this message]
2015-04-02 0:40 ` [Qemu-devel] [Qemu-block] " Bin Wu
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=20150401115901.GB7625@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=famz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=wu.wubin@huawei.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).