qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: peter.maydell@linaro.org, thuth@redhat.com,
	qemu-devel@nongnu.org, sursingh@redhat.com,
	mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org,
	Bharata B Rao <bharata@linux.vnet.ibm.com>,
	sbobroff@redhat.com
Subject: Re: [Qemu-devel] [Qemu-ppc] [PULL 06/21] spapr: Add a "no HPT" encoding to HTAB migration stream
Date: Tue, 18 Jul 2017 13:37:08 +1000	[thread overview]
Message-ID: <20170718033708.GA3140@umbus.fritz.box> (raw)
In-Reply-To: <a189522d-c798-097d-b985-13e15f48db41@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4181 bytes --]

On Mon, Jul 17, 2017 at 09:54:45PM +0200, Laurent Vivier wrote:
> On 30/06/2017 12:46, David Gibson wrote:
> > From: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > 
> > Add a "no HPT" encoding (using value -1) to the HTAB migration
> > stream (in the place of HPT size) when the guest doesn't allocate HPT.
> > This will help the target side to match target HPT with the source HPT
> > and thus enable successful migration.
> > 
> > Suggested-by: David Gibson <david@gibson.dropbear.id.au>
> > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >  hw/ppc/spapr.c | 29 +++++++++++++++++++++++++----
> >  1 file changed, 25 insertions(+), 4 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 52f4e72..f3e0b9b 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -1560,13 +1560,19 @@ static int htab_save_setup(QEMUFile *f, void *opaque)
> >      sPAPRMachineState *spapr = opaque;
> >  
> >      /* "Iteration" header */
> > -    qemu_put_be32(f, spapr->htab_shift);
> > +    if (!spapr->htab_shift) {
> > +        qemu_put_be32(f, -1);
> > +    } else {
> > +        qemu_put_be32(f, spapr->htab_shift);
> > +    }
> >  
> >      if (spapr->htab) {
> >          spapr->htab_save_index = 0;
> >          spapr->htab_first_pass = true;
> >      } else {
> > -        assert(kvm_enabled());
> > +        if (spapr->htab_shift) {
> > +            assert(kvm_enabled());
> > +        }
> >      }
> >  
> >  
> > @@ -1712,7 +1718,12 @@ static int htab_save_iterate(QEMUFile *f, void *opaque)
> >      int rc = 0;
> >  
> >      /* Iteration header */
> > -    qemu_put_be32(f, 0);
> > +    if (!spapr->htab_shift) {
> > +        qemu_put_be32(f, -1);
> > +        return 0;
> > +    } else {
> > +        qemu_put_be32(f, 0);
> > +    }
> >  
> >      if (!spapr->htab) {
> >          assert(kvm_enabled());
> > @@ -1746,7 +1757,12 @@ static int htab_save_complete(QEMUFile *f, void *opaque)
> >      int fd;
> >  
> >      /* Iteration header */
> > -    qemu_put_be32(f, 0);
> > +    if (!spapr->htab_shift) {
> > +        qemu_put_be32(f, -1);
> > +        return 0;
> > +    } else {
> > +        qemu_put_be32(f, 0);
> > +    }
> >  
> >      if (!spapr->htab) {
> >          int rc;
> > @@ -1790,6 +1806,11 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)
> >  
> >      section_hdr = qemu_get_be32(f);
> >  
> > +    if (section_hdr == -1) {
> > +        spapr_free_hpt(spapr);
> > +        return 0;
> > +    }
> > +
> >      if (section_hdr) {
> >          Error *local_err = NULL;
> >  
> > 
> 
> It seems there is a bug in this patch: when using from QEMU console the
> command "savevm", it never stops and the qcow2 image grows without limit.
> 
> I think this is because htab_save_iterate() and htab_save_complete()
> should mark the end of the sequence (the empty one, -1) by returning 1
> and not 0 (see kvmppc_save_htab()).

Ah, yes, I think you're right.  The end condition is one of the subtle
differences between the savevm and migration paths.

> This fixes the problem for me:
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 970093e..fa01511 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1827,7 +1827,7 @@ static int htab_save_iterate(QEMUFile *f, void
> *opaque)
>      /* Iteration header */
>      if (!spapr->htab_shift) {
>          qemu_put_be32(f, -1);
> -        return 0;
> +        return 1;
>      } else {
>          qemu_put_be32(f, 0);
>      }
> @@ -1866,7 +1866,7 @@ static int htab_save_complete(QEMUFile *f, void
> *opaque)
>      /* Iteration header */
>      if (!spapr->htab_shift) {
>          qemu_put_be32(f, -1);
> -        return 0;
> +        return 1;
>      } else {
>          qemu_put_be32(f, 0);
>      }

Can you polish this up and submit for merge, please?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-07-18  3:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 10:46 [Qemu-devel] [PULL 00/21] ppc-for-2.10 queue 20170730 David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 01/21] hw/ppc/prep: Remove superfluous call to soundhw_init() David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 02/21] qapi: add explicit null to string input and output visitors David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 03/21] pseries: Move CPU compatibility property to machine David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 04/21] pseries: Reset CPU compatibility mode David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 05/21] ppc: Rework CPU compatibility testing across migration David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 06/21] spapr: Add a "no HPT" encoding to HTAB migration stream David Gibson
2017-07-17 19:54   ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2017-07-18  3:37     ` David Gibson [this message]
2017-07-18  7:36       ` Thomas Huth
2017-06-30 10:46 ` [Qemu-devel] [PULL 07/21] spapr: Fix migration of Radix guests David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 08/21] target/ppc/excp_helper: Take BQL before calling cpu_interrupt() David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 09/21] target/ppc: Fix return value in tcg radix mmu fault handler David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 10/21] xics: directly register ICPState objects to vmstate David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 11/21] spapr: fix migration of ICPState objects from/to older QEMU David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 12/21] target/ppc: Proper cleanup when ppc_cpu_realizefn fails David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 13/21] spapr: prevent QEMU crash when CPU realization fails David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 14/21] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 15/21] target-ppc: Enable open-pic timers to count and generate interrupts David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 16/21] spapr: Start hotplugged PCI devices in ISOLATED state David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 17/21] spapr: Eliminate DRC 'signalled' state variable David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 18/21] spapr: Split DRC release from DRC detach David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 19/21] spapr: Make DRC reset force DRC into known state David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 20/21] spapr: Clean up DRC set_allocation_state path David Gibson
2017-06-30 10:46 ` [Qemu-devel] [PULL 21/21] spapr: Clean up DRC set_isolation_state() path David Gibson
2017-06-30 11:03 ` [Qemu-devel] [PULL 00/21] ppc-for-2.10 queue 20170730 Greg Kurz
2017-07-01  6:47   ` David Gibson
2017-06-30 12:26 ` Peter Maydell

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=20170718033708.GA3140@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=lvivier@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sbobroff@redhat.com \
    --cc=sursingh@redhat.com \
    --cc=thuth@redhat.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).