Support vendor VFIO vGPU devices - #321
Draft
yummybomb wants to merge 3 commits into
Draft
Conversation
yummybomb
force-pushed
the
hypeship/vendor-vfio-vgpu
branch
from
July 28, 2026 21:32
199b1d1 to
a93d009
Compare
yummybomb
force-pushed
the
hypeship/vendor-vfio-vgpu
branch
4 times, most recently
from
July 29, 2026 15:15
d893fce to
de4742a
Compare
yummybomb
force-pushed
the
hypeship/vendor-vfio-vgpu
branch
from
July 29, 2026 16:09
de4742a to
18e047f
Compare
The reconcile in-use check only matched iommufd cdev paths (/dev/vfio/devices/*), but QEMU holds the legacy /dev/vfio/<group> node unless iommufd is configured, so a hypeman restart under a live vGPU VM relied on the driver rejecting the release of an active VF. Resolve the VF's iommu group and match the legacy node as well.
The driver prints an "ID : vGPU Name" table, so the previous name-then-ID parse rejected every line and no profiles were enumerated. A GPU with no framebuffer left prints only the header, which now yields zero profiles instead of an error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
background
The NVIDIA driver exposes vGPUs through the mdev framework only on host kernels < 6.8. On kernels >= 6.8 the same driver builds NVIDIA's vendor-specific VFIO framework instead, where each SR-IOV VF is assigned a profile directly through its
nvidia/sysfs attributes and the VF itself is passed to the VM (no mdev UUIDs). Supporting this framework is the prerequisite for moving GPU hosts to newer host OS/kernel versions. Hosts migrate one at a time, so both frameworks must coexist: hypeman detects the host's framework at runtime and the mdev path stays intact.Note that
/sys/class/mdev_bus/itself may still be present on a vendor VFIO host, becausenvidia_vgpu_vfiopulls in themdevmodule. It just never gains parent entries, so detection keys off discovered mdev VFs rather than the directory existing.summary
creatable_vgpu_typescurrent_vgpu_typewith least-loaded-GPU placement/dev/vfio/devices/*) and the legacy/dev/vfio/<group>node QEMU holds when iommufd is not configuredStacked on #322, which contains the framework-neutral lifecycle refactor.
creatable_vgpu_typesformatThe driver emits a table with a header row and the type ID first:
Parsing splits on the
:separator and skips the header row. An earlier revision expected the name first and the type ID last, which failed on every line (parse vGPU type ID "Name"), and becausegetVGPUStatusdiscards profile errors the host advertised vGPU mode with all its slots and no profiles at all — no placement could succeed.Once a profile consumes a GPU's entire framebuffer, the remaining VFs on that GPU print the header and nothing else. That is a legitimately empty list rather than a malformed file, so it yields zero profiles instead of an error; otherwise one 48Q allocation would remove the whole GPU from the status response.
host validation
Validated on an L40S host running vGPU Manager 580.159.01 on Ubuntu 24.04 / kernel 6.8.0-136, where the driver reports
Host VGPU Mode: SR-IOVand/sys/class/mdev_bus/has no parents:NVIDIA L40S-48Qon one GPU, and returns to 64 after release. Assigning a smaller profile instead clamps that GPU's remaining VFs to the same framebuffer size class (2B/2Q/2Aafter a2Q), matching how the mdev driver reportsavailable_instancesAvailability counts free VFs that can currently accept a profile, not how many of that profile fit — the driver enforces the framebuffer limit at assignment time. That is the pre-existing mdev behavior and this PR keeps it; tightening the count is separate work.
current_vgpu_typeand booting QEMU with-device vfio-pci,sysfsdev=<VF>produces a liveNVIDIA L40S-1Qinnvidia-smi vgpu, released by writing0/dev/vfio/<group>node, not an iommufd cdev, even with/dev/iommupresent — so the legacy group fd check is the one that keeps assignments alive on this hostNVIDIA L40S-2Q; guest GRID loaded, CDP and kernel-images-api started, hardware OpenGL reported the L40S through ANGLE, and NVENC completed an encodecurrent_vgpu_typetests
go test -race ./lib/devices ./lib/instances -run 'VendorVFIO|CreatableVGPU|StoredVGPU|StandbyRejectsVendorVFIO' -count=1go test ./lib/devices ./lib/hypervisor/qemu ./lib/resources -count=1go test ./cmd/api ./cmd/api/api ./lib/instances ./integration -run '^$' -count=1go vet ./cmd/api ./lib/devices ./lib/hypervisor/qemu ./lib/instances ./lib/resources