Skip to content

Allocate: expose only the requested device's address per resource#191

Open
omniverse-devplat-leo wants to merge 1 commit into
NVIDIA:masterfrom
omniverse-devplat-leo:fix/allocate-display-class-only
Open

Allocate: expose only the requested device's address per resource#191
omniverse-devplat-leo wants to merge 1 commit into
NVIDIA:masterfrom
omniverse-devplat-leo:fix/allocate-display-class-only

Conversation

@omniverse-devplat-leo

Copy link
Copy Markdown

Problem

Allocate adds every function of a device's IOMMU group to the requested
resource's PCI_RESOURCE_* env. KubeVirt consumes those addresses
positionally, mapping them to the gpus: / hostDevices: slots in request
order. For a multi-function device this hands a sibling function (e.g. a
GPU's audio function) an address slot of its own — so when a VM requests two
of the same resource, the first device's sibling fills the second slot and
the guest sees only one device instead of two.

Fix

Expose only the requested device's address in its resource env. The full
IOMMU group is still bound via the vfio DeviceSpecs, and each function is
already advertised as its own resource, so a workload that needs a sibling
function requests it explicitly via hostDevices:. The change is symmetric
across resources and keeps non-display functions available.

Adds a unit test covering a multi-function IOMMU group.

Validation

Validated on a 2-GPU passthrough VM (KubeVirt v1.5.x): before the change the
guest saw a single GPU; after it sees both. Single-GPU and audio-passthrough
cases are unaffected; go test ./pkg/device_plugin/ passes.

@copy-pr-bot

copy-pr-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Allocate appended every function of a device's IOMMU group to the requested
resource's PCI_RESOURCE_* env. KubeVirt assigns those addresses positionally
to the consuming slots, so for a multi-function device a sibling function can
occupy a slot meant for another requested device: when two of the same
resource are requested, the first device's sibling fills the second slot and
the guest sees only one device.

Expose only the requested device's address. The full IOMMU group is still
bound via the vfio DeviceSpecs, and each function is advertised as its own
resource, so a workload that needs a sibling function requests it directly.
This is symmetric across resources and keeps non-display functions usable.

Adds a unit test covering a multi-function IOMMU group.

Signed-off-by: Leo Hsieh <lhsieh@nvidia.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@omniverse-devplat-leo omniverse-devplat-leo force-pushed the fix/allocate-display-class-only branch from b39db73 to 9d51c5c Compare June 29, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant