[kvm-unit-tests RFC PATCH] Workaround (possible) QEMU migration bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Recent updates to machine memory can seemingly be lost across QEMU TCG
migration. This patch stops the machine on the source before migrating,
after which the problem can no longer be reproduced.

This isn't arm64 specific, powerpc could also see corruption using the
reproducer. It must be just that it's getchar implementation was different
enough that it didn't show up there.

arm64 runs the migration selftest okay with this and the uart patch.

I'll try to work out a simpler reproducer patch to report the QEMU issue
with, but in the meantime a sanity check and any suggestions about this
would be appreciated.

Thanks,
Nick

---
 common/selftest-migration.c | 5 -----
 scripts/arch-run.bash       | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/selftest-migration.c b/common/selftest-migration.c
index 02b102cc5..dd36696fd 100644
--- a/common/selftest-migration.c
+++ b/common/selftest-migration.c
@@ -10,12 +10,7 @@
 #include <libcflat.h>
 #include <migrate.h>
 
-#if defined(__arm__) || defined(__aarch64__)
-/* arm can only call getchar 15 times */
-#define NR_MIGRATIONS 15
-#else
 #define NR_MIGRATIONS 100
-#endif
 
 int main(int argc, char **argv)
 {
diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 2214d940c..0d6950c26 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -209,6 +209,9 @@ do_migration ()
 	while ! [ -S ${dst_incoming} ] ; do sleep 0.1 ; done
 	while ! [ -S ${dst_qmp} ] ; do sleep 0.1 ; done
 
+	# Stop the machine before migration. This works around a QEMU
+	# problem with memory updates being lost.
+	qmp ${src_qmp} '"stop"' > ${src_qmpout}
 	qmp ${src_qmp} '"migrate", "arguments": { "uri": "unix:'${dst_incoming}'" }' > ${src_qmpout}
 
 	# Wait for the migration to complete
@@ -232,6 +235,8 @@ do_migration ()
 	done
 
 	qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null
+	# Resume the machine after migrate.
+	qmp ${dst_qmp} '"cont"' > ${dst_qmpout}
 
 	# keypress to dst so getchar completes and test continues
 	echo > ${dst_infifo}
-- 
2.42.0





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux