qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Li, Liang Z" <liang.z.li@intel.com>
Cc: "rkagan@virtuozzo.com" <rkagan@virtuozzo.com>,
	"linux-kernel@vger.kenel.org" <linux-kernel@vger.kenel.org>,
	"ehabkost@redhat.com" <ehabkost@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"mst@redhat.com" <mst@redhat.com>,
	"simhan@hpe.com" <simhan@hpe.com>,
	"quintela@redhat.com" <quintela@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"jitendra.kolhe@hpe.com" <jitendra.kolhe@hpe.com>,
	"mohan_parthasarathy@hpe.com" <mohan_parthasarathy@hpe.com>,
	"amit.shah@redhat.com" <amit.shah@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	Wei Yang <richard.weiyang@huawei.com>,
	"rth@twiddle.net" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [RFC Design Doc]Speed up live migration by skipping free pages
Date: Thu, 24 Mar 2016 10:23:55 +0000	[thread overview]
Message-ID: <20160324102354.GB2230@work-vm> (raw)
In-Reply-To: <F2CBF3009FA73547804AE4C663CAB28E0415B8E5@shsmsx102.ccr.corp.intel.com>

* Li, Liang Z (liang.z.li@intel.com) wrote:
> > * Wei Yang (richard.weiyang@huawei.com) wrote:
> > > On Wed, Mar 23, 2016 at 06:48:22AM +0000, Li, Liang Z wrote:
> > > [...]
> > > >> > 8. Pseudo code
> > > >> > Dirty page logging should be enabled before getting the free page
> > > >> > information from guest, this is important because during the
> > > >> > process of getting free pages, some free pages may be used and
> > > >> > written by the guest, dirty page logging can trace these pages.
> > > >> > The pseudo code is like below:
> > > >> >
> > > >> >     -----------------------------------------------
> > > >> >     MigrationState *s = migrate_get_current();
> > > >> >     ...
> > > >> >
> > > >> >     memory_global_dirty_log_start();
> > > >> >
> > > >> >     if (get_guest_mem_info(&info)) {
> > > >> >         while (!get_free_page_bmap(free_page_bitmap,
> > > >> > drop_page_cache)
> > > >> &&
> > > >> >                s->state != MIGRATION_STATUS_CANCELLING) {
> > > >> >             usleep(1000) // sleep for 1 ms
> > > >> >         }
> > > >> >
> > > >> >         tighten_free_page_bmap =
> > > >> tighten_guest_free_pages(free_page_bitmap);
> > > >> >         filter_out_guest_free_pages(tighten_free_page_bmap);
> > > >> >     }
> > > >>
> > > >> Given the typical speed of networks; it wouldn't do too much harm
> > > >> to start sending assuming all pages are dirty and then when the
> > > >> guest finally gets around to finishing the bitmap then update, so
> > > >> it's asynchronous - and then if the guest never responds we don't really
> > care.
> > > >
> > > >Indeed, thanks!
> > > >
> > >
> > > This is interesting. By doing so, the threshold I mentioned in another
> > > mail is not necessary, since we can do it in parallel.
> > 
> > Actually I just realised it's a little more complex; we can't sync the dirty
> > bitmap again from the guest until after we've received the guests 'free'
> > bitmap; that's because we wouldn't know if a 'dirty' page reflected that a
> > page declared as 'free' had now been reused - so there is still an ordering
> > there.
> > 
> > Dave
> 
> Not very complex, we can implement like this:
> 
> 1. Set all the bits in the migration_bitmap_rcu->bmap to 1
> 2. Clear all the bits in ram_list. dirty_memory[DIRTY_MEMORY_MIGRATION]
> 3. Send the get_free_page_bitmap request
> 4. Start to send pages to destination and check if the free_page_bitmap is ready
>     if (is_ready) {
>           filter out the free pages from  migration_bitmap_rcu->bmap;
>           migration_bitmap_sync();
>     } 
>      continue until live migration complete. 
>     
> 
> Is that right?

The order I'm trying to understand is something like:

    a) Send the get_free_page_bitmap request
    b) Start sending pages
    c) Reach the end of memory
      [ is_ready is false - guest hasn't made free map yet ]
    d) normal migration_bitmap_sync() at end of first pass
    e) Carry on sending dirty pages
    f) is_ready is true
      f.1) filter out free pages?
      f.2) migration_bitmap_sync()

It's f.1 I'm worried about.  If the guest started generating the
free bitmap before (d), then a page marked as 'free' in f.1 
might have become dirty before (d) and so (f.2) doesn't set
the dirty again, and so we can't filter out pages in f.1.

Dave

> 
> Liang
> > 
> > >
> > > >Liang
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2016-03-24 10:24 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22  7:43 [Qemu-devel] [RFC Design Doc]Speed up live migration by skipping free pages Liang Li
2016-03-22 10:11 ` Michael S. Tsirkin
2016-03-23  6:05   ` Li, Liang Z
2016-03-23 14:08     ` Michael S. Tsirkin
2016-03-24  1:19       ` Li, Liang Z
2016-03-24  9:48         ` Michael S. Tsirkin
2016-03-24 10:16           ` Li, Liang Z
2016-03-24 10:29             ` Michael S. Tsirkin
2016-03-24 14:33               ` Li, Liang Z
2016-03-24 14:44                 ` Michael S. Tsirkin
2016-03-24 15:16                   ` Li, Liang Z
2016-03-24 15:18                     ` Paolo Bonzini
2016-03-24 15:25                       ` Li, Liang Z
2016-03-24 15:27                     ` Michael S. Tsirkin
2016-03-24 15:39                       ` Li, Liang Z
2016-03-24 15:47                         ` Paolo Bonzini
2016-03-24 15:59                           ` Li, Liang Z
2016-03-22 19:05 ` Dr. David Alan Gilbert
2016-03-23  6:48   ` Li, Liang Z
2016-03-24  1:24     ` Wei Yang
2016-03-24  9:00       ` Dr. David Alan Gilbert
2016-03-24 10:09         ` Li, Liang Z
2016-03-24 10:23           ` Dr. David Alan Gilbert [this message]
2016-03-24 14:50             ` Li, Liang Z
2016-03-24 15:11               ` Michael S. Tsirkin
2016-03-24 15:53                 ` Li, Liang Z
2016-03-24 15:56                   ` Michael S. Tsirkin
2016-03-24 16:05                     ` Li, Liang Z
2016-03-24 16:25                       ` Michael S. Tsirkin
2016-03-24 17:49                         ` Dr. David Alan Gilbert
2016-03-24 22:16                           ` Michael S. Tsirkin
2016-03-25  1:59                             ` Li, Liang Z
2016-03-25  1:32                           ` Li, Liang Z
2016-04-18 11:08                           ` Li, Liang Z
2016-04-18 11:29                             ` Michael S. Tsirkin
2016-04-18 14:36                               ` Li, Liang Z
2016-04-18 15:38                                 ` Michael S. Tsirkin
2016-04-19  2:20                                   ` Li, Liang Z
2016-04-19 19:12                               ` Dr. David Alan Gilbert
2016-04-25 10:56                                 ` Michael S. Tsirkin
2016-04-19 19:05                             ` Dr. David Alan Gilbert
2016-04-20  3:22                               ` Li, Liang Z
2016-04-20  8:10                                 ` Dr. David Alan Gilbert
2016-03-25  1:32                         ` Li, Liang Z
2016-04-01 10:54   ` Amit Shah
2016-04-05  1:49     ` Li, Liang Z
2016-03-23  1:37 ` Wei Yang
2016-03-23  7:18   ` Li, Liang Z
2016-03-23  9:46     ` Wei Yang
2016-03-23 14:35       ` Li, Liang Z
2016-03-24  0:52         ` Wei Yang
2016-03-24  1:32           ` Li, Liang Z
2016-03-24  1:56             ` Wei Yang
2016-03-23 16:53     ` Eric Blake
2016-03-23 21:41       ` Wei Yang
2016-03-24  1:23       ` Li, Liang Z

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=20160324102354.GB2230@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jitendra.kolhe@hpe.com \
    --cc=kvm@vger.kernel.org \
    --cc=liang.z.li@intel.com \
    --cc=linux-kernel@vger.kenel.org \
    --cc=mohan_parthasarathy@hpe.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=richard.weiyang@huawei.com \
    --cc=rkagan@virtuozzo.com \
    --cc=rth@twiddle.net \
    --cc=simhan@hpe.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).