Skip to content

CI: stop display container before switching driver modes - #3184

Open
jpascucci-nv wants to merge 4 commits into
NVIDIA:mainfrom
jpascucci-nv:tcc-cycle
Open

jpascucci-nv wants to merge 4 commits into
NVIDIA:mainfrom
jpascucci-nv:tcc-cycle

Conversation

@jpascucci-nv

Copy link
Copy Markdown
Contributor

Description

Closes #3183

Stop NVDisplay.ContainerLocalSystem before invoking nvidia-smi -fdm and wait for every NVDisplay.Container process to exit.

After a driver install, the display container can crash-loop while the GPU is cycled. If its teardown overlaps PnP removal, nvlddmkm can remain loaded and nvidia-smi may never recover. Bound the process drain at 60 seconds and report remaining PIDs on failure.

Preserve the existing mode-specific logging and device-cycle stabilization behavior.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Closes NVIDIA#3183

Stop NVDisplay.ContainerLocalSystem before invoking nvidia-smi -fdm and
wait for every NVDisplay.Container process to exit.

After a driver install, the display container can crash-loop while the
GPU is cycled. If its teardown overlaps PnP removal, nvlddmkm can remain
loaded and nvidia-smi may never recover. Bound the process drain at 60
seconds and report remaining PIDs on failure.

Preserve the existing mode-specific logging and device-cycle
stabilization behavior.
@jpascucci-nv jpascucci-nv self-assigned this Oct 21, 2026
@github-actions github-actions Bot added the CI/CD CI/CD infrastructure label Oct 21, 2026
@jpascucci-nv
jpascucci-nv requested review from leofang and rwgk October 21, 2026 20:12
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 97051703-e88d-41a8-b1ae-3a545185e0bf
📥 Commits

Reviewing files that changed from the base of the PR and between 55cbcbb and 12a6d75.

📒 Files selected for processing: 1
  • ci/tools/configure_driver_mode.ps1
🚧 Files skipped from review as they are similar to previous changes: 1
  • ci/tools/configure_driver_mode.ps1

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved graphics driver mode configuration during automated setup.
    • Improved handling of display service shutdown and restoration while applying driver changes.
    • Added timeout protection and clearer failure reporting when driver operations or health checks do not complete successfully.
  • Enhancements

    • Supports configuring WDDM, TCC, and MCDM driver modes.

The driver-mode script now stops and disables the NVIDIA display-container service, changes the driver mode, cycles NVIDIA display devices, validates nvidia-smi recovery, and restores the service startup type.

Changes: Driver mode configuration

Layer / File(s) Summary
Stop container and recover driver mode
ci/tools/configure_driver_mode.ps1
The script stops the display-container service with a 60-second timeout, maps supported modes to nvidia-smi -fdm codes, validates command results and device presence, polls for consecutive recovery successes, and restores the original startup type in finally.

Assessment against linked issues

Objective Addressed Explanation
Prevent the display-container process from blocking driver unload during device cycling and allow nvidia-smi -fdm <mode> to succeed [issue 3183] ✅

Possibly related issues

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 12a6d

No actionable merge-blocking risk was established; the change is mergeable after normal checks.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 81b6d0cc-b448-46d9-87d9-b15a3b5a79cc
📥 Commits

Reviewing files that changed from the base of the PR and between dfad7e3 and db0b125.

📒 Files selected for processing: 1
  • ci/tools/configure_driver_mode.ps1

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Comment thread ci/tools/configure_driver_mode.ps1 Outdated
@github-actions

Copy link
Copy Markdown
Contributor

@rwgk rwgk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codex GPT-6.1-Sol ultra:

  • [P2] A queued service recovery restart can reintroduce the race — configure_driver_mode.ps1:29–30. After a crash, the service can report Stopped with no processes while Windows waits to restart it. The helper then returns immediately, allowing the container to restart during device cycling. Stopping the service does not cancel queued recovery; Microsoft documents that disabling it prevents the restart. Temporarily disable the service through the cycle, then restore its previous configuration.

Comment thread ci/tools/configure_driver_mode.ps1 Outdated
# This assumes we have the prior knowledge on which GPU can use which mode.
$driver_mode = $env:DRIVER_MODE
if ($driver_mode -eq "WDDM") {
Write-Output "Setting driver mode to WDDM..."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Write-Output now appears before running Stop-DisplayContainer, maybe that'll be confusing?

How about:

Remove the three Write-Output here.

Conveniently, you have the $driver_mode variable already.
So below (after running Stop-DisplayContainer):

    Write-Output "Setting driver mode to $driver_mode..."
    nvidia-smi -fdm $driver_mode_code

While at it, maybe rename the $driver_mode variable to $driver_mode_name.

Temporarily disable NVDisplay.ContainerLocalSystem while changing driver
modes so queued recovery actions cannot restart it during the device cycle.
Handle in-flight starts, restore the original startup type in a finally
block, and report the requested driver mode by name.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 49b77a5d-5a22-4942-b124-3e8b3e0da34a
📥 Commits

Reviewing files that changed from the base of the PR and between bb9970e and 55cbcbb.

📒 Files selected for processing: 1
  • ci/tools/configure_driver_mode.ps1

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Comment thread ci/tools/configure_driver_mode.ps1
Comment thread ci/tools/configure_driver_mode.ps1

@rwgk rwgk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codex GPT-6.1-Sol ultra:

No new findings in 12a6d75. The earlier recovery-restart concern is addressed: the service stays disabled through device cycling and NVML recovery, with its startup type restored in finally.

PowerShell parsing and mocked success/failure checks passed, including restoration after service-stop timeout, mode-setting failure, empty device discovery, and NVML recovery failure.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Flaky driver initialization in CI

2 participants