Received: from eggs.gnu.org ([2001:4830:134:3::10]:40498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD47H-0003QI-L5 for qemu-devel@nongnu.org; Wed, 15 Jun 2016 02:15:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bD47C-00026A-IW for qemu-devel@nongnu.org; Wed, 15 Jun 2016 02:15:55 -0400 Received: from g4t3427.houston.hpe.com ([15.241.140.73]:22112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD47C-00020Y-CW for qemu-devel@nongnu.org; Wed, 15 Jun 2016 02:15:50 -0400 References: <1463570440-29685-1-git-send-email-jitendra.kolhe@hpe.com> From: Jitendra Kolhe Message-ID: Date: Wed, 15 Jun 2016 11:45:25 +0530 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 0/4] migration: skip scanning and migrating ram pages released by virtio-balloon driver. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jitendra Kolhe , Renganathan , ehabkost@redhat.com, crosthwaite.peter@gmail.com, simhan@hpe.com, quintela@redhat.com, armbru@redhat.com, lcapitulino@redhat.com, borntraeger@de.ibm.com, mst@redhat.com, mohan_parthasarathy@hpe.com, stefanha@redhat.com, den@openvz.org, amit.shah@redhat.com, pbonzini@redhat.com, dgilbert@redhat.com, rth@twiddle.net ping ... also had received some bounce back from few individual email-ids,=20 so consider this one as resend. Thanks, - Jitendra On 5/30/2016 4:19 PM, Jitendra Kolhe wrote: > ping... > for entire v3 version of the patchset. > http://patchwork.ozlabs.org/project/qemu-devel/list/?submitter=3D68462 >=20 > - Jitendra >=20 > On Wed, May 18, 2016 at 4:50 PM, Jitendra Kolhe wrote: >> While measuring live migration performance for qemu/kvm guest, it was = observed >> that the qemu doesn=E2=80=99t maintain any intelligence for the guest = ram pages released >> by the guest balloon driver and treat such pages as any other >> normal guest ram pages. This has direct impact on overall migration ti= me for >> the guest which has released (ballooned out) memory to the host. >> >> In case of large systems, where we can configure large guests with 1TB= and >> with considerable amount of memory released by balloon driver to the h= ost, >> the migration time gets worse. >> >> The solution proposed below is local to qemu (and does not require any >> modification to Linux kernel or any guest driver). We have verified th= e fix >> for large guests =3D1TB on HPE Superdome X (which can support up to 24= 0 cores >> and 12TB of memory). >> >> During live migration, as part of first iteration in ram_save_iterate(= ) -> >> ram_find_and_save_block () will try to migrate ram pages even if they = are >> released by vitrio-balloon driver (balloon inflate). Although these pa= ges >> which are returned to the host by virtio-balloon driver are zero pages= , >> the migration algorithm will still end up scanning the entire page >> ram_find_and_save_block() -> ram_save_page()/ram_save_compressed_page(= ) -> >> save_zero_page() -> is_zero_range(). We also end-up sending header inf= ormation >> over network for these pages during migration. This adds to the total >> migration time. >> >> The solution creates a balloon bitmap ramblock as a part of virtio-bal= loon >> device initialization. The bits in the balloon bitmap represent a gues= t ram >> page of size 1UL << VIRTIO_BALLOON_PFN_SHIFT or 4K. If TARGET_PAGE_BIT= S <=3D >> VIRTIO_BALLOON_PFN_SHIFT, ram_addr offset for the dirty page which is = used by >> dirty page bitmap during migration is checked against the balloon bitm= ap as >> is, if the bit is set in the balloon bitmap, the corresponding ram pag= e will be >> excluded from scanning and sending header information during migration= . In case >> TARGET_PAGE_BITS > VIRTIO_BALLOON_PFN_SHIFT for a given dirty page ram= _addr, >> all sub-pages of 1UL << VIRTIO_BALLOON_PFN_SHIFT size should be balloo= ned out >> to avoid zero page scan and sending header information. >> >> The bitmap represents entire guest ram memory till max configured memo= ry. >> Guest ram pages claimed by the virtio-balloon driver will be represent= ed by 1 >> in the bitmap. Since the bitmap is maintained as a ramblock, it=E2=80=99= s migrated to >> target as part migration=E2=80=99s ram iterative and ram complete phas= e. So that >> substituent migrations from the target can continue to use optimizatio= n. >> >> A new migration capability called skip-balloon is introduced. The user= can >> disable the capability in cases where user does not expect much benefi= t or in >> case the migration is from an older version. >> >> During live migration setup the optimization can be set to disabled st= ate if >> . no virtio-balloon device is initialized. >> . skip-balloon migration capability is disabled. >> . If the guest virtio-balloon driver has not set VIRTIO_BALLOON_F_MUST= _TELL_HOST >> flag. Which means the guest may start using a ram pages freed by gue= st balloon >> driver, even before the host/qemu is aware of it. In such case, the >> optimization is disabled so that the ram pages that are being used b= y the >> guest will continue to be scanned and migrated. >> >> Balloon bitmap ramblock size is set to zero if the optimization is dis= abled, >> to avoid overhead of migrating the bitmap. If the bitmap is not migrat= ed to >> the target, the destination starts with a fresh bitmap and tracks the >> ballooning operation thereafter. >> >> Jitendra Kolhe (4): >> balloon: maintain bitmap for pages released by guest balloon driver. >> balloon: add balloon bitmap migration capability and setup bitmap >> migration status. >> balloon: reset balloon bitmap ramblock size on source and target. >> migration: skip scanning and migrating ram pages released by >> virtio-balloon driver. >> >> Changed in v2: >> - Resolved compilation issue for qemu-user binaries in exec.c >> - Localize balloon bitmap test to save_zero_page(). >> - Updated version string for newly added migration capability to 2.7. >> - Made minor modifications to patch commit text. >> >> Changed in v3: >> - Add balloon bitmap to RAMBlock. >> - Resolve bitmap offset calculation by translating host addr back to = a >> RAMBlock and ram_addr >> - Add balloon bitmap support for case if TARGET_PAGE_BITS >> > VIRTIO_BALLOON_PFN_SHIFT. >> - Remove dependency of skip-balloon migration capability on postcopy >> migration. >> - Disable optimization if the guest balloon driver does not support >> VIRTIO_BALLOON_F_MUST_TELL_HOST feature. >> - Split single patch into 4 small patches. >> >> balloon.c | 196 ++++++++++++++++++++++++++++= ++++++++- >> exec.c | 6 ++ >> hw/virtio/virtio-balloon.c | 42 +++++++- >> include/hw/virtio/virtio-balloon.h | 1 + >> include/migration/migration.h | 1 + >> include/sysemu/balloon.h | 13 ++- >> migration/migration.c | 9 ++ >> migration/ram.c | 9 +- >> qapi-schema.json | 5 +- >> 9 files changed, 276 insertions(+), 6 deletions(-) >> >> -- >> 1.8.3.1 >> >>