fix: Provision /dev/nvidia-modeset in both display and graphics - #388
Open
ehfd wants to merge 1 commit into
Open
fix: Provision /dev/nvidia-modeset in both display and graphics#388ehfd wants to merge 1 commit into
/dev/nvidia-modeset in both display and graphics#388ehfd wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns nvidia-container-cli’s device injection behavior with the NVIDIA Container Toolkit’s OCI-level semantics by ensuring /dev/nvidia-modeset is mounted for containers that request either the display or graphics capability (previously only display).
Changes:
- Extend the modeset-device gating check in
nvc_driver_mount()to allow provisioning whenOPT_GRAPHICS_LIBSis set, not onlyOPT_DISPLAY. - Update the in-code comment to reflect the expanded gating condition.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
capabilities Signed-off-by: Seungmin Kim <[email protected]>
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.
Reviewers: @elezar @myeolenv
Associated with NVIDIA/nvidia-container-toolkit#1979.
Summary
The modeset device was only mounted into containers that requested the display capability; the graphics capability also requires it. The device mount is now gated on either capability.
Why This Exists
/dev/nvidia-modesetbacks the display-facing paths of the graphics APIs themselves — Vulkan direct-to-display, the EGLDevice/EGLOutput platform, and the presentation machinery used by Wayland compositor stacks — not only the X.Org driver. Inoptions.h,displayalready impliesOPT_GRAPHICS_LIBS, andOPT_DISPLAYgates exactly one thing: this device mount. A container requesting onlygraphicstherefore received the complete graphics library set but not the device node those APIs need.The NVIDIA Container Toolkit treats
graphicsanddisplayas a single gate for its graphics injection at the OCI level, and CDI mode injects the device unconditionally. This aligns thenvidia-container-clipath — used bydocker --gpuswithout the nvidia runtime — with that behavior.Resolution
The modeset device mount condition in
nvc_mount.cchecksOPT_DISPLAY|OPT_GRAPHICS_LIBSinstead ofOPT_DISPLAYalone, with the comment updated accordingly.Reviewer Considerations
graphicsanddisplayare functionally identical in this library sinceOPT_DISPLAYgates nothing else. This is intentional and matches the toolkit's OCI-level behavior and CDI semantics.load_kernel_modules()already loadsnvidia_modesetand creates the device node under--load-kmods, so no creation-side change is needed.!dxcore.initializedbranch.Behavior Changes
graphicswithoutdisplayreceive the modeset device mount and its device cgroup entry.compute,utility, andvideoremain unchanged;displaybehavior is unchanged.Implementation Summary
nvc_mount.c.Verification
sharedandtoolson Ubuntu x86_64 with GCC 14 (WITH_LIBELF=yes WITH_TIRPC=yes, version and revision provided for a tag-less tree).docker run --runtime=runc --gpus allexercises the hook path and the host node deleted before each run:NVIDIA_DRIVER_CAPABILITIES=graphics: no modeset device in the container;graphics:/dev/nvidia-modesetpresent and openable, with the host node created by--load-kmods;compute,utility: no modeset device;display: unchanged.