Repository navigation
Description
Problem statement
The DRA Driver for NVIDIA GPUs classifies an XID from the event's GPU instance ID / compute instance ID and from NVML_FI_DEV_GET_GPU_RECOVERY_ACTION (field ID 230). CPU-only e2e has to get both of those from mock NVML.
The pinned mock's failure-injector path used to set both instance IDs to 0, which names MIG GI 0 / CI 0 instead of the whole GPU, and GetFieldValue does not answer field 230. The driver currently string-patches a local checkout to fill those gaps (hack/ci/mock-nvml/healthcontrol/patch_mock.py in kubernetes-sigs/dra-driver-nvidia-gpu#1509). That patch breaks on the next pin bump.
Requested in kubernetes-sigs/dra-driver-nvidia-gpu#1509 (comment):
Longer term, could you open an issue or PR in NVIDIA/k8s-test-infra for GI/CI on XID events and the recovery-action field (230)? Then this patch can go away and this PR only needs to bump the pin and add the tests.
Upstream HEAD already assigns C.uint(nvmlNoMIGInstanceID) on the failure-injector path in pkg/gpu/mocknvml/bridge/events.go. What is still missing is a way for a test to choose GI/CI, and a way to read field 230.
Proposed solution
Add the following to pkg/gpu/mocknvml. A working copy of the control-file parser and the two hooks is in that driver PR:
hack/ci/mock-nvml/healthcontrol/control.gohack/ci/mock-nvml/healthcontrol/overlay/engine_hooks.go
-
Keep the failure-injector assignment as the full-GPU sentinel (
nvmlNoMIGInstanceID,0xFFFFFFFF). Do not report0. -
In
pollPendingXid, beforependingXidClaim(), claim an optional health-control event and fillnvmlEventData_tfrom it:
if handle, xid, gi, ci, ok := engine.GetEngine().ClaimHealthControlEvent(); ok {
data.device.handle = (*C.struct_nvmlDevice_st)(handle)
data.eventType = C.NVML_EVENT_TYPE_XID_CRITICAL_ERROR
data.eventData = C.ulonglong(xid)
data.gpuInstanceId = C.uint(gi)
data.computeInstanceId = C.uint(ci)
return true
}The event source is a JSON file. MOCK_NVML_HEALTH_CONTROL selects the path; the default is /driver-root/health-control.json. Re-read it on every claim. Deliver each event id once. Omitted GI/CI means 0xFFFFFFFF.
{
"events": [
{"id": "mig-scoped", "gpu": 0, "xid": 45, "gpuInstanceId": 3, "computeInstanceId": 1}
],
"recoveryActions": [
{"gpu": 0, "action": "GPU_RECOVERY_ACTION_NONE"}
]
}- In
ConfigurableDevice.GetFieldValue, handle field 230 before the existinggetDeviceFieldValuedispatch. Return the action for that GPU index asFieldValueUint. A GPU the file does not mention returnsGPU_RECOVERY_ACTION_NONE(0).nvmlDeviceGetFieldValuesis already exported frombridge/fieldvalues.go, so this belongs in the engine dispatch and should not be a second bridge export.
const healthGPURecoveryActionField uint32 = 230
func (d *ConfigurableDevice) GetFieldValue(fieldID, scopeID uint32) (FieldValueType, uint64, nvml.Return) {
if fieldID == healthGPURecoveryActionField {
return FieldValueUint, uint64(recoveryActionForGPU(d.index)), nvml.SUCCESS
}
// existing dispatch
}Action values match nvmlGpuRecoveryAction_t: NONE=0, GPU_RESET=1, NODE_REBOOT=2, DRAIN_P2P=3, DRAIN_AND_RESET=4, RECOVER_IMEX_DOMAIN=5, BUS_RESET=6, SYSTEM_REBOOT=7.
After a mock commit contains both pieces, the driver can delete the local string patch and only bump the k8s-test-infra pin.
Scope / non-goals
In scope: configurable XID GI/CI, and field 230 on the existing GetFieldValue path.
Out of scope: real NVML behavior, and the DRA driver's taint policy.
Audience
Other (downstream mock-NVML e2e for the DRA GPU driver).
Pre-submission checks
- I searched existing issues and this is not a duplicate.
- I understand triage cadence is weekly and Unprioritized SLA is 7 calendric days.
Activity