From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Lai Jiangshan <jiangshanlai@gmail.com>, clg@kaod.org
Cc: Juan Quintela <quintela@redhat.com>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Samuel Ortiz <sameo@linux.intel.com>,
Sebastien Boeuf <sebastien.boeuf@intel.com>,
"James O . D . Hunt" <james.o.hunt@intel.com>,
Xu Wang <gnawux@gmail.com>, Peng Tao <bergwolf@gmail.com>,
Xiao Guangrong <xiaoguangrong@tencent.com>,
Xiao Guangrong <xiaoguangrong.eric@gmail.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH V5] migration: add capability to bypass the shared memory
Date: Thu, 26 Apr 2018 20:05:24 +0100 [thread overview]
Message-ID: <20180426190523.GR2631@work-vm> (raw)
In-Reply-To: <CAJhGHyDqj32nKZq--aho5OTZSYr0N6r0d-5WWtpgacACWMWLBQ@mail.gmail.com>
* Lai Jiangshan (jiangshanlai@gmail.com) wrote:
> On Fri, Apr 20, 2018 at 12:38 AM, Dr. David Alan Gilbert
> <dgilbert@redhat.com> wrote:
>
> >> -static void ram_list_init_bitmaps(void)
> >> +static void ram_list_init_bitmaps(RAMState *rs)
> >> {
> >> RAMBlock *block;
> >> unsigned long pages;
> >> @@ -2151,9 +2152,17 @@ static void ram_list_init_bitmaps(void)
> >> /* Skip setting bitmap if there is no RAM */
> >> if (ram_bytes_total()) {
> >> QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
> >> + if (migrate_bypass_shared_memory() && qemu_ram_is_shared(block)) {
> >> + continue;
> >> + }
> >> pages = block->max_length >> TARGET_PAGE_BITS;
> >> block->bmap = bitmap_new(pages);
> >> bitmap_set(block->bmap, 0, pages);
> >> + /*
> >> + * Count the total number of pages used by ram blocks not
> >> + * including any gaps due to alignment or unplugs.
> >> + */
> >> + rs->migration_dirty_pages += pages;
> >> if (migrate_postcopy_ram()) {
> >> block->unsentmap = bitmap_new(pages);
> >> bitmap_set(block->unsentmap, 0, pages);
> >
> > Can you please rework this to combine with Cédric Le Goater's
> > 'discard non-migratable RAMBlocks' - it's quite similar to what you're
> > trying to do but for a different reason; If you look at the v2 from
> > April 13, I think you can just find somewhere to clear the
> > RAM_MIGRATABLE flag.
>
> Hello Dave:
>
> It seems we need to add new qmp/hmp command to clear/add
> RAM_MIGRATABLE flag which is overkill for such a simple feature.
> Please point out if there is any simple way to do so.
I'm fine with you still using a capability to enable/disable it - I
think that part of your patch is fine; but then I think you just
need to check that capability somewhere in Cedric's code; perhaps in his
qemu_ram_is_migratable?
> And this kind of memory is not "un-MIGRATABLE", the user
> just decided not to migrate it/them for one of the migrations.
> But they are always MIGRATABLE regardless the user migrate
> them or not. So clearing/setting the flag may
> cause confusion in this case. What do you think?
The 'RAM_MIGRATABLE' is just an internal name for the flag; it's
not seen by the user; it's as good a name as any.
> Bypassing is an option for every migration. For the
> same vm instance, the user might migrate it out
> multiple times. He wants to bypass shared memory
> in some migrations and do the normal migrations in
> other times. So it is better that Bypassing is an option
> or capability of migration instead of ramblock.
>
> I don't insist on avoiding using RAM_MIGRATABLE.
and so it might be best for you not to change the flag, just
to add to qemu_ram_is_migratable.
> Thanks,
> Lai
>
> >
> > One thing I noticed; in my world I've got some code that checks if we
> > ever do a RAM iteration, don't find any dirty blocks but then still have
> > migration_dirty_pages being none-0; and with this patch I'm seeing that
> > check trigger:
> >
> > ram_find_and_save_block: no page found, yet dirty_pages=480
> >
> > it doesn't seem to trigger without the patch.
>
> Does initializing the migration_dirty_pages as you suggested help?
I've not had a chance to try yet; here is the debug patch I've got:
@@ -1594,6 +1594,13 @@ static int ram_find_and_save_block(RAMState *rs, bool last_stage)
}
} while (!pages && again);
+ if (!pages && !again && pss.complete_round && rs->migration_dirty_pages)
+ {
+ /* Should make this fail migration ? */
+ fprintf(stderr, "%s: no page found, yet dirty_pages=%"PRIu64"\n",
+ __func__, rs->migration_dirty_pages);
+ }
+
rs->last_seen_block = pss.block;
rs->last_page = pss.page;
Dave
> >
> > Dave
> >
> >> @@ -2169,7 +2178,7 @@ static void ram_init_bitmaps(RAMState *rs)
> >> qemu_mutex_lock_ramlist();
> >> rcu_read_lock();
> >>
> >> - ram_list_init_bitmaps();
> >> + ram_list_init_bitmaps(rs);
> >> memory_global_dirty_log_start();
> >> migration_bitmap_sync(rs);
> >>
> >> diff --git a/qapi/migration.json b/qapi/migration.json
> >> index 9d0bf82cf4..45326480bd 100644
> >> --- a/qapi/migration.json
> >> +++ b/qapi/migration.json
> >> @@ -357,13 +357,17 @@
> >> # @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
> >> # (since 2.12)
> >> #
> >> +# @bypass-shared-memory: the shared memory region will be bypassed on migration.
> >> +# This feature allows the memory region to be reused by new qemu(s)
> >> +# or be migrated separately. (since 2.13)
> >> +#
> >> # Since: 1.2
> >> ##
> >> { 'enum': 'MigrationCapability',
> >> 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
> >> 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
> >> 'block', 'return-path', 'pause-before-switchover', 'x-multifd',
> >> - 'dirty-bitmaps' ] }
> >> + 'dirty-bitmaps', 'bypass-shared-memory' ] }
> >>
> >> ##
> >> # @MigrationCapabilityStatus:
> >> --
> >> 2.15.1 (Apple Git-101)
> >>
> > --
> > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2018-04-26 19:05 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-31 8:45 [Qemu-devel] [PATCH] migration: add capability to bypass the shared memory Lai Jiangshan
2018-03-31 10:17 ` Lai Jiangshan
2018-03-31 12:35 ` Eric Blake
2018-04-01 8:48 ` [Qemu-devel] [PATCH V3] " Lai Jiangshan
2018-04-01 8:53 ` no-reply
2018-04-01 8:56 ` no-reply
2018-04-04 11:47 ` [Qemu-devel] [PATCH V4] " Lai Jiangshan
2018-04-04 12:15 ` Xiao Guangrong
2018-04-09 17:30 ` Dr. David Alan Gilbert
2018-04-12 2:34 ` Lai Jiangshan
2018-04-16 15:00 ` [Qemu-devel] [PATCH V5] " Lai Jiangshan
2018-04-19 16:38 ` Dr. David Alan Gilbert
2018-04-25 10:12 ` Lai Jiangshan
2018-04-26 19:05 ` Dr. David Alan Gilbert [this message]
2018-04-27 7:47 ` Cédric Le Goater
2018-06-28 0:42 ` Liang Li
2018-04-16 22:54 ` [Qemu-devel] [PATCH V4] " Lai Jiangshan
2018-04-19 15:54 ` Dr. David Alan Gilbert
2018-07-02 13:10 ` [Qemu-devel] [PATCH] " Stefan Hajnoczi
2018-07-02 13:52 ` Peng Tao
2018-07-02 22:15 ` Andrea Arcangeli
2018-07-03 4:09 ` Peng Tao
2018-07-03 10:05 ` Stefan Hajnoczi
2018-07-03 15:10 ` Peng Tao
2018-07-10 13:40 ` Stefan Hajnoczi
2018-07-12 15:02 ` Peng Tao
2018-07-18 16:03 ` Stefan Hajnoczi
2018-07-02 22:01 ` Andrea Arcangeli
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=20180426190523.GR2631@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=bergwolf@gmail.com \
--cc=clg@kaod.org \
--cc=eblake@redhat.com \
--cc=gnawux@gmail.com \
--cc=james.o.hunt@intel.com \
--cc=jiangshanlai@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=sameo@linux.intel.com \
--cc=sebastien.boeuf@intel.com \
--cc=xiaoguangrong.eric@gmail.com \
--cc=xiaoguangrong@tencent.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).