From 149b321279fe8edf87b7f68134e78eb8be47ce6a Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 12 Jun 2018 16:11:00 +0200 Subject: [PATCH] unmodified_drivers: unplug the emulated devices at resume time Since qemu-2.10 it is required to unplug emulated devices again after a live migration. If this is not done, qemu's block-backend driver will be unable to open the backing disk image because it is still busy by qemu's IDE driver. As a result the domUs block-frontend driver will be unable to access the disks, and the domU has to be destroyed. libxl is unable to detect the situation. Apply the same workaround for this qemu bug that was done already years ago in linux.git with commit 512b109ec962 ("xen: unplug the emulated devices at resume time") to make sure xenlinux based domUs can be migrated to unfixed hosts. Signed-off-by: Olaf Hering Acked-by: Jan Beulich --- .../linux-2.6/platform-pci/platform-pci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c index a7dbd0a8ab..8e4e814d29 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -285,6 +285,12 @@ int gnttab_init(void); #define UNPLUG_AUX_IDE_DISKS 4 #define UNPLUG_ALL 7 +static short unplug_value; +static void unplug_devices(void) +{ + outw(unplug_value, XEN_IOPORT_UNPLUG); +} + static int check_platform_magic(struct device *dev, long ioaddr, long iolen) { short magic, unplug = 0; @@ -312,6 +318,7 @@ static int check_platform_magic(struct device *dev, long ioaddr, long iolen) dev_warn(dev, "unrecognised option '%s' " "in module parameter 'dev_unplug'\n", p); } + unplug_value = unplug; if (iolen < 0x16) { err = "backend too old"; @@ -339,7 +346,7 @@ static int check_platform_magic(struct device *dev, long ioaddr, long iolen) } /* Fall through */ case 0: - outw(unplug, XEN_IOPORT_UNPLUG); + unplug_devices(); break; default: err = "unknown I/O protocol version"; @@ -498,6 +505,8 @@ void platform_pci_resume(void) if (set_callback_via(callback_via)) printk("platform_pci_resume failure!\n"); + + unplug_devices(); } static int __init platform_pci_module_init(void) -- 2.39.5