[RFC PATCH 0/3] fix migrate failed when vm is in booting

wanghaibin
2017-09-06T13:04:08Z

We have a test scenario： vmlife and migrate fixed test.

Here is a problem； VM migration failed caused the qemu core which gdb trace:

#0 0x0000ffffb023fe84 in raise () from /usr/lib64/libc.so.6
#1 0x0000ffffb0241b80 in abort () from /usr/lib64/libc.so.6
#2 0x000000000046b408 in kvm_device_access (fd=<optimized out>, group=4, attr=1, val=<optimized out>, write=<optimized out>)
at /usr/src/debug/qemu-2.6.0/kvm-all.c:2064
#3 0x000000000059ade8 in vm_state_notify (running=running@entry=0, state=state@entry=RUN_STATE_FINISH_MIGRATE) at vl.c:1728
#4 0x000000000045736c in do_vm_stop (state=state@entry=RUN_STATE_FINISH_MIGRATE) at /usr/src/debug/qemu-2.6.0/cpus.c:744
#5 0x00000000004573bc in vm_stop (state=state@entry=RUN_STATE_FINISH_MIGRATE) at /usr/src/debug/qemu-2.6.0/cpus.c:1434
#6 0x0000000000457428 in vm_stop_force_state (state=state@entry=RUN_STATE_FINISH_MIGRATE) at /usr/src/debug/qemu-2.6.0/cpus.c:1442
#7 0x00000000006d68d0 in migration_completion (s=s@entry=0xb92d60 <current_migration.37525>, current_active_state=4,
current_active_state@entry=65535, old_vm_running=0xffffb03c2000, old_vm_running@entry=0xfffe934fc53f,
start_time=0xfffe934fcce0, start_time@entry=0xfffe934fc540) at migration/migration.c:1798
#8 0x00000000006d7480 in migration_thread (opaque=0xb92d60 <current_migration.37525>) at migration/migration.c:1995
#9 0x0000ffffb0398dc4 in start_thread () from /usr/lib64/libpthread.so.0
#10 0x0000ffffb02ef020 in thread_start () from /usr/lib64/libc.so.6

qemu failed log :
2017-08-28T12:34:29.654396Z qemu-kvm: KVM_SET_DEVICE_ATTR failed: Invalid argument

I try to debug it, and I found the migrate at the moment that the vm is still booting.

So just change the guest like :
diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c
index e9a53ba..d73fc03 100644
--- a/drivers/pci/host/pci-host-common.c
+++ b/drivers/pci/host/pci-host-common.c
@@ -23,6 +23,7 @@
#include <linux/of_pci.h>
#include <linux/pci-ecam.h>
#include <linux/platform_device.h>
+#include <linux/delay.h>

static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
struct list_head *resources, struct resource **bus_range)
@@ -119,6 +120,7 @@ int pci_host_common_probe(struct platform_device *pdev,
struct pci_bus *bus, *child;
struct pci_config_window *cfg;
struct list_head resources;
+ int i;

type = of_get_property(np, "device_type", NULL);
if (!type || strcmp(type, "pci")) {
@@ -164,6 +166,8 @@ int pci_host_common_probe(struct platform_device *pdev,
pcie_bus_configure_settings(child);
}

+ for (i=0;i<20000; i++)
+ udelay(1000);
pci_bus_add_devices(bus);
return 0;
}

And migrate at this delay time, It must be failed.

This patchset try to fix this problem.

BTW: This patchset just a demo, haven't do more test, and the implement maybe a little evil.

Thanks

wanghaibin (3):
kvm: arm/arm64: vgic-vits: separate vgic_its_free_list() function
kvm: arm/arm64: vgic-vits: free its resource when vm reboot/reset
kvm: arm/arm64: vgic-its: fix return value for restore

virt/kvm/arm/arm.c | 5 ++++-
virt/kvm/arm/vgic/vgic-its.c | 26 +++++++++++++++++++-------
virt/kvm/arm/vgic/vgic.h | 1 +
3 files changed, 24 insertions(+), 8 deletions(-)

--
1.8.3.1

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu