Message ID | 20160902094354.25935-2-olaf@aepfle.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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.
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
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)); } }
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(+)