All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] unmodified_drivers: unplug the emulated devices at resume time
@ 2018-06-12 14:10 Olaf Hering
  2018-06-12 15:01 ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Olaf Hering @ 2018-06-12 14:10 UTC (permalink / raw)
  To: xen-devel; +Cc: Olaf Hering, Jan Beulich

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 <olaf@aepfle.de>
---
 .../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)

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] unmodified_drivers: unplug the emulated devices at resume time
  2018-06-12 14:10 [PATCH v1] unmodified_drivers: unplug the emulated devices at resume time Olaf Hering
@ 2018-06-12 15:01 ` Jan Beulich
  2018-06-12 15:05   ` Olaf Hering
  2018-06-12 19:39   ` Stefano Stabellini
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Beulich @ 2018-06-12 15:01 UTC (permalink / raw)
  To: Olaf Hering, Stefano Stabellini; +Cc: xen-devel

>>> On 12.06.18 at 16:10, <olaf@aepfle.de> wrote:
> 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.

So there's no plan to fix this on the qemu side?

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

Hmm, that change has no explanation whatsoever of why this was
necessary already back at that time. Stefano?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] unmodified_drivers: unplug the emulated devices at resume time
  2018-06-12 15:01 ` Jan Beulich
@ 2018-06-12 15:05   ` Olaf Hering
  2018-06-12 19:39   ` Stefano Stabellini
  1 sibling, 0 replies; 6+ messages in thread
From: Olaf Hering @ 2018-06-12 15:05 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Stefano Stabellini, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 295 bytes --]

Am Tue, 12 Jun 2018 09:01:07 -0600
schrieb "Jan Beulich" <JBeulich@suse.com>:

> So there's no plan to fix this on the qemu side?

Even if there would be one, existing dom0s may not get an update in time.

I sent some prototype of a potential fix for qemu, it needs more work.


Olaf

[-- Attachment #1.2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] unmodified_drivers: unplug the emulated devices at resume time
  2018-06-12 15:01 ` Jan Beulich
  2018-06-12 15:05   ` Olaf Hering
@ 2018-06-12 19:39   ` Stefano Stabellini
  2018-06-13  6:27     ` Jan Beulich
  1 sibling, 1 reply; 6+ messages in thread
From: Stefano Stabellini @ 2018-06-12 19:39 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Olaf Hering, Stefano Stabellini, xen-devel

On Tue, 12 Jun 2018, Jan Beulich wrote:
> >>> On 12.06.18 at 16:10, <olaf@aepfle.de> wrote:
> > 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.
> 
> So there's no plan to fix this on the qemu side?
> 
> > 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.
> 
> Hmm, that change has no explanation whatsoever of why this was
> necessary already back at that time. Stefano?

It was too long ago, I don't remember exactly, but my guess is that the
presence of the emulated devices at resume time was causing problems to
Linux. Given that Linux HVM was supposed to be able to run on older
versions of Xen, the workaround was put in Linux rather than Xen. (I
wonder if the Windows PV drivers have also something similar.)

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] unmodified_drivers: unplug the emulated devices at resume time
  2018-06-12 19:39   ` Stefano Stabellini
@ 2018-06-13  6:27     ` Jan Beulich
  2018-06-13  8:16       ` Paul Durrant
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2018-06-13  6:27 UTC (permalink / raw)
  To: Paul Durrant; +Cc: Olaf Hering, Stefano Stabellini, xen-devel

>>> On 12.06.18 at 21:39, <sstabellini@kernel.org> wrote:
> On Tue, 12 Jun 2018, Jan Beulich wrote:
>> >>> On 12.06.18 at 16:10, <olaf@aepfle.de> wrote:
>> > 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.
>> 
>> So there's no plan to fix this on the qemu side?
>> 
>> > 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.
>> 
>> Hmm, that change has no explanation whatsoever of why this was
>> necessary already back at that time. Stefano?
> 
> It was too long ago, I don't remember exactly, but my guess is that the
> presence of the emulated devices at resume time was causing problems to
> Linux. Given that Linux HVM was supposed to be able to run on older
> versions of Xen, the workaround was put in Linux rather than Xen. (I
> wonder if the Windows PV drivers have also something similar.)

Paul?

Thanks, Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] unmodified_drivers: unplug the emulated devices at resume time
  2018-06-13  6:27     ` Jan Beulich
@ 2018-06-13  8:16       ` Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2018-06-13  8:16 UTC (permalink / raw)
  To: 'Jan Beulich'; +Cc: Olaf Hering, Stefano Stabellini, xen-devel

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 13 June 2018 07:27
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: Olaf Hering <olaf@aepfle.de>; Stefano Stabellini
> <sstabellini@kernel.org>; xen-devel@lists.xen.org
> Subject: Re: [PATCH v1] unmodified_drivers: unplug the emulated devices at
> resume time
> 
> >>> On 12.06.18 at 21:39, <sstabellini@kernel.org> wrote:
> > On Tue, 12 Jun 2018, Jan Beulich wrote:
> >> >>> On 12.06.18 at 16:10, <olaf@aepfle.de> wrote:
> >> > 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.
> >>
> >> So there's no plan to fix this on the qemu side?
> >>
> >> > 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.
> >>
> >> Hmm, that change has no explanation whatsoever of why this was
> >> necessary already back at that time. Stefano?
> >
> > It was too long ago, I don't remember exactly, but my guess is that the
> > presence of the emulated devices at resume time was causing problems to
> > Linux. Given that Linux HVM was supposed to be able to run on older
> > versions of Xen, the workaround was put in Linux rather than Xen. (I
> > wonder if the Windows PV drivers have also something similar.)
> 
> Paul?

Yes, they do. Emulated devices are unplugged on resume, just after the hypercall table is updated. See:

http://xenbits.xen.org/gitweb/?p=pvdrivers/win/xenbus.git;a=blob;f=src/xenbus/suspend.c;hb=HEAD#l219

AFAIK this has always done (dating back to the ancient Citrix drivers). I suspect you'll find the same in GPLPV.

  Paul

> 
> Thanks, Jan
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-06-13  8:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 14:10 [PATCH v1] unmodified_drivers: unplug the emulated devices at resume time Olaf Hering
2018-06-12 15:01 ` Jan Beulich
2018-06-12 15:05   ` Olaf Hering
2018-06-12 19:39   ` Stefano Stabellini
2018-06-13  6:27     ` Jan Beulich
2018-06-13  8:16       ` Paul Durrant

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.