All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Wu <wu.wubin@huawei.com>
To: Stefan Hajnoczi <stefanha@gmail.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: Thu, 2 Apr 2015 08:40:36 +0800	[thread overview]
Message-ID: <551C9004.1030804@huawei.com> (raw)
In-Reply-To: <20150401115901.GB7625@stefanha-thinkpad.redhat.com>

On 2015/4/1 19:59, Stefan Hajnoczi wrote:
> 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
> 
OK, I see. Thanks
-- 
Bin Wu

      reply	other threads:[~2015-04-02  0:43 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     ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-04-02  0:40       ` Bin Wu [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=551C9004.1030804@huawei.com \
    --to=wu.wubin@huawei.com \
    --cc=famz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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 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.