hardware: NVIDIA probe never runs when the nvidia modules are unloaded at startup #69

Open
opened 2026-09-22 11:40:22 +02:00 by julian · 0 comments
Owner

Raised in the review of #62. That PR fixes the probe dying after an outage that starts after a successful detection; this is the other half.

startGpuCollectors gates the nvidia-smi probe on a one-time DRM snapshot (gpu.ts, detectGpus is called exactly once):

const wantNvidia = nvidia.due() &&
  (cards.length === 0 || cards.some((c) => c.info.vendor === "nvidia"));

detectGpus reads /sys/class/drm/card*, where an NVIDIA node exists only while nvidia-drm is bound. If the process starts while the NVIDIA modules are unloaded and the host has any other DRM card (on a server board typically the ASPEED BMC, 0x1a03, bound by ast), cards.length !== 0 and nothing in cards is nvidia. wantNvidia stays false for the lifetime of the process: nvidia-smi is never invoked, the backoff never ticks, and the GPU metrics never appear. A restart does not fix it unless the module happens to be back first.

This is reachable on epyclab: the driver upgrade script stops the opsdeck container for the duration, so whether GPU metrics exist afterwards depends on whether the module is loaded before the container comes back. The same hole applies to a compute-only host that never loads nvidia-drm.

Options, both of which change behaviour on non-NVIDIA hosts and so want a decision rather than a drive-by:

  • driver-independent presence check: /sys/bus/pci/devices/*/vendor == 0x10de with PCI class 0x0300/0x0302, so a card counts as NVIDIA whether or not nvidia-drm is bound
  • periodic re-detect: re-run detectGpus on the backoff's retry schedule so a card that appears later is picked up

With #62's backoff in place, cheap perpetual probing is affordable, which removes the reason the one-time DRM gate existed in the first place.

Raised in the review of #62. That PR fixes the probe dying after an outage that starts *after* a successful detection; this is the other half. `startGpuCollectors` gates the nvidia-smi probe on a one-time DRM snapshot (`gpu.ts`, `detectGpus` is called exactly once): ```ts const wantNvidia = nvidia.due() && (cards.length === 0 || cards.some((c) => c.info.vendor === "nvidia")); ``` `detectGpus` reads `/sys/class/drm/card*`, where an NVIDIA node exists only while `nvidia-drm` is bound. If the process starts while the NVIDIA modules are unloaded **and** the host has any other DRM card (on a server board typically the ASPEED BMC, `0x1a03`, bound by `ast`), `cards.length !== 0` and nothing in `cards` is `nvidia`. `wantNvidia` stays false for the lifetime of the process: nvidia-smi is never invoked, the backoff never ticks, and the GPU metrics never appear. A restart does not fix it unless the module happens to be back first. This is reachable on epyclab: the driver upgrade script stops the opsdeck container for the duration, so whether GPU metrics exist afterwards depends on whether the module is loaded before the container comes back. The same hole applies to a compute-only host that never loads `nvidia-drm`. Options, both of which change behaviour on non-NVIDIA hosts and so want a decision rather than a drive-by: - driver-independent presence check: `/sys/bus/pci/devices/*/vendor == 0x10de` with PCI class `0x0300`/`0x0302`, so a card counts as NVIDIA whether or not `nvidia-drm` is bound - periodic re-detect: re-run `detectGpus` on the backoff's retry schedule so a card that appears later is picked up With #62's backoff in place, cheap perpetual probing is affordable, which removes the reason the one-time DRM gate existed in the first place.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
OpsDeck/core#69
No description provided.