git: virtio: Fix and activate PCI MSI-X support.

Imre Vadasz ivadasz at crater.dragonflybsd.org
Sat Feb 11 04:00:40 PST 2017


commit c8247d066210114260c306e56365cd1346df7855
Author: Imre Vadász <imre at vdsz.com>
Date:   Wed Feb 8 22:05:35 2017 +0100

    virtio: Fix and activate PCI MSI-X support.
    
    * Change pci_msi_blacklisted() test to always assume working MSI and MSI-X
      interrupts on virtual-machines. We should assume that a hypervisor
      without MSI or MSI-X support shouldn't even indicate supported MSI(-X)
      via the PCI config space.
    
    * Move vtblk_alloc_disk() to the end of virtio_blk's attach method.
      This avoids a race between irq enabling in virtio, and the disk probing.
    
    * Fix allocation and teardown of MSI-X interrupts.
    
    * Get rid of rather confusing VIRTIO_PCI_FLAG_NO_MSI and
      VIRTIO_PCI_FLAG_NO_MSIX flags. The VIRTIO_PCI_FLAG_NO_MSI is unneeded
      when using pci_alloc_1intr() for MSI allocation, and
      instead of VIRTIO_PCI_FLAG_NO_MSIX we can just check sc->vtpci_msix_res.
    
    * For now, MSI-X vectors are simply assigned to subsequent cores (plus
      adding the device_get_unit() value to shuffle things a bit), i.e.:
      (device_get_unit(dev) + cnt) % ncpus
    
    * For the if_vtnet network driver this means that the rx and tx queues run
      on different cores, but both queues still use the same serializer for
      now.
    
    * One major advantages in using MSI-X interrupts instead of the legacy
      IRQ is, that this avoids interrupt sharing in many virtual-machine
      configurations.
    
    * Tested on qemu with TCG (unaccelerated emulation) and 1 core, and with
      KVM acceleration and 2 cores, with both virtio network and disk devices.

Summary of changes:
 share/man/man4/virtio.4                   |  10 ++
 sys/bus/pci/pci.c                         |   8 ++
 sys/dev/virtual/virtio/block/virtio_blk.c |   4 +-
 sys/dev/virtual/virtio/pci/virtio_pci.c   | 206 ++++++++++++------------------
 4 files changed, 105 insertions(+), 123 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/c8247d066210114260c306e56365cd1346df7855


-- 
DragonFly BSD source repository



More information about the Commits mailing list