Skip to contentSkip to conversation

spapr/htab: fix savevm

PATCH Applied Laurent Vivier 3 participants 3 messages Jul 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spapr/htab: fix savevm

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

---
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(-)
hw/ppc/spapr.c +1 -1
index 970093e..1cb09e7 100644
@@ -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);
     }
Signature · 1 line
2.9.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 25 lines · Laurent Vivier

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

---
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(-)
hw/ppc/spapr.c +0 -0
index 970093e..1cb09e7 100644

hw/ppc/spapr.c static int htab_save_iterate(QEMUFile *f, void *opaque) · line 1833

Quoted 8 lines
hw/ppc/spapr.c +1 -1
@@ -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);
     }
Applied
#2 lore raw
In reply to Laurent Vivier
Quoted 4 lines · Laurent Vivier

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.

Quoted 8 lines

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

Applied to ppc-for-2.10, thanks.

Quoted 20 lines

---
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(-)
hw/ppc/spapr.c +1 -1
index 970093e..1cb09e7 100644
@@ -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);
     }
Signature · 4 lines
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