Xen HVM unplug changes
v3 cover Xen HVM unplug changes
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
[email protected]
https://lists.xen.org/xen-devel
PATCH v3 1/2 xen_platform: unplug also SCSI disks
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
--- hw/i386/xen/xen_platform.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/i386/xen/xen_platform.c +4 -0
@@ -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
[email protected]
https://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v3 1/2] xen_platform: unplug also SCSI disks
Quoted 41 lines · 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 sdavdev=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 sdavdev=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
Quoted 1 line
Signed-off-by Olaf Hering <[email protected]>
Quoted 9 lines
hw/i386/xen/xen_platform.c | 4 ++++ 1 file changed, 4 insertions(+)hw/i386/xen/xen_platform.c +0
-0
hw/i386/xen/xen_platform.c static void unplug_disks(PCIBus *b, PCIDevice *d, void *o) · line 123
Quoted 10 lines
hw/i386/xen/xen_platform.c +4
-0@@ -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
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks
In reply to Olaf HeringQuoted 5 lines · 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.
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
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks
Quoted 8 lines · Olaf Hering
Quoted 5 lines · 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.
Quoted 6 lines
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 78f6689xen_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
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks
Quoted 13 lines · Stefano Stabellini
Quoted 12 lines · Olaf Hering
Quoted 5 lines · 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.
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:
Quoted 6 lines
Quoted 2 lines
3513201
xen_platform: SUSE xenlinux unplug for emulated PCI 78f6689xen_platform: unplug also SCSI disksAnthony, 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
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 1/2] xen_platform: unplug also SCSI disks
Quoted 6 lines · Wei Liu
Quoted 3 lines · Stefano Stabellini
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
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v3 2/2 xen_platform: SUSE xenlinux unplug for emulated PCI
In reply to Olaf HeringImplement 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.
--- hw/i386/xen/xen_platform.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
hw/i386/xen/xen_platform.c +26 -1
@@ -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
[email protected]
https://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v3 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI
Quoted 8 lines · 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.
In addition old (pre-2011) VMDP versions are handled as well.Signed-off-by Olaf Hering <[email protected]>
Quoted 38 lines
hw/i386/xen/xen_platform.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)hw/i386/xen/xen_platform.c +19
-1@@ -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 ;
hw/i386/xen/xen_platform.c static void xen_platform_ioport_writeb(void *opaque, hwaddr addr, · line 348
Quoted 10 lines
hw/i386/xen/xen_platform.c +7
-0+case 2 : +pci_unplug_nics (pci_dev->bus); +break ; +default : +log_writeb (s, (uint32_t )val); +break ; + }break ;default :break ;
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel