Minutes 2026-10-01

From MTU LUG Wiki
Jump to navigation Jump to search

Virtual Function I/O

Presented by Simone

Virtualization Primer

  • Hypervisors let you run multiple OSes on one machine
    • KVM and QEMU on Linux
    • Xen, VMWare, HyperV on other platforms
  • Virtual Machines
    • Guest operating system
    • Almost native performance because CPU instructions are run directly
    • Other hardware is emulated
  • VMs don’t have direct hardware access, which is a problem
    • QEMU must emulate GPU, network, etc
    • Paravirtualization helps with some of these
      • Instead of emulating, a guest driver passes some things through
      • Usually needs guest OS support
      • Still plenty of limites
    • Dual booting is annoying

What is VFIO?

  • Gives a VM control over PCIE devices
  • Uses IOMMU (most devices in the past 10 years have this)
  • Remaps memory addresses and isolates devices
    • Prevents device as PCIe directly to guest
    • Low overhead
    • Little host interference ### Capabilities Generally allows faster access and removes overhead and quirks from the host OS and passthrough
  • GPU Access
  • Storage/NVMe
  • Network devices (good for high throughput, bypasses host network stack)
  • USB and audio

Full Passthrough

  • Assigns an entire PCIe device to a guest
    • Binds the device to vfio-pci on host side
    • Unbinds from normal host driver
  • Host can’t use device anymore
  • Works for almost every device

SR-IOV

  • Single-root I/O Virtualization
  • Shares PCIe deives between multiple guests
  • Host retains device access
  • More efficient sharing of resources
  • Used heavily in cloud computing
  • Virtual Function:
    • Single PCIe devices splits into multiple VFs
    • Can be assigned to guest
  • Only some hardware is capable
    • Mostly enterprise grade devices

Demo

  • Can write to a device file to add VFs
  • Adds more PCI devices in lspci output
  • Intel GPU drivers are NOT READY for this, was not able to load a driver despite seeing the VF

Use Cases

  • Can run Windows games in a VM with good performance
  • Virtual workstations
  • Development/security
    • Driver testing
    • Malware analysis
  • Provisioning GPU resources to customer VMs on a server (cloud computing)