From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH] fixup! block-migration: acquire AioContext as necessary
Date: Tue, 23 Feb 2016 13:39:26 +0800 [thread overview]
Message-ID: <20160223053926.GA23182@ad.usersys.redhat.com> (raw)
In-Reply-To: <1455894643-16280-1-git-send-email-pbonzini@redhat.com>
On Fri, 02/19 16:10, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> migration/block.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/migration/block.c b/migration/block.c
> index 3bfa908..eea4788 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -54,6 +54,7 @@ typedef struct BlkMigDevState {
> int shared_base;
> int64_t total_sectors;
> QSIMPLEQ_ENTRY(BlkMigDevState) entry;
> + Error *blocker;
>
> /* Only used by migration thread. Does not need a lock. */
> int bulk_completed;
> @@ -68,9 +69,10 @@ typedef struct BlkMigDevState {
> /* Protected by block migration lock. */
> int64_t completed_sectors;
>
> - /* Protected by iothread lock / AioContext. */
> + /* During migration this is protected by iothread lock / AioContext.
> + * Allocation and free happen during setup and cleanup respectively.
> + */
> BdrvDirtyBitmap *dirty_bitmap;
> - Error *blocker;
> } BlkMigDevState;
>
> typedef struct BlkMigBlock {
> @@ -339,9 +341,10 @@ static int set_dirty_tracking(void)
> int ret;
>
> QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
> - /* Creating/dropping dirty bitmaps only requires the big QEMU lock. */
> + aio_context_acquire(bdrv_get_aio_context(bmds->bs));
> bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE,
> NULL, NULL);
> + aio_context_release(bdrv_get_aio_context(bmds->bs));
> if (!bmds->dirty_bitmap) {
> ret = -errno;
> goto fail;
> @@ -352,7 +355,9 @@ static int set_dirty_tracking(void)
> fail:
> QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
> if (bmds->dirty_bitmap) {
> + aio_context_acquire(bdrv_get_aio_context(bmds->bs));
> bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap);
> + aio_context_release(bdrv_get_aio_context(bmds->bs));
> }
> }
> return ret;
> @@ -365,8 +370,9 @@ static void unset_dirty_tracking(void)
> BlkMigDevState *bmds;
>
> QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
> - /* Creating/dropping dirty bitmaps only requires the big QEMU lock. */
> + aio_context_acquire(bdrv_get_aio_context(bmds->bs));
> bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap);
> + aio_context_release(bdrv_get_aio_context(bmds->bs));
> }
> }
>
> --
> 2.5.0
>
Reviewed-by: Fam Zheng <famz@redhat.com>
BTW, could you also explain the blk_mig_lock() question (*) I had?
*: https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg03317.html
Fam
next prev parent reply other threads:[~2016-02-23 5:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-19 15:10 [Qemu-devel] [PATCH] fixup! block-migration: acquire AioContext as necessary Paolo Bonzini
2016-02-23 5:39 ` Fam Zheng [this message]
2016-02-23 9:42 ` Paolo Bonzini
2016-02-23 12:56 ` Fam Zheng
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=20160223053926.GA23182@ad.usersys.redhat.com \
--to=famz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).