driver: preserve device identity across PCI hotplug - #170
Open
amd-vserbu wants to merge 1 commit into
Open
Conversation
…r number Signed-off-by: Vlad-Gabriel Serbu <Vlad-Gabriel.Serbu@amd.com>
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.
Summary
This enables long-running Docker containers to keep using a V80 across SLASH remove/rescan and reset cycles when the device is passed through with
docker run --device.Docker records a device's major/minor number when the container is created. The previous
miscdeviceimplementation allocated a new dynamic minor whenever PF1 or PF2 was reprobed. After a PCI remove/rescan, the same/devpath could therefore return on the host with a different device number, while the container retained the old device node and device-cgroup permission. Restarting the container was the only way to pass the replacement device through.The driver now reserves one character-device range for the lifetime of
slash.koand assigns deterministic minors:slash_hotplug2*N+1:slash_ctl<N>2*N+2:slash_qdma_ctl<N>PF1 and PF2 are paired by their board BDF and retain the same
Nuntil the module is unloaded. Reprobed devices consequently return with the same/devpath anddev_t, so a device node already present in a container opens the new device instance without recreating the container.For example, a container can be started once with:
and continue using those paths after a host-side remove/rescan.
Other changes
/sys/class/miscto a dedicated/sys/class/slashclass.ENODEV; it never silently rebinds to the rescanned device.SLASH_QDMA_IOCTL_INFO, allowing userspace to verify CTL/QDMA pairing without depending on sysfs naming.slash_ctl<N>/slash_qdma_ctl<N>pairing.class_create()and the classdevnodecallback.