From: Stefan Hajnoczi <stefanha@redhat.com>
To: 858585 jemmy <jemmy858585@gmail.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>, Fam Zheng <famz@redhat.com>,
qemu block <qemu-block@nongnu.org>,
Juan Quintela <quintela@redhat.com>,
Dave Gilbert <dgilbert@redhat.com>,
Lidong Chen <lidongchen@tencent.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v4] migration/block: move bdrv_is_allocated() into bb's AioContext
Date: Tue, 9 May 2017 10:42:20 -0400 [thread overview]
Message-ID: <20170509144220.GD16825@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAOGPPbfukP450k2CaC6sEiFfca2DQ1OqMGSvZgwOvXr9WUGXaQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2441 bytes --]
On Tue, May 09, 2017 at 08:59:30PM +0800, 858585 jemmy wrote:
> On Tue, May 9, 2017 at 4:54 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> > On Fri, May 05, 2017 at 04:03:49PM +0800, jemmy858585@gmail.com wrote:
> >> From: Lidong Chen <lidongchen@tencent.com>
> >>
> >> when block migration with high-speed, mig_save_device_bulk hold the
> >> BQL and invoke bdrv_is_allocated frequently. This patch moves
> >> bdrv_is_allocated() into bb's AioContext. It will execute without
> >> blocking other I/O activity.
> >>
> >> Signed-off-by: Lidong Chen <lidongchen@tencent.com>
> >> ---
> >> v4 changelog:
> >> Use the prototype code written by Stefan and fix some bug.
> >> moves bdrv_is_allocated() into bb's AioContext.
> >> ---
> >> migration/block.c | 48 +++++++++++++++++++++++++++++++++++++++---------
> >> 1 file changed, 39 insertions(+), 9 deletions(-)
> >
> > Added Paolo because he's been reworking AioContext and locking.
> >
> > The goal of this patch is to avoid waiting for bdrv_is_allocated() to
> > complete while holding locks. Do bdrv_is_allocated() in the AioContext
> > so event processing continues after yield.
>
> Hi Paolo:
> Some information about the problem.
Lidong, please see my comment below:
> >> @@ -274,17 +298,23 @@ static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds)
> >> int nr_sectors;
> >>
> >> if (bmds->shared_base) {
> >> + AioContext *bb_ctx;
> >> + Coroutine *co;
> >> + MigNextAllocatedClusterData data = {
> >> + .cur_sector = &cur_sector,
> >> + .total_sectors = &total_sectors,
> >> + .bb = bb,
> >> + };
> >> + qemu_event_init(&data.event, false);
> >> +
> >> qemu_mutex_lock_iothread();
> >> - aio_context_acquire(blk_get_aio_context(bb));
> >> - /* Skip unallocated sectors; intentionally treats failure as
> >> - * an allocated sector */
> >> - while (cur_sector < total_sectors &&
> >> - !bdrv_is_allocated(blk_bs(bb), cur_sector,
> >> - MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) {
> >> - cur_sector += nr_sectors;
> >> - }
> >> - aio_context_release(blk_get_aio_context(bb));
> >> + bdrv_inc_in_flight(blk_bs(bb));
> >
> > Please add a comment explaining why bdrv_inc_in_flight() is invoked.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
next prev parent reply other threads:[~2017-05-09 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-05 8:03 [Qemu-devel] [PATCH v4] migration/block: move bdrv_is_allocated() into bb's AioContext jemmy858585
2017-05-08 20:54 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-05-09 12:59 ` 858585 jemmy
2017-05-09 14:42 ` Stefan Hajnoczi [this message]
2017-05-09 16:01 ` Paolo Bonzini
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=20170509144220.GD16825@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=dgilbert@redhat.com \
--cc=famz@redhat.com \
--cc=jemmy858585@gmail.com \
--cc=lidongchen@tencent.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@gmail.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).