]> git.proxmox.com Git - qemu.git/commit
vfio-pci: Update slow path INTx algorithm
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 8 Oct 2012 14:45:29 +0000 (08:45 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 8 Oct 2012 14:45:29 +0000 (08:45 -0600)
commitea486926b07d2ebd73ef67315ebb1eecf39faf5a
treed53dd8ff2394bd2ec0cc6ba84e06e517caad9ef4
parent4bb26682f70a5f626cad3e0ac82bf4b6252ea7a4
vfio-pci: Update slow path INTx algorithm

We can't afford the overhead of switching out and back into mmap mode
around each interrupt, but we can do it lazily via a timer.  On INTx
interrupt, disable the mmap'd memory regions and set a timer.  On
every interrupt, push the timer out.  If the timer expires and the
interrupt is no longer pending, switch back to mmap mode.

This has the benefit that things like graphics cards, which rarely or
never, fire an interrupt don't need manual user intervention to add
the x-intx=off parameter.  They'll just remain in mmap mode until they
trigger an interrupt, and if they don't continue to regularly fire
interrupts, they'll switch back.

The default timeout is tuned for network cards so that a ping is just
enough to keep them in non-mmap mode, where they have much better
latency.  It is tunable with an experimental option,
x-intx-mmap-timeout-ms.  A value of 0 keeps the device in non-mmap
mode after the first interrupt.

It's possible we could look at the class code of devices and come up
with reasonable per-class defaults based on expected interrupt
frequency and latency.  None of this is used for MSI interrupts and
also won't be used if we can bypass through KVM.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
hw/vfio_pci.c
hw/vfio_pci_int.h