open-gpu-kernel-modules icon indicating copy to clipboard operation
open-gpu-kernel-modules copied to clipboard

GB202: stale WPR2 after abnormal GSP shutdown can block subsequent stock initialization

Open Loong0x00 opened this issue 1 month ago • 4 comments

Summary

This is a separate but related recovery problem to #1080.

On an RTX 5090 / GB202 A1, I observed that after an abnormal GSP-RM shutdown or a failed GSP initialization attempt, later stock-driver loads can stop at:

unexpected WPR2 already up, cannot proceed with booting GSP
RmInitAdapter: Cannot initialize GSP firmware RM
rm_init_adapter failed

I am intentionally omitting security-research and trigger details from this public issue. Those details are being provided privately to NVIDIA PSIRT. This issue is limited to the driver/firmware initialization and recovery behavior.

Environment

GPU: RTX 5090 / GB202 A1
Open GPU Kernel Modules: 610.57.04 and 615.71.09
OS: Linux

Observed behavior

In the later stale-state condition:

  • unloading and reloading the driver did not restore GSP-RM initialization;
  • FLR and secondary-bus reset were not reliably sufficient;
  • in a later dirty-state sequence, the WPR2-up condition was observed again after a complete power cycle;
  • the condition remained after six previously changed platform settings were written back to their reference values and read back after a power cycle;
  • the failure occurs at the stock driver's early WPR2 state check, before normal GSP-RM initialization completes.

Private diagnostic testing indicated that the hardware was not necessarily unusable while this stale WPR2 state was present: the normal signed firmware bootstrap could still complete, followed by stable nvidia-smi, CUDA initialization, VRAM allocation, and ordinary compute/display operation. This suggests that at least some stale WPR2 states may be recoverable after validation rather than always being treated as fatal.

Recovery gap

The public driver-facing sequence is:

  1. GSP exits abnormally or initialization fails.
  2. WPR2 remains active or is reconstructed on a later boot.
  3. The next stock initialization sees WPR2 already active and refuses to proceed.
  4. Available reset methods do not reliably return the device to a stock-driver-accepted state.
  5. No documented GB202 teardown, stale-state validation, or service recovery operation is available.

Expected behavior

After an abnormal GSP shutdown or failed initialization, one of the following should be available:

  • firmware-assisted WPR2 teardown;
  • validation and safe reuse of an existing WPR2 state;
  • a guarded stock-driver recovery path;
  • a documented service-level recovery procedure.

Request

Could NVIDIA please:

  1. clarify the intended GB202 recovery path when kgspIsWpr2Up is true before GSP-RM boot;
  2. add a guarded stale-WPR2 validation/teardown path where safe;
  3. document a supported recovery or repair procedure for already affected devices;
  4. advise what logs are useful for diagnosing this condition without exposing security-sensitive reproduction details publicly?

If more information is needed, please reply in this issue with the requested non-sensitive diagnostics. Security-sensitive details can be handled through the associated private PSIRT reports.

Loong0x00 avatar Oct 12 '26 23:10 Loong0x00

[Fix] Blackwell GPU passthrough: "No devices were found" / "WPR2 already up" after a guest reboot. For headless Linux guests, blacklist nvidia_drm + nvidia_modeset (RTX PRO 4000, FreeBSD bhyve host)

TL;DR: the fix Symptom: an NVIDIA Blackwell card passed through to a Linux VM works on the first VM boot after the host boots. Any guest reboot or shutdown then hangs. After that, the card is dead inside the VM (nvidia-smi: "No devices were found"; dmesg: unexpected WPR2 already up, cannot proceed with booting GSP) until the whole host is rebooted. FLR and PCIe link resets from the host don't bring it back.

Cause (in our case): NVIDIA's display modules (nvidia_modeset, nvidia_drm) hang while unloading in a VM that has no display (stuck in nvRmVTSwitch). So the driver never gets to shut the GPU's GSP firmware down. Its protected memory region (WPR2) stays up, and the next driver start refuses the card.

Fix (headless / compute guests): never load those two modules:

# /etc/modprobe.d/nvidia-headless.conf
blacklist nvidia_drm
blacklist nvidia_modeset
install nvidia_drm /bin/false
install nvidia_modeset /bin/false
sudo update-initramfs -u

Then reboot the host once, to get a clean card.

After that only nvidia and nvidia_uvm load (all that CUDA needs). Guest reboot, guest poweroff and an ACPI shutdown from the host all work, and the card comes back every time without a host reboot, including when the VM autostarts after a host reboot.

What it does NOT fix: hard-killing the VM while the driver is loaded (vm poweroff -f, virsh destroy, and so on) still leaves WPR2 up, and only a host reboot clears that. Shut the guest down properly.


Setup

  • Host: FreeBSD 15.1-RELEASE, stock bhyve (no patches), vm-bhyve, UEFI guest firmware (BHYVE_UEFI.fd). Intel i7-7700T (Kaby Lake), B250 chipset, VT-d enabled, 64 GB RAM.
  • GPU: NVIDIA RTX PRO 4000 Blackwell SFF Edition, 24 GB (10de:2c33, GB203GL), plus its audio function (10de:22e9), in the CPU's x16 slot.
  • Guest: Ubuntu Server 24.04.5, kernel 6.8.0-147-generic, 4 vCPU, 32 GB (wired), headless.
  • Guest driver: 615.71.09, open kernel module (nvidia-headless-no-dkms-615-server-open, linux-modules-nvidia-615-server-open-generic, nvidia-utils-615-server), CUDA 13.4.

Passthrough config

Host, /boot/loader.conf:

vmm_load="YES"
pptdevs="1/0/0 1/0/1"

vm-bhyve guest config:

passthru0="1/0/0"
passthru1="1/0/1"
wired_memory="yes"

That gives bhyve -S (wired memory) and -s 0:6:0,passthru,1/0/0 -s 0:6:1,passthru,1/0/1.

Host after a reboot:

$ pciconf -l | grep ppt
ppt0@pci0:1:0:0: class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x2c33 subvendor=0x10de subdevice=0x2053
ppt1@pci0:1:0:1: class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x22e9 subvendor=0x10de subdevice=0x0000

Guest:

$ lspci | grep -i nvidia
00:06.0 VGA compatible controller: NVIDIA Corporation Device 2c33 (rev a1)
00:06.1 Audio device: NVIDIA Corporation Device 22e9 (rev a1)

Driver install (Blackwell needs the open driver):

sudo apt update
ubuntu-drivers list --gpgpu
sudo ubuntu-drivers install --gpgpu nvidia:615-server-open
sudo apt install nvidia-utils-615-server   # --gpgpu leaves out nvidia-smi

The first boot with the driver works:

$ nvidia-smi
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 615.71.09              KMD Version: 615.71.09     CUDA UMD Version: 13.4     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|=========================================+========================+======================|
|   0  NVIDIA RTX PRO 4000 Blac...    Off |   00000000:00:06.0 Off |                  Off |
| 30%   36C    P8              9W /   70W |       1MiB /  24467MiB |      0%      Default |
+-----------------------------------------+------------------------+----------------------+

The problem: what we saw

  1. sudo reboot inside the guest: the guest never finishes going down. The bhyve process stays alive, there's no network, and vm-bhyve logs no exit.
  2. ACPI shutdown from the host (vm stop): the same. Still "Running" after several minutes.
  3. A guest reboot before the NVIDIA driver had ever loaded (right after installing it) worked fine. That was the first hint that the driver was involved.
  4. vm poweroff -f, then vm start right away: bhyve exited with status 4. This one turned out to be a red herring: vm list still showed "Locked" because the old instance was still being torn down. Wait for "Stopped" before starting again.
  5. vm poweroff -f, wait for "Stopped", vm start: the guest boots, but
$ nvidia-smi
No devices were found
$ sudo dmesg | grep -i -e nvrm -e wpr -e gsp | head -15
NVRM: GPU0 objClInitPcieChipset: *** Unable to get PCI port handles
NVRM: Xid (PCI:0000:00:06): 62, 324f892d 0002e740 00000000 2067ede2 2067f180 2067f0c2 20680598 20680a06
NVRM: GPU0 _kgspProcessRpcEvent: Attempted to process RPC event from GPU0: 0x1022 (RECOVERY_ACTION) during bootup without API lock
NVRM: GPU0 _kgspProcessRpcEvent: Attempted to process RPC event from GPU0: 0x1029 (PMU_HALTED) during bootup without API lock
NVRM: GPU0 kgspSendInitRpcs_IMPL: GMCAPI_CMD_GSP_INIT failed: 0x65
NVRM: GPU0 nvAssertOkFailedNoLog: Assertion failed: Call timed out [NV_ERR_TIMEOUT] (0x00000065) returned from kgspSendInitRpcs(pGpu, pKernelGsp) @ kernel_gsp_gh100.c:1091
NVRM: GPU0 _kgspBootGspRm: unexpected WPR2 already up, cannot proceed with booting GSP
NVRM: GPU0 _kgspBootGspRm: (the GPU is likely in a bad state and may need to be reset)
NVRM: GPU0 RmInitAdapter: Cannot initialize GSP firmware RM
NVRM: GPU 0000:00:06.0: RmInitAdapter failed! (0x62:0x40:2130)
NVRM: GPU 0000:00:06.0: rm_init_adapter failed, device minor number 0
NVRM: GPU 0000:00:06.0 init failed during probe (ret=-5).

Only a full host reboot brought the card back.

(objClInitPcieChipset: *** Unable to get PCI port handles shows on every boot, including the good ones. bhyve puts the GPU straight on the guest's bus 0, with no PCIe root port above it. It seems harmless.)

Troubleshooting

Does the card support FLR? On the host:

$ pciconf -lc pci0:1:0:0
...
cap 10[60] = PCI-Express 2 legacy endpoint max data 256(256) FLR RO
             max read 512
             link x8(x16) speed 2.5(32.0) ASPM disabled(L1) ClockPM disabled
...

Yes, it does.

FLR from the host, with the VM stopped: devctl reset ppt0 and devctl reset ppt1 (both silent). Then vm start: still "No devices were found".

A PCIe link reset from the host: devctl reset pci1. That's the bus under the root port, and FreeBSD's bridge reset disables the link and retrains it (a hot reset), saving and restoring the devices' config around it. First we checked that bus 1 holds only the GPU's two functions:

$ pciconf -l | grep 'pci0:1:'
$ devinfo -p pci1
pci1 pcib1 pci0 pcib0 acpi0 nexus0

Result: no change. The guest dmesg showed unexpected WPR2 already up again.

Research: this matches the known Blackwell "reset bug" reported for the RTX 5090 and RTX PRO 6000 under Linux KVM/VFIO. GSP firmware sets up a protected region (WPR2) that survives FLR, so the next driver start refuses to boot GSP. Links at the end.

The idea: if the guest's driver unloaded properly, GSP would tear WPR2 down itself. On a fresh card (after a host reboot), inside the guest:

$ lsmod | grep nvidia
nvidia_uvm           2088960  0
nvidia_drm            155648  0
nvidia_modeset       1556480  1 nvidia_drm
nvidia              16875520  2 nvidia_uvm,nvidia_modeset

$ sudo systemctl stop nvidia-persistenced                    # fine
$ sudo rmmod nvidia_uvm nvidia_drm nvidia_modeset nvidia      # hangs forever

From a second SSH session:

$ sudo dmesg | grep -i nvrm
NVRM: Xid (PCI:0000:00:06): 56, pid=..., name=(udev-worker), CMDre 00000000 00000000 00000400 00000001 00000000
...
 nvRmApiControl+0x46/0x60 [nvidia_modeset]
 ? nvRmVTSwitch+0x2d/0x40 [nvidia_modeset]

So the unload hangs in nvidia_modeset's VT switch (handing the console back), in a VM where nothing is attached to the GPU's outputs. The same thing happens on reboot or shutdown. GSP never shuts down, WPR2 stays up, and the next start fails. (The Xid 56 is a display-engine error, logged as udev-worker loaded the display modules at boot.)

The fix

f=/etc/modprobe.d/nvidia-headless.conf
echo 'blacklist nvidia_drm' | sudo tee $f
echo 'blacklist nvidia_modeset' | sudo tee -a $f
echo 'install nvidia_drm /bin/false' | sudo tee -a $f
echo 'install nvidia_modeset /bin/false' | sudo tee -a $f
sudo update-initramfs -u
sync

Then one host reboot for a clean card. After it:

$ lsmod | grep nvidia
nvidia_uvm           2088960  0
nvidia              16875520  1 nvidia_uvm
Test Before the fix After the fix
sudo poweroff in the guest, then vm start hang card back, about 45 s from poweroff to nvidia-smi
sudo reboot in the guest hang card back, about 40 s
vm stop (ACPI) from the host, then vm start hang card back
host reboot, VM autostarts (vm_list) n/a card back

Notes and caveats

  • Headless/compute only. No display from the passed-through GPU in the guest. If you need the display modules, this isn't your fix. We didn't test a guest with a monitor on the GPU, where the VT switch might behave differently.
  • Don't hard-kill the VM while the driver is loaded. That still leaves WPR2 up.
  • After a guest driver upgrade, check the modprobe file is still there and lsmod shows only nvidia and nvidia_uvm.
  • So far this is tested with nvidia-smi and repeated restarts.
  • KVM/Proxmox users with Linux guests: we haven't tested on KVM, but if your guest is headless and you hit the Blackwell reset bug, this might be the same mechanism, and it's cheap to try.
  • For FreeBSD folks: on the same host, a Maxwell GTX 960 couldn't be initialized in a bhyve guest at all (RmInitAdapter failed), as others report for older NVIDIA cards without the community bhyve patches. This Blackwell card with the open/GSP driver needed no bhyve patches on 15.1.

Bonus: the same card on the FreeBSD host itself

Before passing it through, we ran the card on the FreeBSD host (Vulkan, for whisper.cpp). Two gotchas:

  1. nvidia-driver-580 hung at the first open: nvidia-smi sat in state D, Ctrl-C did nothing, and shutdowns hung after "All buffers synced". The port's pkg message says GSP firmware is off by default, and some GPUs don't work without it. We switched to nvidia-driver 595.104.02 and added hw.nvidia.registry.EnableGpuFirmware="1" to /boot/loader.conf, and nvidia-smi worked. (Both changed together; GSP is the likely one.)
  2. Non-root processes couldn't use the card (root could). The Vulkan loader said Could not get 'vkCreateInstance' via 'vk_icdGetInstanceProcAddr' for ICD libGLX_nvidia.so.0, and dmesg said firmware_get_flags: insufficient privileges to load firmware image nvidia_gsp_ga10x_fw and RmInitAdapter failed! (0x61:0x56:2726). Without persistence, the driver powers the GPU down when the last client closes and loads the GSP firmware module again on the next open, and only root may load kernel modules. The fix is to keep it loaded: sysrc kld_list+=nvidia_gsp_ga10x_fw.

References

  • Tom's Hardware, RTX 5090 / PRO 6000 reset bug: https://www.tomshardware.com/pc-components/gpus/rtx-5090-pro-6000-bug-forces-host-reboot
  • NVIDIA forums, RTX PRO 6000 Max-Q FLR failure after KVM guest shutdown: https://forums.developer.nvidia.com/t/rtx-pro-6000-blackwell-max-q-10de-2bb4-flr-fails-on-vfio-pci-release-after-kvm-guest-shutdown-gpu-inaccessible-until-cold-power-cycle/386790
  • open-gpu-kernel-modules issue #1442 (stale WPR2): https://github.com/NVIDIA/open-gpu-kernel-modules/issues/1442
  • Level1Techs, RTX 50 reset bug thread: https://forum.level1techs.com/t/do-your-rtx-5090-or-general-rtx-50-series-has-reset-bug-in-vm-passthrough/228549

GhettoBSD avatar Nov 05 '26 05:11 GhettoBSD

A data point that may help: one reproducible way WPR2 gets left up, and a mitigation.

  • Setup: GB203 (RTX PRO 4000 Blackwell SFF, 10de:2c33), open driver 615.71.09, Ubuntu 24.04 guest, kernel 6.8.0-147, GPU passed through with FreeBSD 15.1 bhyve.
  • Symptom: after any guest reboot or shutdown, the next init fails with unexpected WPR2 already up, cannot proceed with booting GSP and RmInitAdapter failed! (0x62:0x40:2130), until the host is power-cycled. FLR and a PCIe link reset from the host did not clear it.
  • Cause in our case: nvidia_modeset hangs on unload in the headless VM (nvRmVTSwitch -> nvRmApiControl), so the driver never shuts GSP down, and WPR2 is left up.
  • Mitigation: blacklist nvidia_drm and nvidia_modeset in the guest, using both blacklist and install ... /bin/false in modprobe.d, then rebuild the initramfs. With only nvidia and nvidia_uvm loaded, GSP shuts down cleanly, and the GPU initializes again after every guest reboot, poweroff or host-side ACPI shutdown, with no host reset.

This doesn't recover a GPU that is already in the stale-WPR2 state; a hard kill of the VM while the driver is loaded still leaves it up. But it avoids getting into that state on normal shutdowns. Filed the modeset hang as #1523. Full write-up: https://forums.freebsd.org/threads/nvidia-blackwell-passthrough-on-stock-15-1-fix-for-card-lost-after-guest-reboot-wpr2-already-up.104303/

GhettoBSD avatar Nov 05 '26 05:11 GhettoBSD

@GhettoBSD: let's keep this Issue focused on baremetal. Virtualization adds several new dimensions of complexity. Plus, those comments are extremely verbose.

@Loong0x00: I could use clearer reproduction steps. Do you have a reliable sequence to cause an abnormal GSP-RM shutdown? In my experience, a cold boot recovers things. That's of course not good, but it sounds like your experience is different? That makes me wonder if there is something special about the state GSP-RM is getting in. I'd like to know how to get into that state?

aritger avatar Nov 06 '26 22:11 aritger

@aritger I checked the original logs. Here is the historical operation sequence and today's retest result.

Historical operations (September 28–29)

The initial experiments used my local firmware test harness and CC-related research driver modifications, with the WPR2 fail-early check still enabled.

  1. Unload the NVIDIA driver and stop GSP.
  2. Send a baseline COT request: version=2, size=860, gspFmcSysmemOffset=0x1000000.
  3. With the other fields unchanged, test the size values 0, 1, 859, 861, 2048, 4096, 32768, 65535.
  4. Restore size=860, then test versions 0, 1, 3, 0xffff consecutively. After this series, PRC stopped responding while message types 0x20 and 0x16 still responded. The subsequent driver load failed with unexpected WPR2 already up.
  5. In a later experiment, set PRC knobs 8 and 6 to 1, terminate GPU clients with SIGKILL, request driver unload, perform a secondary-bus reset/rescan, start the driver again, and wait eight seconds before sending five COT requests. These used version=2, size=860, and FMC offsets 0x55c03000, 0, 0xdead0000, 0x100000000, and 0x7fffffffffff. The cleanup writes did not clear the settings, the test timed out, and nvidia-smi could not communicate with the driver.
  6. Additional abnormal GSP shutdown/crash and recovery tests followed. These were consecutive experiments, not individual requests tested against a freshly restored device each time.

On September 29, after restoring six previously changed settings and verifying their readbacks, I completely power-cycled the machine. The new boot still reported unexpected WPR2 already up and refused initialization; the six settings still read back as restored. Driver reloads, FLR/SBR attempts, and power removal had not provided reliable recovery of the later state.

Today's retest (November 7)

On the same board, on bare metal, I built the unmodified official 615.78.08 GitHub tag, without the WPR2 bypass. I unloaded the driver, performed one FLR, and directly loaded that build. nvidia-smi, a three-pass CUDA smoke test, and display initialization passed. WPR2 was already down after normal unload, before the FLR, and remained down after it.

I then installed the official Arch/pacman nvidia-open-dkms 615.78.08-1 package and rebooted the host. I verified that the four loaded modules matched the official package build. GPU initialization and the desktop work normally, with no WPR2 refusal, GSP initialization failure, or NVIDIA Xid in this boot.

The earlier WPR2 initialization failure currently no longer reproduces on this board.

Loong0x00 avatar Nov 07 '26 09:11 Loong0x00