fix: NVIDIA X.Org driver modules mount fixes - #1980
Conversation
|
@cdesiniotis For after v1.20.0. |
|
/ok to test 27972c1 |
|
This LGTM now. @cdesiniotis can you also ptal? |
|
@ehfd thanks for your contribution. I am not too keen on introducing a CDI hook for this. Wouldn't the host's Xorg conf file (i.e. You mention a use case where the |
|
@cdesiniotis I understand your perspective. I will find a solution which works for all parties. |
|
I've reworked the PR around your suggestion. The I validated this on a 2x Tesla P100 host (driver 580.178.04, Ubuntu 26.04, Docker 29.7.2) with a stock
What's left in the PR:
|
Signed-off-by: Seungmin Kim <8457324+ehfd@users.noreply.github.com>
|
/ok to test d8b95c8 |
Coverage Report for CI Build 32267242093Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.1%) to 44.087%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
Additional considerations across all three PRs: NVIDIA/libnvidia-container#388 (comment) |
|
@cdesiniotis Can you review this too? |
cdesiniotis
left a comment
There was a problem hiding this comment.
LGTM. @ehfd thanks for your contribution and patience during reviews.
|
/cherry-pick release-1.20 |
|
🤖 Backport PR created for |
|
@cdesiniotis @henry118 Thank you for your time investment for the community! |
Reviewers: @elezar @cdesiniotis @henry118
Fixes #1477
Fixes #563
Summary
Graphics config files for the NVIDIA driver were mounted into the container at their host paths, so on hosts that do not install them under
/usr/share(or/etcfor the OpenCL ICD) they land where the loaders in the container never look. This mounts them at the canonical container locations, mirroring the existing Vulkan ICD handling, and injects the EGL X11 platform libraries andnvidia-xconfig.The
create-xorg-configCDI hook from the previous revision of this PR is gone. Per @cdesiniotis' review, the host'sxorg.conf.dsnippet is what carries theModulePathwhen the driver installs the X.Org modules outside the default X.Org module path; mounting that snippet where the container's X server reads it is sufficient, and a host without one is treated as a host-side misconfiguration.Why This Exists
EGL vendor, EGL external platform and GLVND config files were mounted at their host paths. On hosts with non-FHS layouts these land where container glvnd never looks, forcing workarounds such as
__EGL_VENDOR_LIBRARY_FILENAMES. The same applies to thexorg.conf.dsnippet that makes the injected X.Org modules loadable, and to the OpenCL ICD.The EGL X11 platform libraries (
libnvidia-egl-xcb,libnvidia-egl-xlib) and their external platform config files were not discovered at all, even though the GBM and Wayland platform libraries next to them are.Resolution
/usr/share/...and the OpenCL ICD at/etc/OpenCL/vendors, mirroring the existing Vulkan ICD handling.ModulePathin the mounted snippet stays valid in the container, and modules installed to the default X.Org module path on the host are found at the same path in the container.libnvidia-egl-xcb.so.*.*,libnvidia-egl-xlib.so.*.*and their external platform JSON files are discovered and injected.nvidia-xconfigis injected when present on the host.graphics.goare wrapped inWithCache(per @henry118's earlier review); the X.Org modules were previously discovered twice becausegraphicsDriverLibrariesreadsMounts()from bothMounts()andHooks().Behavior Changes
graphicsordisplayreceive the config files at canonical paths, the EGL X11 platform libraries and their config files, andnvidia-xconfigwhere installed.mainonly by those mounts.Implementation Summary
newGraphicsConfigsDiscoverer, usingmountsToContainerPathfor/usr/shareand/etc.nvidia-xconfigto a binaries discoverer.TestGraphicsConfigsDiscoverer, covering both standard and non-standard host locations.Verification
go test ./...failing set is identical to the unmodifiedmainbaseline on the validation host (all failures are pre-existing environment failures innvidia-ctk-installer,internal/modifierCSV mode andpkg/nvcdi);golangci-lint run ./...reports 0 issues;gofmtis clean.Real-host validation on 2x Tesla P100, driver 580.178.04, Ubuntu 26.04, Docker 29.7.2, container
ubuntu:24.04with onlyxserver-xorg-coreandmesa-utilsinstalled:Host with modules in the default X.Org module path (
/usr/lib/xorg/modules/{drivers,extensions}, Ubuntu packaging, snippet without aModulePath): X.Org loadsnvidia_drv.soandlibglxserver_nvidia.sofrom/usr/lib/xorg/modules/...,glxinfo -BreportsTesla P100-SXM2-16GB/PCIe/SSE2. Unchanged frommain.Host with modules outside the default X.Org module path (
/usr/lib/x86_64-linux-gnu/nvidia/xorg, with the host10-nvidia.confcarrying the matchingModulePath): the mounted snippet is what makes it work.glxinfo -Band the EGL X11 platform both reportTesla P100-SXM2-16GB/PCIe/SSE2.Note:
MatchDriver "nvidia-drm"only matches when the DRM device nodes are present in the container, so this path requiresnvidia-drmloaded on the host and thedisplay/graphicscapability. Withnvidia_drmunloaded the OutputClass never matches and noModulePathis applied.nvidia-xconfigin the container generates a working BusIDxorg.conf;libEGL_nvidiadlopens the injectedlibnvidia-egl-xcb.so.1/libnvidia-egl-xlib.so.1when their config files are present (verified withLD_DEBUG=libs). On 580 the built-in X11 platform still servicesEGL_PLATFORM_X11, so injecting them is about keeping the container's EGL platform set matching the host's rather than fixing an observed failure today.Legacy-mode parity (
mode = "legacy"):graphicsreceives the same set as CDI mode;compute,utilityreceives none of it, unchanged frommain.