All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/2] Xen HVM unplug changes
@ 2016-09-02  9:43 ` Olaf Hering
  0 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-02  9:43 UTC (permalink / raw)
  To: Stefano Stabellini, Anthony Perard
  Cc: Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S. Tsirkin, qemu-devel, xen-devel, Olaf Hering

Update unplug in Xen HVM guests to cover more cases.
Please review.

Olaf

changes in v2:
 - fix issues reported by checkpatch

Olaf Hering (2):
  xen_platform: unplug also SCSI disks
  xen_platform: SUSE xenlinux unplug for emulated PCI

 hw/i386/xen/xen_platform.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

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

* [PATCH v2 0/2] Xen HVM unplug changes
@ 2016-09-02  9:43 ` Olaf Hering
  0 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-02  9:43 UTC (permalink / raw)
  To: Stefano Stabellini, Anthony Perard
  Cc: Olaf Hering, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
	xen-devel, Paolo Bonzini, Richard Henderson

Update unplug in Xen HVM guests to cover more cases.
Please review.

Olaf

changes in v2:
 - fix issues reported by checkpatch

Olaf Hering (2):
  xen_platform: unplug also SCSI disks
  xen_platform: SUSE xenlinux unplug for emulated PCI

 hw/i386/xen/xen_platform.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)


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

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

* [Qemu-devel] [PATCH v2 1/2] xen_platform: unplug also SCSI disks
  2016-09-02  9:43 ` Olaf Hering
  (?)
@ 2016-09-02  9:43 ` Olaf Hering
  2016-09-15  1:50     ` Stefano Stabellini
  -1 siblings, 1 reply; 18+ messages in thread
From: Olaf Hering @ 2016-09-02  9:43 UTC (permalink / raw)
  To: Stefano Stabellini, Anthony Perard
  Cc: Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S. Tsirkin, qemu-devel, xen-devel, Olaf Hering

Using 'vdev=sd[a-o]' will create an emulated LSI controller, which can
be used by the emulated BIOS to boot from disk. If the HVM domU has also
PV driver the disk may appear twice in the guest. To avoid this an
unplug of the emulated hardware is needed, similar to what is done for
IDE and NIC drivers already.

Since the SCSI controller provides only disks the entire controller can
be unplugged at once.

Impact of the change for classic and pvops based guest kernels:

 vdev=sda:disk0
before: pvops:   disk0=pv xvda + emulated sda
        classic: disk0=pv sda  + emulated sdq
after:  pvops:   disk0=pv xvda
        classic: disk0=pv sda

 vdev=hda:disk0, vdev=sda:disk1
before: pvops:   disk0=pv xvda
                 disk1=emulated sda
        classic: disk0=pv hda
                 disk1=pv sda  + emulated sdq
after:  pvops:   disk0=pv xvda
                 disk1=not accessible by blkfront, index hda==index sda
        classic: disk0=pv hda
                 disk1=pv sda

 vdev=hda:disk0, vdev=sda:disk1, vdev=sdb:disk2
before: pvops:   disk0=pv xvda
                 disk1=emulated sda
                 disk2=pv xvdb + emulated sdb
        classic: disk0=pv hda
                 disk1=pv sda  + emulated sdq
                 disk2=pv sdb  + emulated sdr
after:  pvops:   disk0=pv xvda
                 disk1=not accessible by blkfront, index hda==index sda
                 disk2=pv xvdb
        classic: disk0=pv hda
                 disk1=pv sda
                 disk2=pv sda

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 hw/i386/xen/xen_platform.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index aa78393..53be3c7 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -114,6 +114,10 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
             PCI_CLASS_STORAGE_IDE
             && strcmp(d->name, "xen-pci-passthrough") != 0) {
         pci_piix3_xen_ide_unplug(DEVICE(d));
+    } else if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
+            PCI_CLASS_STORAGE_SCSI
+            && strcmp(d->name, "xen-pci-passthrough") != 0) {
+        object_unparent(OBJECT(d));
     }
 }
 

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

* [PATCH v2 1/2] xen_platform: unplug also SCSI disks
  2016-09-02  9:43 ` Olaf Hering
  (?)
  (?)
@ 2016-09-02  9:43 ` Olaf Hering
  -1 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-02  9:43 UTC (permalink / raw)
  To: Stefano Stabellini, Anthony Perard
  Cc: Olaf Hering, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
	xen-devel, Paolo Bonzini, Richard Henderson

Using 'vdev=sd[a-o]' will create an emulated LSI controller, which can
be used by the emulated BIOS to boot from disk. If the HVM domU has also
PV driver the disk may appear twice in the guest. To avoid this an
unplug of the emulated hardware is needed, similar to what is done for
IDE and NIC drivers already.

Since the SCSI controller provides only disks the entire controller can
be unplugged at once.

Impact of the change for classic and pvops based guest kernels:

 vdev=sda:disk0
before: pvops:   disk0=pv xvda + emulated sda
        classic: disk0=pv sda  + emulated sdq
after:  pvops:   disk0=pv xvda
        classic: disk0=pv sda

 vdev=hda:disk0, vdev=sda:disk1
before: pvops:   disk0=pv xvda
                 disk1=emulated sda
        classic: disk0=pv hda
                 disk1=pv sda  + emulated sdq
after:  pvops:   disk0=pv xvda
                 disk1=not accessible by blkfront, index hda==index sda
        classic: disk0=pv hda
                 disk1=pv sda

 vdev=hda:disk0, vdev=sda:disk1, vdev=sdb:disk2
before: pvops:   disk0=pv xvda
                 disk1=emulated sda
                 disk2=pv xvdb + emulated sdb
        classic: disk0=pv hda
                 disk1=pv sda  + emulated sdq
                 disk2=pv sdb  + emulated sdr
after:  pvops:   disk0=pv xvda
                 disk1=not accessible by blkfront, index hda==index sda
                 disk2=pv xvdb
        classic: disk0=pv hda
                 disk1=pv sda
                 disk2=pv sda

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 hw/i386/xen/xen_platform.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index aa78393..53be3c7 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -114,6 +114,10 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
             PCI_CLASS_STORAGE_IDE
             && strcmp(d->name, "xen-pci-passthrough") != 0) {
         pci_piix3_xen_ide_unplug(DEVICE(d));
+    } else if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
+            PCI_CLASS_STORAGE_SCSI
+            && strcmp(d->name, "xen-pci-passthrough") != 0) {
+        object_unparent(OBJECT(d));
     }
 }
 

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

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

* [Qemu-devel] [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
  2016-09-02  9:43 ` Olaf Hering
@ 2016-09-02  9:43   ` Olaf Hering
  -1 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-02  9:43 UTC (permalink / raw)
  To: Stefano Stabellini, Anthony Perard
  Cc: Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S. Tsirkin, qemu-devel, xen-devel, Olaf Hering

Implement SUSE specific unplug protocol for emulated PCI devices
in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'.
This protocol was implemented and used since Xen 3.0.4.
It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and
openSUSE 12.3.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 hw/i386/xen/xen_platform.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 53be3c7..6faee4c 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -313,13 +313,42 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
                                        uint64_t val, unsigned int size)
 {
     PCIXenPlatformState *s = opaque;
+    PCIDevice *pci_dev = PCI_DEVICE(s);
 
     switch (addr) {
     case 0: /* Platform flags */
         platform_fixed_ioport_writeb(opaque, 0, (uint32_t)val);
         break;
+    case 4:
+        if (val == 1) {
+            /*
+             * SUSE unplug for Xenlinux
+             * xen-kmp used this since xen-3.0.4, instead the official protocol
+             * from xen-3.3+ It did an unconditional "outl(1, (ioaddr + 4));"
+             * Pre VMDP 1.7 used 4 and 8 depending on how VMDP was configured.
+             * If VMDP was to control both disk and LAN it would use 4.
+             * If it controlled just disk or just LAN, it would use 8 below.
+             */
+            blk_drain_all();
+            blk_flush_all();
+            pci_unplug_disks(pci_dev->bus);
+            pci_unplug_nics(pci_dev->bus);
+        }
+        break;
     case 8:
-        log_writeb(s, (uint32_t)val);
+        switch (val) {
+        case 1:
+            blk_drain_all();
+            blk_flush_all();
+            pci_unplug_disks(pci_dev->bus);
+            break;
+        case 2:
+            pci_unplug_nics(pci_dev->bus);
+            break;
+        default:
+            log_writeb(s, (uint32_t)val);
+            break;
+        }
         break;
     default:
         break;

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

* [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
@ 2016-09-02  9:43   ` Olaf Hering
  0 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-02  9:43 UTC (permalink / raw)
  To: Stefano Stabellini, Anthony Perard
  Cc: Olaf Hering, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
	xen-devel, Paolo Bonzini, Richard Henderson

Implement SUSE specific unplug protocol for emulated PCI devices
in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'.
This protocol was implemented and used since Xen 3.0.4.
It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and
openSUSE 12.3.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 hw/i386/xen/xen_platform.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 53be3c7..6faee4c 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -313,13 +313,42 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
                                        uint64_t val, unsigned int size)
 {
     PCIXenPlatformState *s = opaque;
+    PCIDevice *pci_dev = PCI_DEVICE(s);
 
     switch (addr) {
     case 0: /* Platform flags */
         platform_fixed_ioport_writeb(opaque, 0, (uint32_t)val);
         break;
+    case 4:
+        if (val == 1) {
+            /*
+             * SUSE unplug for Xenlinux
+             * xen-kmp used this since xen-3.0.4, instead the official protocol
+             * from xen-3.3+ It did an unconditional "outl(1, (ioaddr + 4));"
+             * Pre VMDP 1.7 used 4 and 8 depending on how VMDP was configured.
+             * If VMDP was to control both disk and LAN it would use 4.
+             * If it controlled just disk or just LAN, it would use 8 below.
+             */
+            blk_drain_all();
+            blk_flush_all();
+            pci_unplug_disks(pci_dev->bus);
+            pci_unplug_nics(pci_dev->bus);
+        }
+        break;
     case 8:
-        log_writeb(s, (uint32_t)val);
+        switch (val) {
+        case 1:
+            blk_drain_all();
+            blk_flush_all();
+            pci_unplug_disks(pci_dev->bus);
+            break;
+        case 2:
+            pci_unplug_nics(pci_dev->bus);
+            break;
+        default:
+            log_writeb(s, (uint32_t)val);
+            break;
+        }
         break;
     default:
         break;

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

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

* Re: [Qemu-devel] [PATCH v2 1/2] xen_platform: unplug also SCSI disks
  2016-09-02  9:43 ` [Qemu-devel] [PATCH v2 1/2] xen_platform: unplug also SCSI disks Olaf Hering
@ 2016-09-15  1:50     ` Stefano Stabellini
  0 siblings, 0 replies; 18+ messages in thread
From: Stefano Stabellini @ 2016-09-15  1:50 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Stefano Stabellini, Anthony Perard, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Michael S. Tsirkin,
	qemu-devel, xen-devel

On Fri, 2 Sep 2016, Olaf Hering wrote:
> Using 'vdev=sd[a-o]' will create an emulated LSI controller, which can
> be used by the emulated BIOS to boot from disk. If the HVM domU has also
> PV driver the disk may appear twice in the guest. To avoid this an
> unplug of the emulated hardware is needed, similar to what is done for
> IDE and NIC drivers already.
> 
> Since the SCSI controller provides only disks the entire controller can
> be unplugged at once.
> 
> Impact of the change for classic and pvops based guest kernels:
> 
>  vdev=sda:disk0
> before: pvops:   disk0=pv xvda + emulated sda
>         classic: disk0=pv sda  + emulated sdq
> after:  pvops:   disk0=pv xvda
>         classic: disk0=pv sda
> 
>  vdev=hda:disk0, vdev=sda:disk1
> before: pvops:   disk0=pv xvda
>                  disk1=emulated sda
>         classic: disk0=pv hda
>                  disk1=pv sda  + emulated sdq
> after:  pvops:   disk0=pv xvda
>                  disk1=not accessible by blkfront, index hda==index sda
>         classic: disk0=pv hda
>                  disk1=pv sda
> 
>  vdev=hda:disk0, vdev=sda:disk1, vdev=sdb:disk2
> before: pvops:   disk0=pv xvda
>                  disk1=emulated sda
>                  disk2=pv xvdb + emulated sdb
>         classic: disk0=pv hda
>                  disk1=pv sda  + emulated sdq
>                  disk2=pv sdb  + emulated sdr
> after:  pvops:   disk0=pv xvda
>                  disk1=not accessible by blkfront, index hda==index sda
>                  disk2=pv xvdb
>         classic: disk0=pv hda
>                  disk1=pv sda
>                  disk2=pv sda
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  hw/i386/xen/xen_platform.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
> index aa78393..53be3c7 100644
> --- a/hw/i386/xen/xen_platform.c
> +++ b/hw/i386/xen/xen_platform.c
> @@ -114,6 +114,10 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
>              PCI_CLASS_STORAGE_IDE
>              && strcmp(d->name, "xen-pci-passthrough") != 0) {
>          pci_piix3_xen_ide_unplug(DEVICE(d));
> +    } else if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
> +            PCI_CLASS_STORAGE_SCSI
> +            && strcmp(d->name, "xen-pci-passthrough") != 0) {
> +        object_unparent(OBJECT(d));
>      }
>  }

Written like this, the code will unplug any Xen SCSI disks together with
Xen IDE disks when the guest writes "1" to ioport `0x10`. I am sorry to
be pedantic, but the recent changes introduced to
docs/misc/hvm-emulated-unplug.markdown do not cover any changes in
behavior to the existing ioport address (I am looking specifically at
point 6).  Sorry to only notice this now.

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

* Re: [PATCH v2 1/2] xen_platform: unplug also SCSI disks
@ 2016-09-15  1:50     ` Stefano Stabellini
  0 siblings, 0 replies; 18+ messages in thread
From: Stefano Stabellini @ 2016-09-15  1:50 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Stefano Stabellini, Eduardo Habkost, Michael S. Tsirkin,
	qemu-devel, xen-devel, Anthony Perard, Paolo Bonzini,
	Richard Henderson

On Fri, 2 Sep 2016, Olaf Hering wrote:
> Using 'vdev=sd[a-o]' will create an emulated LSI controller, which can
> be used by the emulated BIOS to boot from disk. If the HVM domU has also
> PV driver the disk may appear twice in the guest. To avoid this an
> unplug of the emulated hardware is needed, similar to what is done for
> IDE and NIC drivers already.
> 
> Since the SCSI controller provides only disks the entire controller can
> be unplugged at once.
> 
> Impact of the change for classic and pvops based guest kernels:
> 
>  vdev=sda:disk0
> before: pvops:   disk0=pv xvda + emulated sda
>         classic: disk0=pv sda  + emulated sdq
> after:  pvops:   disk0=pv xvda
>         classic: disk0=pv sda
> 
>  vdev=hda:disk0, vdev=sda:disk1
> before: pvops:   disk0=pv xvda
>                  disk1=emulated sda
>         classic: disk0=pv hda
>                  disk1=pv sda  + emulated sdq
> after:  pvops:   disk0=pv xvda
>                  disk1=not accessible by blkfront, index hda==index sda
>         classic: disk0=pv hda
>                  disk1=pv sda
> 
>  vdev=hda:disk0, vdev=sda:disk1, vdev=sdb:disk2
> before: pvops:   disk0=pv xvda
>                  disk1=emulated sda
>                  disk2=pv xvdb + emulated sdb
>         classic: disk0=pv hda
>                  disk1=pv sda  + emulated sdq
>                  disk2=pv sdb  + emulated sdr
> after:  pvops:   disk0=pv xvda
>                  disk1=not accessible by blkfront, index hda==index sda
>                  disk2=pv xvdb
>         classic: disk0=pv hda
>                  disk1=pv sda
>                  disk2=pv sda
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  hw/i386/xen/xen_platform.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
> index aa78393..53be3c7 100644
> --- a/hw/i386/xen/xen_platform.c
> +++ b/hw/i386/xen/xen_platform.c
> @@ -114,6 +114,10 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
>              PCI_CLASS_STORAGE_IDE
>              && strcmp(d->name, "xen-pci-passthrough") != 0) {
>          pci_piix3_xen_ide_unplug(DEVICE(d));
> +    } else if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
> +            PCI_CLASS_STORAGE_SCSI
> +            && strcmp(d->name, "xen-pci-passthrough") != 0) {
> +        object_unparent(OBJECT(d));
>      }
>  }

Written like this, the code will unplug any Xen SCSI disks together with
Xen IDE disks when the guest writes "1" to ioport `0x10`. I am sorry to
be pedantic, but the recent changes introduced to
docs/misc/hvm-emulated-unplug.markdown do not cover any changes in
behavior to the existing ioport address (I am looking specifically at
point 6).  Sorry to only notice this now.

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

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

* Re: [Qemu-devel] [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
  2016-09-02  9:43   ` Olaf Hering
@ 2016-09-15  1:56     ` Stefano Stabellini
  -1 siblings, 0 replies; 18+ messages in thread
From: Stefano Stabellini @ 2016-09-15  1:56 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Stefano Stabellini, Anthony Perard, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Michael S. Tsirkin,
	qemu-devel, xen-devel

On Fri, 2 Sep 2016, Olaf Hering wrote:
> Implement SUSE specific unplug protocol for emulated PCI devices
> in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'.
> This protocol was implemented and used since Xen 3.0.4.
> It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and
> openSUSE 12.3.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  hw/i386/xen/xen_platform.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
> index 53be3c7..6faee4c 100644
> --- a/hw/i386/xen/xen_platform.c
> +++ b/hw/i386/xen/xen_platform.c
> @@ -313,13 +313,42 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
>                                         uint64_t val, unsigned int size)
>  {
>      PCIXenPlatformState *s = opaque;
> +    PCIDevice *pci_dev = PCI_DEVICE(s);
>  
>      switch (addr) {
>      case 0: /* Platform flags */
>          platform_fixed_ioport_writeb(opaque, 0, (uint32_t)val);
>          break;
> +    case 4:
> +        if (val == 1) {
> +            /*
> +             * SUSE unplug for Xenlinux
> +             * xen-kmp used this since xen-3.0.4, instead the official protocol
> +             * from xen-3.3+ It did an unconditional "outl(1, (ioaddr + 4));"
> +             * Pre VMDP 1.7 used 4 and 8 depending on how VMDP was configured.
> +             * If VMDP was to control both disk and LAN it would use 4.
> +             * If it controlled just disk or just LAN, it would use 8 below.
> +             */
> +            blk_drain_all();
> +            blk_flush_all();
> +            pci_unplug_disks(pci_dev->bus);
> +            pci_unplug_nics(pci_dev->bus);
> +        }
> +        break;
>      case 8:
> -        log_writeb(s, (uint32_t)val);
> +        switch (val) {
> +        case 1:
> +            blk_drain_all();
> +            blk_flush_all();
> +            pci_unplug_disks(pci_dev->bus);
> +            break;
> +        case 2:
> +            pci_unplug_nics(pci_dev->bus);
> +            break;
> +        default:
> +            log_writeb(s, (uint32_t)val);
> +            break;

The doc says:

"If VMDP was configured to control just NIC devices it would write the
value 0x1 to offset 0x8. If VMDP was configured to control just storage
devices it would write the value 0x2 to offset 0x8."

So 0x1 to 0x8 to unplug NICs, otherwise 0x2 to 0x8 to unplug storage.
The switch above does the opposite. What am I missing? Am I misreading
the document?

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

* Re: [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
@ 2016-09-15  1:56     ` Stefano Stabellini
  0 siblings, 0 replies; 18+ messages in thread
From: Stefano Stabellini @ 2016-09-15  1:56 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Stefano Stabellini, Eduardo Habkost, Michael S. Tsirkin,
	qemu-devel, xen-devel, Anthony Perard, Paolo Bonzini,
	Richard Henderson

On Fri, 2 Sep 2016, Olaf Hering wrote:
> Implement SUSE specific unplug protocol for emulated PCI devices
> in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'.
> This protocol was implemented and used since Xen 3.0.4.
> It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and
> openSUSE 12.3.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  hw/i386/xen/xen_platform.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
> index 53be3c7..6faee4c 100644
> --- a/hw/i386/xen/xen_platform.c
> +++ b/hw/i386/xen/xen_platform.c
> @@ -313,13 +313,42 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
>                                         uint64_t val, unsigned int size)
>  {
>      PCIXenPlatformState *s = opaque;
> +    PCIDevice *pci_dev = PCI_DEVICE(s);
>  
>      switch (addr) {
>      case 0: /* Platform flags */
>          platform_fixed_ioport_writeb(opaque, 0, (uint32_t)val);
>          break;
> +    case 4:
> +        if (val == 1) {
> +            /*
> +             * SUSE unplug for Xenlinux
> +             * xen-kmp used this since xen-3.0.4, instead the official protocol
> +             * from xen-3.3+ It did an unconditional "outl(1, (ioaddr + 4));"
> +             * Pre VMDP 1.7 used 4 and 8 depending on how VMDP was configured.
> +             * If VMDP was to control both disk and LAN it would use 4.
> +             * If it controlled just disk or just LAN, it would use 8 below.
> +             */
> +            blk_drain_all();
> +            blk_flush_all();
> +            pci_unplug_disks(pci_dev->bus);
> +            pci_unplug_nics(pci_dev->bus);
> +        }
> +        break;
>      case 8:
> -        log_writeb(s, (uint32_t)val);
> +        switch (val) {
> +        case 1:
> +            blk_drain_all();
> +            blk_flush_all();
> +            pci_unplug_disks(pci_dev->bus);
> +            break;
> +        case 2:
> +            pci_unplug_nics(pci_dev->bus);
> +            break;
> +        default:
> +            log_writeb(s, (uint32_t)val);
> +            break;

The doc says:

"If VMDP was configured to control just NIC devices it would write the
value 0x1 to offset 0x8. If VMDP was configured to control just storage
devices it would write the value 0x2 to offset 0x8."

So 0x1 to 0x8 to unplug NICs, otherwise 0x2 to 0x8 to unplug storage.
The switch above does the opposite. What am I missing? Am I misreading
the document?

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

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

* Re: [Qemu-devel] [PATCH v2 1/2] xen_platform: unplug also SCSI disks
  2016-09-15  1:50     ` Stefano Stabellini
  (?)
  (?)
@ 2016-09-16  7:34     ` Olaf Hering
  -1 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-16  7:34 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Anthony Perard, Paolo Bonzini, Richard Henderson,
	Eduardo Habkost, Michael S. Tsirkin, qemu-devel, xen-devel

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

On Wed, Sep 14, Stefano Stabellini wrote:

> Written like this, the code will unplug any Xen SCSI disks together with
> Xen IDE disks when the guest writes "1" to ioport `0x10`. I am sorry to
> be pedantic, but the recent changes introduced to
> docs/misc/hvm-emulated-unplug.markdown do not cover any changes in
> behavior to the existing ioport address (I am looking specifically at
> point 6).  Sorry to only notice this now.

I will update the docs once the code is changed.

Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

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

* Re: [PATCH v2 1/2] xen_platform: unplug also SCSI disks
  2016-09-15  1:50     ` Stefano Stabellini
  (?)
@ 2016-09-16  7:34     ` Olaf Hering
  -1 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-16  7:34 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Eduardo Habkost, Michael S. Tsirkin, qemu-devel, xen-devel,
	Anthony Perard, Paolo Bonzini, Richard Henderson


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

On Wed, Sep 14, Stefano Stabellini wrote:

> Written like this, the code will unplug any Xen SCSI disks together with
> Xen IDE disks when the guest writes "1" to ioport `0x10`. I am sorry to
> be pedantic, but the recent changes introduced to
> docs/misc/hvm-emulated-unplug.markdown do not cover any changes in
> behavior to the existing ioport address (I am looking specifically at
> point 6).  Sorry to only notice this now.

I will update the docs once the code is changed.

Olaf

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

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

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

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

* Re: [Qemu-devel] [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
  2016-09-15  1:56     ` Stefano Stabellini
  (?)
@ 2016-09-16  7:38     ` Olaf Hering
  -1 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-16  7:38 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Anthony Perard, Paolo Bonzini, Richard Henderson,
	Eduardo Habkost, Michael S. Tsirkin, qemu-devel, xen-devel

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

On Wed, Sep 14, Stefano Stabellini wrote:

> The doc says:
> 
> "If VMDP was configured to control just NIC devices it would write the
> value 0x1 to offset 0x8. If VMDP was configured to control just storage
> devices it would write the value 0x2 to offset 0x8."
> 
> So 0x1 to 0x8 to unplug NICs, otherwise 0x2 to 0x8 to unplug storage.
> The switch above does the opposite. What am I missing? Am I misreading
> the document?

The doc is wrong, this is what qemu-trad does:

+    case 8:
+       if (val ==1 ) {
+               fprintf(logfile, "Disconnect IDE hard disk...\n");
+               ide_unplug_harddisks();
+               fprintf(logfile, "Done.\n");
+       } else if (val == 2) {
+               fprintf(logfile, "Disconnect netifs...\n");
+               pci_unplug_netifs();
+               fprintf(logfile, "Shutdown taps...\n");
+               net_tap_shutdown_all();
+               fprintf(logfile, "Done.\n");
+       }
+       break;

Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

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

* Re: [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
  2016-09-15  1:56     ` Stefano Stabellini
  (?)
  (?)
@ 2016-09-16  7:38     ` Olaf Hering
  -1 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-09-16  7:38 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Eduardo Habkost, Michael S. Tsirkin, qemu-devel, xen-devel,
	Anthony Perard, Paolo Bonzini, Richard Henderson


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

On Wed, Sep 14, Stefano Stabellini wrote:

> The doc says:
> 
> "If VMDP was configured to control just NIC devices it would write the
> value 0x1 to offset 0x8. If VMDP was configured to control just storage
> devices it would write the value 0x2 to offset 0x8."
> 
> So 0x1 to 0x8 to unplug NICs, otherwise 0x2 to 0x8 to unplug storage.
> The switch above does the opposite. What am I missing? Am I misreading
> the document?

The doc is wrong, this is what qemu-trad does:

+    case 8:
+       if (val ==1 ) {
+               fprintf(logfile, "Disconnect IDE hard disk...\n");
+               ide_unplug_harddisks();
+               fprintf(logfile, "Done.\n");
+       } else if (val == 2) {
+               fprintf(logfile, "Disconnect netifs...\n");
+               pci_unplug_netifs();
+               fprintf(logfile, "Shutdown taps...\n");
+               net_tap_shutdown_all();
+               fprintf(logfile, "Done.\n");
+       }
+       break;

Olaf

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

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

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

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

* Re: [Qemu-devel] [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
  2016-09-02  9:43   ` Olaf Hering
                     ` (2 preceding siblings ...)
  (?)
@ 2016-10-14  0:41   ` Stefano Stabellini
  2016-10-20 15:54       ` Olaf Hering
  -1 siblings, 1 reply; 18+ messages in thread
From: Stefano Stabellini @ 2016-10-14  0:41 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Stefano Stabellini, Anthony Perard, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Michael S. Tsirkin,
	qemu-devel, xen-devel

On Fri, 2 Sep 2016, Olaf Hering wrote:
> Implement SUSE specific unplug protocol for emulated PCI devices
> in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'.
> This protocol was implemented and used since Xen 3.0.4.
> It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and
> openSUSE 12.3.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  hw/i386/xen/xen_platform.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
> index 53be3c7..6faee4c 100644
> --- a/hw/i386/xen/xen_platform.c
> +++ b/hw/i386/xen/xen_platform.c
> @@ -313,13 +313,42 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
>                                         uint64_t val, unsigned int size)
>  {
>      PCIXenPlatformState *s = opaque;
> +    PCIDevice *pci_dev = PCI_DEVICE(s);
>  
>      switch (addr) {
>      case 0: /* Platform flags */
>          platform_fixed_ioport_writeb(opaque, 0, (uint32_t)val);
>          break;
> +    case 4:
> +        if (val == 1) {
> +            /*
> +             * SUSE unplug for Xenlinux
> +             * xen-kmp used this since xen-3.0.4, instead the official protocol
> +             * from xen-3.3+ It did an unconditional "outl(1, (ioaddr + 4));"
> +             * Pre VMDP 1.7 used 4 and 8 depending on how VMDP was configured.
> +             * If VMDP was to control both disk and LAN it would use 4.
> +             * If it controlled just disk or just LAN, it would use 8 below.
> +             */
> +            blk_drain_all();
> +            blk_flush_all();

I was about to send a pull request for this series but blk_flush_all
causes a build failure:

/local/qemu-upstream/hw/i386/xen/xen_platform.c: In function 'xen_platform_ioport_writeb':
/local/qemu-upstream/hw/i386/xen/xen_platform.c:331:13: error: implicit declaration of function 'blk_flush_all' [-Werror=implicit-function-declaration]
/local/qemu-upstream/hw/i386/xen/xen_platform.c:331:13: error: nested extern declaration of 'blk_flush_all' [-Werror=nested-externs]
cc1: all warnings being treated as errors
make[1]: *** [hw/i386/xen/xen_platform.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [subdir-i386-softmmu] Error 2



> +            pci_unplug_disks(pci_dev->bus);
> +            pci_unplug_nics(pci_dev->bus);
> +        }
> +        break;
>      case 8:
> -        log_writeb(s, (uint32_t)val);
> +        switch (val) {
> +        case 1:
> +            blk_drain_all();
> +            blk_flush_all();
> +            pci_unplug_disks(pci_dev->bus);
> +            break;
> +        case 2:
> +            pci_unplug_nics(pci_dev->bus);
> +            break;
> +        default:
> +            log_writeb(s, (uint32_t)val);
> +            break;
> +        }
>          break;
>      default:
>          break;
> 

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

* Re: [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
  2016-09-02  9:43   ` Olaf Hering
  (?)
  (?)
@ 2016-10-14  0:41   ` Stefano Stabellini
  -1 siblings, 0 replies; 18+ messages in thread
From: Stefano Stabellini @ 2016-10-14  0:41 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Stefano Stabellini, Eduardo Habkost, Michael S. Tsirkin,
	qemu-devel, xen-devel, Anthony Perard, Paolo Bonzini,
	Richard Henderson

On Fri, 2 Sep 2016, Olaf Hering wrote:
> Implement SUSE specific unplug protocol for emulated PCI devices
> in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'.
> This protocol was implemented and used since Xen 3.0.4.
> It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and
> openSUSE 12.3.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  hw/i386/xen/xen_platform.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
> index 53be3c7..6faee4c 100644
> --- a/hw/i386/xen/xen_platform.c
> +++ b/hw/i386/xen/xen_platform.c
> @@ -313,13 +313,42 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
>                                         uint64_t val, unsigned int size)
>  {
>      PCIXenPlatformState *s = opaque;
> +    PCIDevice *pci_dev = PCI_DEVICE(s);
>  
>      switch (addr) {
>      case 0: /* Platform flags */
>          platform_fixed_ioport_writeb(opaque, 0, (uint32_t)val);
>          break;
> +    case 4:
> +        if (val == 1) {
> +            /*
> +             * SUSE unplug for Xenlinux
> +             * xen-kmp used this since xen-3.0.4, instead the official protocol
> +             * from xen-3.3+ It did an unconditional "outl(1, (ioaddr + 4));"
> +             * Pre VMDP 1.7 used 4 and 8 depending on how VMDP was configured.
> +             * If VMDP was to control both disk and LAN it would use 4.
> +             * If it controlled just disk or just LAN, it would use 8 below.
> +             */
> +            blk_drain_all();
> +            blk_flush_all();

I was about to send a pull request for this series but blk_flush_all
causes a build failure:

/local/qemu-upstream/hw/i386/xen/xen_platform.c: In function 'xen_platform_ioport_writeb':
/local/qemu-upstream/hw/i386/xen/xen_platform.c:331:13: error: implicit declaration of function 'blk_flush_all' [-Werror=implicit-function-declaration]
/local/qemu-upstream/hw/i386/xen/xen_platform.c:331:13: error: nested extern declaration of 'blk_flush_all' [-Werror=nested-externs]
cc1: all warnings being treated as errors
make[1]: *** [hw/i386/xen/xen_platform.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [subdir-i386-softmmu] Error 2



> +            pci_unplug_disks(pci_dev->bus);
> +            pci_unplug_nics(pci_dev->bus);
> +        }
> +        break;
>      case 8:
> -        log_writeb(s, (uint32_t)val);
> +        switch (val) {
> +        case 1:
> +            blk_drain_all();
> +            blk_flush_all();
> +            pci_unplug_disks(pci_dev->bus);
> +            break;
> +        case 2:
> +            pci_unplug_nics(pci_dev->bus);
> +            break;
> +        default:
> +            log_writeb(s, (uint32_t)val);
> +            break;
> +        }
>          break;
>      default:
>          break;
> 

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

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

* Re: [Qemu-devel] [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
  2016-10-14  0:41   ` [Qemu-devel] " Stefano Stabellini
@ 2016-10-20 15:54       ` Olaf Hering
  0 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-10-20 15:54 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Anthony Perard, Paolo Bonzini, Richard Henderson,
	Eduardo Habkost, Michael S. Tsirkin, qemu-devel, xen-devel

[-- Attachment #1: Type: text/plain, Size: 815 bytes --]

On Thu, Oct 13, Stefano Stabellini wrote:

> On Fri, 2 Sep 2016, Olaf Hering wrote:
> > Implement SUSE specific unplug protocol for emulated PCI devices
> > in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'.
> > This protocol was implemented and used since Xen 3.0.4.
> > It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and
> > openSUSE 12.3.

> I was about to send a pull request for this series but blk_flush_all
> causes a build failure:
> 
> /local/qemu-upstream/hw/i386/xen/xen_platform.c: In function 'xen_platform_ioport_writeb':
> /local/qemu-upstream/hw/i386/xen/xen_platform.c:331:13: error: implicit declaration of function 'blk_flush_all' [-Werror=implicit-function-declaration]

This is caused by 49137bf6845eaecad51a047fc06dd11c56118460.
I will resend.


Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

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

* Re: [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
@ 2016-10-20 15:54       ` Olaf Hering
  0 siblings, 0 replies; 18+ messages in thread
From: Olaf Hering @ 2016-10-20 15:54 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Eduardo Habkost, Michael S. Tsirkin, qemu-devel, xen-devel,
	Anthony Perard, Paolo Bonzini, Richard Henderson


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

On Thu, Oct 13, Stefano Stabellini wrote:

> On Fri, 2 Sep 2016, Olaf Hering wrote:
> > Implement SUSE specific unplug protocol for emulated PCI devices
> > in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'.
> > This protocol was implemented and used since Xen 3.0.4.
> > It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and
> > openSUSE 12.3.

> I was about to send a pull request for this series but blk_flush_all
> causes a build failure:
> 
> /local/qemu-upstream/hw/i386/xen/xen_platform.c: In function 'xen_platform_ioport_writeb':
> /local/qemu-upstream/hw/i386/xen/xen_platform.c:331:13: error: implicit declaration of function 'blk_flush_all' [-Werror=implicit-function-declaration]

This is caused by 49137bf6845eaecad51a047fc06dd11c56118460.
I will resend.


Olaf

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

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

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

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

end of thread, other threads:[~2016-10-20 15:54 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02  9:43 [Qemu-devel] [PATCH v2 0/2] Xen HVM unplug changes Olaf Hering
2016-09-02  9:43 ` Olaf Hering
2016-09-02  9:43 ` [Qemu-devel] [PATCH v2 1/2] xen_platform: unplug also SCSI disks Olaf Hering
2016-09-15  1:50   ` Stefano Stabellini
2016-09-15  1:50     ` Stefano Stabellini
2016-09-16  7:34     ` Olaf Hering
2016-09-16  7:34     ` [Qemu-devel] " Olaf Hering
2016-09-02  9:43 ` Olaf Hering
2016-09-02  9:43 ` [Qemu-devel] [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI Olaf Hering
2016-09-02  9:43   ` Olaf Hering
2016-09-15  1:56   ` [Qemu-devel] " Stefano Stabellini
2016-09-15  1:56     ` Stefano Stabellini
2016-09-16  7:38     ` [Qemu-devel] " Olaf Hering
2016-09-16  7:38     ` Olaf Hering
2016-10-14  0:41   ` Stefano Stabellini
2016-10-14  0:41   ` [Qemu-devel] " Stefano Stabellini
2016-10-20 15:54     ` Olaf Hering
2016-10-20 15:54       ` Olaf Hering

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.