[openstack-dev] [nova][pci-passthrough] definitely specify VFIO driver as the host PCI driver for passthrough

Chen Fan fan.chen at easystack.cn
Fri Jun 24 10:23:32 UTC 2016

On 2016年06月24日 16:55, Daniel P. Berrange wrote:
> On Fri, Jun 24, 2016 at 04:52:31PM +0800, Chen Fan wrote:
>> On 2016年06月24日 16:20, Daniel P. Berrange wrote:
>>> On Fri, Jun 24, 2016 at 12:27:57PM +0800, Chen Fan wrote:
>>>> hi all,
>>>>        in openstack, we can use the pci passthrough feature now, refer to
>>>>        https://wiki.openstack.org/wiki/Pci_passthrough
>>>>        but we can't definitely specify the host pci driver is LEGACY_KVM or
>>>> newer VFIO,
>>>>        new VFIO driver is more safer, and higher-performance user-space driver
>>>>        than legacy kvm driver (pci-stub), the benefit relative to kvm
>>>> assignment driver
>>>>        could refer to http://lwn.net/Articles/474088/.
>>>>        In additional, VFIO driver provides the GPU passthrough as primary card
>>>> support.
>>>>        I think it is more useful for further GPU passthrough support in
>>>> openstack.
>>>>        Openstack relies on the libvirt nodedev device configuration to do pci
>>>> passthrough,
>>>>        with managed mode, the configured device is automatically detached and
>>>> re-attached
>>>>        with KVM or VFIO driver that depended on the host driver modules
>>>> configuration,
>>>>        so now we can't specify the driver in openstack to VFIO mode, I think
>>>> we should need
>>>>        to add this feature support in openstack to get pci passhthrough more
>>>> scalability.
>>>>        a simply idea is to add a option in nova.conf HOST_PCI_MODEL = VFIO
>>>> /KVM to specify
>>>>        the pci passthrough device driver is using VFIO driver.
>>>>        any comments are welcome. :)
>>> I don't see any reason to add a configuration option. If the host is
>>> capable of doing VFIO, libvirt will always aim to use VFIO in preference
>>> to the legacy system.
>> Hi Daniel,
>>      sorry, I directly reference the implementation of nodedev in libvirt, in
>> function
>> virHostdevPreparePCIDevices :
>>   257         if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO)
>>   258             virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO);
>>   259         else if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN)
>>   260             virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN);
>>   261         else
>>   262             virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM);
>> IIUC, the stub driver should be "legacy KVM", do we need to change the stub
>> drvier
>> to VIR_PCI_STUB_DRIVER_VFIO by default.
> If libvirt uses VFIO, then it'll use the VFIO stub driver, which is fine.
Thanks for you kind explanation, I have reread //the code about the
implementation of pci driver backend in libvirt, you are right, by default
the backend driver is VFIO.


> Regards,
> Daniel

Chen Fan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160624/a3667ab5/attachment.html>

More information about the OpenStack-dev mailing list