[Qemu-devel] [PATCH v2] spapr/htab: fix savevm

Laurent Vivier posted 1 patch 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170718101632.3304-1-lvivier@redhat.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
hw/ppc/spapr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH v2] spapr/htab: fix savevm
Posted by Laurent Vivier 6 years, 9 months ago
Commit 3a38429 ("spapr: Add a "no HPT" encoding to HTAB migration stream")
allows to migrate an empty HPT, but doesn't mark correctly the
end of the migration stream.

The end condition (value returned by htab_save_iterate())
should be 1, whereas in 3a38429 it returns 0.

The problem can be reproduced with QEMU monitor command "savevm":
the command never stops and the disk image grows without limit.

Fixes: 3a38429748aa4f74abaecf16c4c087e8a325e12a
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
v2: remove change in htab_save_complete() as
    it always return 0 in case of success (Thomas)

 hw/ppc/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 970093e..1cb09e7 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);
     }
-- 
2.9.4


Re: [Qemu-devel] [PATCH v2] spapr/htab: fix savevm
Posted by Thomas Huth 6 years, 9 months ago
On 18.07.2017 12:16, Laurent Vivier wrote:
> Commit 3a38429 ("spapr: Add a "no HPT" encoding to HTAB migration stream")
> allows to migrate an empty HPT, but doesn't mark correctly the
> end of the migration stream.
> 
> The end condition (value returned by htab_save_iterate())
> should be 1, whereas in 3a38429 it returns 0.
> 
> The problem can be reproduced with QEMU monitor command "savevm":
> the command never stops and the disk image grows without limit.
> 
> Fixes: 3a38429748aa4f74abaecf16c4c087e8a325e12a
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> v2: remove change in htab_save_complete() as
>     it always return 0 in case of success (Thomas)
> 
>  hw/ppc/spapr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 970093e..1cb09e7 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);
>      }
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

Re: [Qemu-devel] [PATCH v2] spapr/htab: fix savevm
Posted by David Gibson 6 years, 9 months ago
On Tue, Jul 18, 2017 at 12:16:32PM +0200, Laurent Vivier wrote:
> Commit 3a38429 ("spapr: Add a "no HPT" encoding to HTAB migration stream")
> allows to migrate an empty HPT, but doesn't mark correctly the
> end of the migration stream.
> 
> The end condition (value returned by htab_save_iterate())
> should be 1, whereas in 3a38429 it returns 0.
> 
> The problem can be reproduced with QEMU monitor command "savevm":
> the command never stops and the disk image grows without limit.
> 
> Fixes: 3a38429748aa4f74abaecf16c4c087e8a325e12a
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Applied to ppc-for-2.10, thanks.

> ---
> v2: remove change in htab_save_complete() as
>     it always return 0 in case of success (Thomas)
> 
>  hw/ppc/spapr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 970093e..1cb09e7 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);
>      }

-- 
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