runc: CDI GPU passthrough setup (SetupDevices flow + hook scrub + LibLink recreation) - #121
Open
m-amin-sanati wants to merge 3 commits into
Open
runc: CDI GPU passthrough setup (SetupDevices flow + hook scrub + LibLink recreation)#121m-amin-sanati wants to merge 3 commits into
m-amin-sanati wants to merge 3 commits into
Conversation
Adds the sysbox-runc side of the deviceSetup gRPC flow ported from rodny-gpu, adapted to the v0.7.1 baseline (time-ns/openat2/userns preserved): - libsysbox/sysbox/mgr.go: Mgr.SetupDevices() client that asks sysbox-mgr to prepare/resolve the container's devices via the SetupDevices RPC. - libsysbox/syscont/spec.go: cfgDevices() called in ConvertSpec before cfgMounts, which invokes sysMgrSetupDevices() to reconcile device paths with the host (resolving /dev/nvidia*, MIG caps, default /dev/net/tun) and to pass the right --user uid/gid to an nvidia-container-runtime-hook when present. Signed-off-by: Amin San'ati <amin.sanati32@gmail.com>
The cfgDevices function (SetupDevices flow for DRA/CDI GPU passthrough) was added but never invoked from ConvertSpec, leaving the device path-resolution/dead-code and the nvidia-container-runtime-hook --user re-write unreachable. Call it before cfgMounts, matching rodny-gpu. Fixes container init 'creating device nodes caused: no such file or directory' for CDI-injected devices on the MIG/DRA workspace. Signed-off-by: Amin San'ati <amin.sanati32@gmail.com>
…cdi-hook The nvidia-cdi-hook (create-symlinks) cannot run inside sysbox's user-mapped container namespace lesh; scrub it in cfgDevices. Before scrubbing, capture its --link src::dst pairs into Sysbox.LibLinks so that createDevices can recreate the soname symlinks (libnvidia-ml.so.1 -> libnvidia-ml.so.X) inside the container rootfs during setup. Signed-off-by: Amin San'ati <amin.sanati32@gmail.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.
Adds the sysbox-runc side of the MIG/DRA/CDI GPU passthrough feature.
Changes:
SetupDevicesflow:Mgr.SetupDevices()client inlibsysbox/sysbox/mgr.goasks sysbox-mgr to prepare the container's devices via the SetupDevices RPC.cfgDevices()inlibsysbox/syscont/spec.go, invoked fromConvertSpecbeforecfgMounts, reconciles device paths against the host (resolving/dev/nvidia*, MIG caps,/dev/net/tun) and passes the correct--useruid/gid to annvidia-container-runtime-hookwhen present.cfgDevices()never being called fromConvertSpec(it was previously dead code), which causedcreating device nodes caused: no such file or directoryfor CDI-injected devices.nvidia-cdi-hookfrom the OCI spec after device setup (it cannot run inside sysbox's user-mapped namespace).--link src::dstpairs intoSysbox.LibLinkssocreateDevicesrecreates the soname symlinks (e.g.libnvidia-ml.so.1 -> libnvidia-ml.so.X) inside the container rootfs during setup.Closes #120
This is part of a 3-repo feature: