← Thu, Sep 24 digest

Virtio-nvgpu: Near-native Nvidia GPU access inside a KVM guest

read article ↗ hn thread ↗

Virtio-nvgpu enables multiple KVM microVMs to share a single NVIDIA GPU at near-native speed using unmodified drivers without paid vGPU licenses.

read it Systems engineers looking to share consumer NVIDIA GPUs across multiple Linux VMs without enterprise licensing will find the architecture compelling.

summary

Virtio-nvgpu allows multiple KVM microVMs to share a single consumer NVIDIA GPU at near-native performance while running unmodified drivers. Unlike slow API-forwarding methods or exclusive VFIO passthrough, it forwards guest driver ioctls directly to the host kernel driver. This enables multiple VMs to perform tasks like video encoding or gaming simultaneously on a single card. However, it trades away hardware isolation, treating the host NVIDIA driver as the trust boundary.

key points

  1. Forwards NVIDIA driver ioctls instead of graphics APIs, achieving performance within two percent of bare metal on an RTX 3060.
  2. Avoids the need for expensive NVIDIA vGPU licenses or exclusive VFIO passthrough, allowing multiple Linux microVMs to share a single card.
  3. Operates with a weaker security model similar to Docker containers, relying on the host NVIDIA driver as the trust boundary.

who should read it

Infrastructure engineers and developers running headless GPU workloads in microVMs on Linux hosts.

discussion positive

consensus

Engineers praise the utility of achieving multi-VM GPU sharing on consumer cards without vGPU licensing, but heavily scrutinize the weak isolation compared to traditional VFIO passthrough.

pushback

Skeptics question how safely NVIDIA drivers can be shared across multiple guests without official virtualization support or robust security sandboxing.

best comment by refibrillator ↗

There are roughly 3 ways to give a KVM guest a GPU.

1) VFIO passthrough: host binds entire GPU to guest as PCI device, which only allows one VM to use the GPU, thus you sacrifice your host display too (unless you fallback to integrated graphics on cpu etc). Strongest isolation because host kernel module driver not involved.

2) virtio-gpu: guest sees paravirtual GPU and loads virgl/venus mesa driver which serializes graphics API calls and replays them on the host driver. This allows multiple VMs to use the GPU, but performance overhead can be significant, and guests can’t practically …

It provides a clear architectural breakdown comparing VFIO passthrough, virtio-gpu, and virtio-nvgpu in terms of performance and security.

Generated by an LLM from the article and thread. Check the sources before relying on it.