fix(roles): ask the driver before writing a vGPU profile - #76
Aleksei Sviridkin (lexfrei) wants to merge 1 commit into
Conversation
A card whose driver does not report Host VGPU Mode SR-IOV runs vGPU through the legacy mdev path, and writing current_vgpu_type on one of its functions can disturb the vGPUs that path already placed there. Only the virtual-function stage asked the driver for that mode, so a card reached through a profile declaration alone, or one the function stage had already refused, had its profile written anyway. Both stages now ask for themselves and leave the card alone unless it reports SR-IOV. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe restore script now uses one helper to check host VGPU mode before VF and profile stages. Non-SR-IOV cards are logged and skipped successfully. Tests cover declined cards and profile-only declarations, and the README documents the behavior. ChangesSR-IOV mode handling
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant VFProfileStage
participant refuse_unless_sriov
participant NVIDIADriver
VFProfileStage->>refuse_unless_sriov: validate declared card mode
refuse_unless_sriov->>NVIDIADriver: query host_vgpu_mode
NVIDIADriver-->>refuse_unless_sriov: return observed mode
refuse_unless_sriov-->>VFProfileStage: allow SR-IOV or decline stage
Merge Risk: ⚪ Minimal · up to Non-SR-IOV cards are skipped without changing virtual functions or profiles, while supported cards continue through the existing stages. No actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The boot unit wrote
current_vgpu_typeon cards whose driver does not reportHost VGPU Mode: SR-IOV. A card that reportsNon SR-IOVruns vGPU through the legacy mdev path, and a write to one of its functions can disturb the vGPUs that path already placed there. Only the virtual-function stage asked the driver for that mode. The profile stage did not, so it wrote to a card the function stage had refused, and to a card declared with a profile alone, which that stage never sees at all.Changes
SR-IOV. They call one helper, so the check and the line it logs exist once, and the flag that carried the function stage's decision into the profile stage is gone.sriovand a profile, and a card declared with a profile and nosriov. Each keeps the functions it exposes, and each asserts the profile node is unchanged after the run.Test plan
ansible-lintpassesansible-test sanitypassesNo vGPU hardware here, so the stages ran against the fake
nvidia-smi,sriov-manageand PCI tree undertests/, on Ubuntu 24.04 with systemd.Summary by CodeRabbit
Bug Fixes
Documentation
Tests