RTX 5080 Laptop - DRM device removal during nvidia-suspend.service causes KWin Wayland to fail, blocking resume from s2idle

Hardware: TongFang X6FR558Y barebone (Ryzen 9 9955HX3D + RTX 5080 Laptop GPU)
OS: PikaOS 4 (Debian sid based), kernel 7.0.5-pikaos
Driver: 595.71.05 (proprietary, DKMS)
Compositor: KWin Wayland (Plasma 6)
Sleep state: s2idle / S0ix only (no S3 exposed by firmware)

All recommended NVIDIA power-management settings are in place:

  • nvidia NVreg_PreserveVideoMemoryAllocations=1
  • nvidia NVreg_EnableS0ixPowerManagement=1
  • nvidia-suspend.service, nvidia-resume.service, nvidia-hibernate.service enabled

Symptom: random failure to resume from s2idle. System remains unresponsive (no TTY, no SSH, no input), only forced power-off recovers it. Failure rate is significantly higher when suspend is triggered shortly after a 3D workload (Proton/Vulkan game), even after the GPU has returned to <25W idle and userspace cleanup has completed. Tested waiting 30+ seconds after game exit and disconnecting all Bluetooth controllers before lid close - no change.

What KWin logs at the moment of suspend (in every failed case):

kwin_core: Failed to delay sleep: The operation inhibition has been requested for is already running
kwin_core: Failed to open /dev/dri/renderD128 device (No such device)
kwin_wayland_drm: Failed to open drm device /dev/dri/renderD128
kwin_core: Failed to authenticate the drm magic token. path: "/dev/dri/card1" error: Permission denied
kwin_wayland_drm: drmModeListLessees() failed: Permission denied
kwin_wayland_drm: Atomic modeset test failed! Permission denied

These errors fire while nvidia-suspend.service is still executing and before systemd-suspend.service freezes user sessions. The NVIDIA package ships /usr/lib/systemd/system/systemd-suspend.service.d/nvidia-suspend-nofreeze.conf which sets SYSTEMD_SLEEP_FREEZE_USER_SESSIONS=false, so the compositor is alive and touching DRM while the driver is removing the device. Overriding this to true via a drop-in makes the freeze succeed but does NOT fix the resume failure - the GPU state still doesn’t come back.

Additional observation: KWin logs “kwin_wayland_drm: atomic commit failed: Device or resource busy” sporadically during normal desktop usage (no suspend involved), and at boot fails to open /dev/dri/card2 (“Device or resource busy”). Suggests a pre-existing DRM contention issue independent of the sleep path.

Attached:

Can anyone help with this issue? Thanks in advance :)