* [PATCH v3 0/2] Xen HVM unplug changes
@ 2016-10-21 12:37 Olaf Hering
2016-10-21 12:37 ` [PATCH v3 1/2] xen_platform: unplug also SCSI disks Olaf Hering
2016-10-21 12:37 ` [PATCH v3 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI Olaf Hering
0 siblings, 2 replies; 9+ messages in thread
From: Olaf Hering @ 2016-10-21 12:37 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.
changes in v3:
- adapt to API changes from 49137bf ("block-backend: remove blk_flush_all")
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 | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 1/2] xen_platform: unplug also SCSI disks 2016-10-21 12:37 [PATCH v3 0/2] Xen HVM unplug changes Olaf Hering @ 2016-10-21 12:37 ` Olaf Hering 2016-10-21 19:54 ` Stefano Stabellini 2016-11-24 10:59 ` Olaf Hering 2016-10-21 12:37 ` [PATCH v3 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI Olaf Hering 1 sibling, 2 replies; 9+ messages in thread From: Olaf Hering @ 2016-10-21 12:37 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 f85635c..91d8a7a 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] 9+ messages in thread
* Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks 2016-10-21 12:37 ` [PATCH v3 1/2] xen_platform: unplug also SCSI disks Olaf Hering @ 2016-10-21 19:54 ` Stefano Stabellini 2016-11-24 10:59 ` Olaf Hering 1 sibling, 0 replies; 9+ messages in thread From: Stefano Stabellini @ 2016-10-21 19:54 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, 21 Oct 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> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > 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 f85635c..91d8a7a 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 [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks 2016-10-21 12:37 ` [PATCH v3 1/2] xen_platform: unplug also SCSI disks Olaf Hering 2016-10-21 19:54 ` Stefano Stabellini @ 2016-11-24 10:59 ` Olaf Hering 2016-11-28 18:28 ` Stefano Stabellini 1 sibling, 1 reply; 9+ messages in thread From: Olaf Hering @ 2016-11-24 10:59 UTC (permalink / raw) To: Stefano Stabellini, Anthony Perard; +Cc: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 671 bytes --] On Fri, Oct 21, 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. How are these patches supposed to find their way into qemu-xen.git#staging? Do I have to wait until #staging gets updated to qemu-2.8+ at some point, or would you please cherry-pick these two commits: 3513201 xen_platform: SUSE xenlinux unplug for emulated PCI 78f6689 xen_platform: unplug also SCSI disks 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] 9+ messages in thread
* Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks 2016-11-24 10:59 ` Olaf Hering @ 2016-11-28 18:28 ` Stefano Stabellini 2016-11-29 4:18 ` Wei Liu 0 siblings, 1 reply; 9+ messages in thread From: Stefano Stabellini @ 2016-11-28 18:28 UTC (permalink / raw) To: Olaf Hering; +Cc: Anthony Perard, xen-devel, Stefano Stabellini, wei.liu2 On Thu, 24 Nov 2016, Olaf Hering wrote: > On Fri, Oct 21, 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. > > How are these patches supposed to find their way into > qemu-xen.git#staging? Do I have to wait until #staging gets updated to > qemu-2.8+ at some point, or would you please cherry-pick these two commits: > > 3513201 xen_platform: SUSE xenlinux unplug for emulated PCI > 78f6689 xen_platform: unplug also SCSI disks Anthony, are you going to take care of this? However, given the state of the release, they'll need a release-ack to be applied. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks 2016-11-28 18:28 ` Stefano Stabellini @ 2016-11-29 4:18 ` Wei Liu 2016-11-29 14:41 ` Olaf Hering 0 siblings, 1 reply; 9+ messages in thread From: Wei Liu @ 2016-11-29 4:18 UTC (permalink / raw) To: Stefano Stabellini; +Cc: Anthony Perard, xen-devel, Olaf Hering, wei.liu2 On Mon, Nov 28, 2016 at 10:28:21AM -0800, Stefano Stabellini wrote: > On Thu, 24 Nov 2016, Olaf Hering wrote: > > On Fri, Oct 21, 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. > > > > How are these patches supposed to find their way into > > qemu-xen.git#staging? Do I have to wait until #staging gets updated to > > qemu-2.8+ at some point, or would you please cherry-pick these two commits: > > > > 3513201 xen_platform: SUSE xenlinux unplug for emulated PCI > > 78f6689 xen_platform: unplug also SCSI disks > > Anthony, are you going to take care of this? > However, given the state of the release, they'll need a release-ack to > be applied. I think these patches will need to wait to be backported after 4.8 is released. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks 2016-11-29 4:18 ` Wei Liu @ 2016-11-29 14:41 ` Olaf Hering 0 siblings, 0 replies; 9+ messages in thread From: Olaf Hering @ 2016-11-29 14:41 UTC (permalink / raw) To: Wei Liu; +Cc: Anthony Perard, xen-devel, Stefano Stabellini [-- Attachment #1.1: Type: text/plain, Size: 471 bytes --] On Tue, Nov 29, Wei Liu wrote: > On Mon, Nov 28, 2016 at 10:28:21AM -0800, Stefano Stabellini wrote: > > Anthony, are you going to take care of this? > > However, given the state of the release, they'll need a release-ack to > > be applied. > I think these patches will need to wait to be backported after 4.8 is > released. Also this patch should be backported to every tree containing qemu-2.1+: "xen_disk: split discard input to match internal representation" Olaf [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 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] 9+ messages in thread
* [PATCH v3 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI 2016-10-21 12:37 [PATCH v3 0/2] Xen HVM unplug changes Olaf Hering 2016-10-21 12:37 ` [PATCH v3 1/2] xen_platform: unplug also SCSI disks Olaf Hering @ 2016-10-21 12:37 ` Olaf Hering 2016-10-21 19:55 ` Stefano Stabellini 1 sibling, 1 reply; 9+ messages in thread From: Olaf Hering @ 2016-10-21 12:37 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. In addition old (pre-2011) VMDP versions are handled as well. Signed-off-by: Olaf Hering <olaf@aepfle.de> --- hw/i386/xen/xen_platform.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c index 91d8a7a..2e1e543 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -311,13 +311,38 @@ 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. + */ + 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: + 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] 9+ messages in thread
* Re: [PATCH v3 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI 2016-10-21 12:37 ` [PATCH v3 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI Olaf Hering @ 2016-10-21 19:55 ` Stefano Stabellini 0 siblings, 0 replies; 9+ messages in thread From: Stefano Stabellini @ 2016-10-21 19:55 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, 21 Oct 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. > In addition old (pre-2011) VMDP versions are handled as well. > > Signed-off-by: Olaf Hering <olaf@aepfle.de> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > hw/i386/xen/xen_platform.c | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > > diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c > index 91d8a7a..2e1e543 100644 > --- a/hw/i386/xen/xen_platform.c > +++ b/hw/i386/xen/xen_platform.c > @@ -311,13 +311,38 @@ 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. > + */ > + 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: > + 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] 9+ messages in thread
end of thread, other threads:[~2016-11-29 14:42 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-10-21 12:37 [PATCH v3 0/2] Xen HVM unplug changes Olaf Hering 2016-10-21 12:37 ` [PATCH v3 1/2] xen_platform: unplug also SCSI disks Olaf Hering 2016-10-21 19:54 ` Stefano Stabellini 2016-11-24 10:59 ` Olaf Hering 2016-11-28 18:28 ` Stefano Stabellini 2016-11-29 4:18 ` Wei Liu 2016-11-29 14:41 ` Olaf Hering 2016-10-21 12:37 ` [PATCH v3 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI Olaf Hering 2016-10-21 19:55 ` Stefano Stabellini
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).