Repository navigation
VFIO (experimental): berthd shows a card passed through to a VM and stays off it during a switch - #129
Merged
Conversation
DriverFor takes the basename of the function's driver symlink under /sys/bus/pci/devices, empty when unbound or unreadable or off Linux. SysfsAddr turns nvidia-smi's bus id into the sysfs device name. FindVFIOCard names the one NVIDIA display function bound to vfio-pci, empty when none or several match. The sysfs root is a package variable so tests use a temp dir. BusID is now exported for the broker.
…vice during a switch While a granted lease in group vfio guards the switch, Tick does not run the probe at all: it reads the driver bound to the governed card's PCI function instead. Bound to vfio-pci the card is passthrough; with the hold granted and another or no driver there, it is detaching. A probe failure with no hold is read the same way when the card is bound to vfio-pci (a hand switch), and keeps today's warning otherwise. Neither state grants anything new; waiters hear where the card is in their queue place, and the hold itself stays HOT. card.passthrough and card.returned events mark each transition once, and the status carries passthrough with the state and driver, omitted when the card is normal. The card's sysfs address is remembered from the last successful snapshot, or found by scan when the probe fails and no reading ever came.
…n-first test proto.GroupVFIO replaces the broker's private constant; berth vfio run uses the same name. TestVFIOHoldDrainsTheHolderFirst covers the common case: an engine holds the card when the hold is asked for, drains, and the hold is granted.
This was referenced Oct 21, 2026
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.
First half of VFIO passthrough support (design: Berth coordinates and shows the card; the operator's own script switches drivers and runs the VM). The command,
berth vfio run, comes in the next PR.vfio-pci,berth statusshows "passed through to a VM (vfio-pci)" instead of memory figures, and the JSON has apassthroughobject.card.passthroughandcard.returnedevents fire once per change.proto.GroupVFIO, a pinned acquire at hold priority), berthd does not run its probe. Itsnvidia-smicall opens the card and can block the driver unbind, so it reads the driver from sysfs instead.nvidiawarns as before./sys, binds a driver or loads a module. Linux only. Elsewhere the reads return nothing and behavior is unchanged.Proof:
TestVFIOHoldDrainsTheHolderFirstcovers a hold asked for while an engine holds the card: it drains the engine and is granted.go test ./..., Windows build and vet, golangci-lint (0 issues).mkdocs build --strictpasses.