<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="moz-cite-prefix">On 2016年06月24日 16:55, Daniel P.
      Berrange wrote:<br>
    </div>
    <blockquote cite="mid:20160624085533.GI25240@redhat.com" type="cite">
      <pre wrap="">On Fri, Jun 24, 2016 at 04:52:31PM +0800, Chen Fan wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">

On 2016年06月24日 16:20, Daniel P. Berrange wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">On Fri, Jun 24, 2016 at 12:27:57PM +0800, Chen Fan wrote:
</pre>
          <blockquote type="cite">
            <pre wrap="">hi all,
      in openstack, we can use the pci passthrough feature now, refer to
      <a class="moz-txt-link-freetext" href="https://wiki.openstack.org/wiki/Pci_passthrough">https://wiki.openstack.org/wiki/Pci_passthrough</a>
      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 <a class="moz-txt-link-freetext" href="http://lwn.net/Articles/474088/">http://lwn.net/Articles/474088/</a>.
      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. :)
</pre>
          </blockquote>
          <pre wrap="">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.
</pre>
        </blockquote>
        <pre wrap="">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.
</pre>
      </blockquote>
      <pre wrap="">
If libvirt uses VFIO, then it'll use the VFIO stub driver, which is fine.</pre>
    </blockquote>
    Thanks for you kind explanation, I have reread <em></em>the code
    about the<br>
    implementation of pci driver backend in libvirt, you are right, by
    default<br>
    the backend driver is VFIO.<br>
    <br>
    Thanks,<br>
    Chen<br>
    <br>
    <br>
    <br>
    <blockquote cite="mid:20160624085533.GI25240@redhat.com" type="cite">
      <pre wrap="">

Regards,
Daniel
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Sincerely,
Chen Fan</pre>
  </body>
</html>