Nvidia-suspend with VSCode triggers kernel bug

Hello, I am having an issue with suspending my laptop on bluefin-dx-nvidia while some programs are accessing dGPU.
Suspending laptop while VSCode or a container using dGPU is running (with no open files) leads to kernel messages being displayed. (Apparently Wireless card crashes first, so I am including it as well.) This issue does not happen with other programs using dGPU, e.g. firefox. For the containers am just stopping them before suspend and that does prevent this issue for containers https://universal-blue.discourse.group/t/ollama-and-suspend-on-nvidia/1365. Running VSCode with --disable-gpu option does not help. While this happens the VSCode is not listed in nvidia-smi as process using dGPU.
Excerpt from journalct -b 0--dmesg:

May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: firmware crashed! (guid d189c6ce-a8be-45f1-b9b2-56b53e7f8a36)
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: qca6174 hw2.1 target 0x05010000 chip_id 0x003405ff sub 105b:e08e
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 0 testmode 0
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: firmware ver SW_RM.1.1.1-00157-QCARMSWPZ-1 api 5 features ignore-otp,no-4addr-pad crc32 10bf8e08
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: board_file api 2 bmi_id N/A crc32 ae2e275a
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: htt-ver 3.1 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: firmware register dump:
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [00]: 0x05010000 0x00000000 0x0092E4DC 0x664D41EE
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [04]: 0x0092E4DC 0x00060130 0x00000018 0x0041A760
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [08]: 0x664D41DA 0x00400000 0x00000000 0x000A5C88
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [12]: 0x00000009 0x00000000 0x0096C09C 0x0096C0A7
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [16]: 0x0096BDBC 0x009287BD 0x00000000 0x009287BD
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [20]: 0x4092E4DC 0x0041A710 0x00000000 0x0F000000
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [24]: 0x809432A7 0x0041A770 0x0040D400 0xC092E4DC
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [28]: 0x80942BC4 0x0041A790 0x664D41DA 0x00400000
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [32]: 0x80947BA7 0x0041A7B0 0x004050A8 0x0040E074
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [36]: 0x809BDECC 0x0041A7D0 0x004050A8 0x0040E074
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [40]: 0x8099638C 0x0041A7F0 0x004050A8 0x00000000
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [44]: 0x80992076 0x0041A810 0x0044FD68 0x0046FFE8
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [48]: 0x80996BD3 0x0041A830 0x0044FD68 0x00000000
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [52]: 0x800B4405 0x0041A850 0x00422318 0x00005002
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [56]: 0x809A6C34 0x0041A8E0 0x0042932C 0x0042CA20
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: Copy Engine register dump:
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [00]: 0x00034400   1   1   3   3
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [01]: 0x00034800  15  15 370 371
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [02]: 0x00034c00  14  14  77  78
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [03]: 0x00035000  19  19  19  19
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [04]: 0x00035400 6335 6335 161  97
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [05]: 0x00035800   0   0   0   0
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [06]: 0x00035c00  21  21  21  21
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: [07]: 0x00036000   1   1   1   1
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: failed to submit keepalive on vdev 0: -108
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: failed to disable keepalive on vdev 0: -108
May 08 11:49:09 fedora kernel: ieee80211 phy0: Hardware restart was requested
May 08 11:49:09 fedora kernel: ath10k_pci 0000:03:00.0: failed to create WMI vdev 0: -108
May 08 11:49:11 fedora kernel: ath10k_pci 0000:03:00.0: device successfully recovered
May 08 11:49:12 fedora kernel: list_add corruption. prev is NULL.
May 08 11:49:12 fedora kernel: ------------[ cut here ]------------
May 08 11:49:12 fedora kernel: kernel BUG at lib/list_debug.c:25!
May 08 11:49:12 fedora kernel: fbcon: Taking over console
May 08 11:49:12 fedora kernel: invalid opcode: 0000 [#1] PREEMPT SMP PTI
May 08 11:49:12 fedora kernel: CPU: 2 PID: 29471 Comm: nvidia-sleep.sh Tainted: P          IO       6.8.7-300.fc40.x86_64 #1
May 08 11:49:12 fedora kernel: Hardware name: Acer Aspire VN7-571G/Aspire VN7-571G, BIOS V1.11 11/21/2014
May 08 11:49:12 fedora kernel: RIP: 0010:__list_add_valid_or_report+0x42/0xa0
May 08 11:49:12 fedora kernel: Code: 75 38 4c 8b 02 49 39 c0 75 41 48 39 d7 74 53 4c 39 c7 74 4e b8 01 00 00 00 c3 cc cc cc cc 48 c7 c7 60 9b b7 9a e8 3e 99 95 ff <0f> 0b 48 c7 c7 88 9b b7 9a e8 30 99 95 ff 0f 0b 48 89 c1 48 c7 c7
May 08 11:49:12 fedora kernel: RSP: 0000:ffffadf5416d78b8 EFLAGS: 00010046
May 08 11:49:12 fedora kernel: RAX: 0000000000000022 RBX: ffffadf546d852c0 RCX: 0000000000000000
May 08 11:49:12 fedora kernel: RDX: 0000000000000000 RSI: ffff9c6bced218c0 RDI: ffff9c6bced218c0
May 08 11:49:12 fedora kernel: RBP: ffffadf5416d78f0 R08: 0000000000000000 R09: ffffadf5416d7748
May 08 11:49:12 fedora kernel: R10: ffffffff9b516808 R11: 0000000000000003 R12: 0000000000000246
May 08 11:49:12 fedora kernel: R13: ffffadf546d852d0 R14: 0000000000000000 R15: ffff9c6a7de0b000
May 08 11:49:12 fedora kernel: FS:  00007fa6b2109740(0000) GS:ffff9c6bced00000(0000) knlGS:0000000000000000
May 08 11:49:12 fedora kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
May 08 11:49:12 fedora kernel: CR2: 00005653bb0eca08 CR3: 0000000169dea002 CR4: 00000000003706f0
May 08 11:49:12 fedora kernel: Call Trace:
May 08 11:49:12 fedora kernel:  <TASK>
May 08 11:49:12 fedora kernel:  ? die+0x36/0x90
May 08 11:49:12 fedora kernel:  ? do_trap+0xda/0x100
May 08 11:49:12 fedora kernel:  ? __list_add_valid_or_report+0x42/0xa0
May 08 11:49:12 fedora kernel:  ? do_error_trap+0x6a/0x90
May 08 11:49:12 fedora kernel:  ? __list_add_valid_or_report+0x42/0xa0
May 08 11:49:12 fedora kernel:  ? exc_invalid_op+0x50/0x70
May 08 11:49:12 fedora kernel:  ? __list_add_valid_or_report+0x42/0xa0
May 08 11:49:12 fedora kernel:  ? asm_exc_invalid_op+0x1a/0x20
May 08 11:49:12 fedora kernel:  ? __list_add_valid_or_report+0x42/0xa0
May 08 11:49:12 fedora kernel:  ? __list_add_valid_or_report+0x42/0xa0
May 08 11:49:12 fedora kernel:  _raw_q_schedule+0x3d/0xa0 [nvidia_uvm]
May 08 11:49:12 fedora kernel:  nv_kthread_q_flush+0x80/0x140 [nvidia_uvm]
May 08 11:49:12 fedora kernel:  ? __pfx__q_flush_function+0x10/0x10 [nvidia_uvm]
May 08 11:49:12 fedora kernel:  ? thread_context_current+0x7e/0x120 [nvidia_uvm]
May 08 11:49:12 fedora kernel:  uvm_suspend.isra.0+0x94/0x190 [nvidia_uvm]
May 08 11:49:12 fedora kernel:  uvm_suspend_entry+0x7c/0x90 [nvidia_uvm]
May 08 11:49:12 fedora kernel:  nv_uvm_suspend+0x31/0x50 [nvidia]
May 08 11:49:12 fedora kernel:  nv_set_system_power_state+0x3bb/0x470 [nvidia]
May 08 11:49:12 fedora kernel:  nv_procfs_write_suspend+0xe1/0x160 [nvidia]
May 08 11:49:12 fedora kernel:  proc_reg_write+0x5d/0xa0
May 08 11:49:12 fedora kernel:  vfs_write+0xf0/0x470
May 08 11:49:12 fedora kernel:  ksys_write+0x6d/0xf0
May 08 11:49:12 fedora kernel:  do_syscall_64+0x83/0x170
May 08 11:49:12 fedora kernel:  ? syscall_exit_to_user_mode+0x83/0x230
May 08 11:49:12 fedora kernel:  ? do_syscall_64+0x8f/0x170
May 08 11:49:12 fedora kernel:  ? do_syscall_64+0x8f/0x170
May 08 11:49:12 fedora kernel:  ? do_filp_open+0xb3/0x160
May 08 11:49:12 fedora kernel:  ? get_close_on_exec+0x36/0x40
May 08 11:49:12 fedora kernel:  ? filp_flush+0x52/0x70
May 08 11:49:12 fedora kernel:  ? filp_close+0x1d/0x30
May 08 11:49:12 fedora kernel:  ? do_dup2+0x88/0xd0
May 08 11:49:12 fedora kernel:  ? filp_flush+0x52/0x70
May 08 11:49:12 fedora kernel:  ? syscall_exit_to_user_mode+0x83/0x230
May 08 11:49:12 fedora kernel:  ? do_syscall_64+0x8f/0x170
May 08 11:49:12 fedora kernel:  ? exc_page_fault+0x7f/0x180
May 08 11:49:12 fedora kernel:  entry_SYSCALL_64_after_hwframe+0x78/0x80
May 08 11:49:12 fedora kernel: RIP: 0033:0x7fa6b2217834
May 08 11:49:12 fedora kernel: Code: c7 00 16 00 00 00 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 80 3d 15 f8 0d 00 00 74 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 55 48 89 e5 48 83 ec 20 48 89
May 08 11:49:12 fedora kernel: RSP: 002b:00007ffc6668d238 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
May 08 11:49:12 fedora kernel: RAX: ffffffffffffffda RBX: 0000000000000008 RCX: 00007fa6b2217834
May 08 11:49:12 fedora kernel: RDX: 0000000000000008 RSI: 000055f187d07150 RDI: 0000000000000001
May 08 11:49:12 fedora kernel: RBP: 00007ffc6668d260 R08: 0000000000000410 R09: 0000000000000001
May 08 11:49:12 fedora kernel: R10: 0000000000000004 R11: 0000000000000202 R12: 0000000000000008
May 08 11:49:12 fedora kernel: R13: 000055f187d07150 R14: 00007fa6b22f05c0 R15: 00007fa6b22edf00
May 08 11:49:12 fedora kernel:  </TASK>
May 08 11:49:12 fedora kernel: Modules linked in: uinput rfcomm snd_seq_dummy snd_hrtimer overlay intel_rapl_msr bnep at24 mei_pxp mei_hdcp iTCO_wdt intel_pmc_bxt iTCO_vendor_support wl(PO) intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm tun nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat irqbypass nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rapl intel_cstate intel_uncore uvcvideo ip_set uvc videobuf2_vmalloc nf_tables pcspkr videobuf2_memops videobuf2_v4l2 acer_wmi rtsx_usb_ms sparse_keymap videobuf2_common memstick platform_profile wmi_bmof btusb btrtl btintel snd_hda_codec_realtek btbcm btmtk qrtr i2c_i801 bluetooth i2c_smbus intel_pch_thermal snd_hda_codec_generic snd_hda_codec_hdmi ath10k_pci snd_hda_intel ath10k_core snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec mac80211 libarc4 ath snd_hda_core snd_hwdep snd_seq r8169 snd_seq_device mei_me snd_pcm realtek mei
May 08 11:49:12 fedora kernel:  snd_timer lpc_ich snd soundcore sunrpc binfmt_misc vfat fat acpi_pad joydev pktcdvd brcmfmac brcmutil cfg80211 rfkill scsi_dh_rdac scsi_dh_emc scsi_dh_alua kvmfr(O) loop dm_multipath nfnetlink zram i915 crct10dif_pclmul crc32_pclmul crc32c_intel rtsx_usb_sdmmc drm_buddy polyval_clmulni i2c_algo_bit polyval_generic mmc_core drm_display_helper ghash_clmulni_intel hid_multitouch sha512_ssse3 sha256_ssse3 sha1_ssse3 rtsx_usb i2c_hid_acpi cec i2c_hid ttm serio_raw nvidia_drm(PO) nvidia_modeset(PO) video wmi nvidia_uvm(PO) nvidia(PO) v4l2loopback(O) videodev mc ip6_tables ip_tables fuse evdi(O) i2c_dev
May 08 11:49:12 fedora kernel: ---[ end trace 0000000000000000 ]---
May 08 11:49:12 fedora kernel: RIP: 0010:__list_add_valid_or_report+0x42/0xa0
May 08 11:49:12 fedora kernel: Code: 75 38 4c 8b 02 49 39 c0 75 41 48 39 d7 74 53 4c 39 c7 74 4e b8 01 00 00 00 c3 cc cc cc cc 48 c7 c7 60 9b b7 9a e8 3e 99 95 ff <0f> 0b 48 c7 c7 88 9b b7 9a e8 30 99 95 ff 0f 0b 48 89 c1 48 c7 c7
May 08 11:49:12 fedora kernel: RSP: 0000:ffffadf5416d78b8 EFLAGS: 00010046
May 08 11:49:12 fedora kernel: RAX: 0000000000000022 RBX: ffffadf546d852c0 RCX: 0000000000000000
May 08 11:49:12 fedora kernel: RDX: 0000000000000000 RSI: ffff9c6bced218c0 RDI: ffff9c6bced218c0
May 08 11:49:12 fedora kernel: RBP: ffffadf5416d78f0 R08: 0000000000000000 R09: ffffadf5416d7748
May 08 11:49:12 fedora kernel: R10: ffffffff9b516808 R11: 0000000000000003 R12: 0000000000000246
May 08 11:49:12 fedora kernel: R13: ffffadf546d852d0 R14: 0000000000000000 R15: ffff9c6a7de0b000
May 08 11:49:12 fedora kernel: FS:  00007fa6b2109740(0000) GS:ffff9c6bced00000(0000) knlGS:0000000000000000
May 08 11:49:12 fedora kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
May 08 11:49:12 fedora kernel: CR2: 00005653bb0eca08 CR3: 0000000169dea002 CR4: 00000000003706f0
May 08 11:49:12 fedora kernel: note: nvidia-sleep.sh[29471] exited with irqs disabled
May 08 11:49:12 fedora kernel: note: nvidia-sleep.sh[29471] exited with preempt_count 1
May 08 11:49:12 fedora kernel: rfkill: input handler enabled
May 08 11:49:12 fedora kernel: Console: switching to colour frame buffer device 240x67
May 08 11:49:13 fedora kernel: PM: suspend entry (deep)
May 08 11:49:13 fedora kernel: Filesystems sync: 0.198 seconds
May 08 11:49:14 fedora kernel: Freezing user space processes
May 08 11:49:14 fedora kernel: Freezing user space processes completed (elapsed 0.002 seconds)
May 08 11:49:14 fedora kernel: OOM killer disabled.
May 08 11:49:14 fedora kernel: Freezing remaining freezable tasks
May 08 11:49:14 fedora kernel: Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
May 08 11:49:14 fedora kernel: printk: Suspending console(s) (use no_console_suspend to debug)
May 08 11:49:14 fedora kernel: NVRM: GPU 0000:04:00.0: PreserveVideoMemoryAllocations module parameter is set. System Power Management attempted without driver procfs suspend interface. Please refer to the 'Configuring Power Management Support' section in the driver README.
May 08 11:49:14 fedora kernel: nvidia 0000:04:00.0: PM: pci_pm_suspend(): nv_pmops_suspend+0x0/0x30 [nvidia] returns -5
May 08 11:49:14 fedora kernel: nvidia 0000:04:00.0: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x170 returns -5
May 08 11:49:14 fedora kernel: nvidia 0000:04:00.0: PM: failed to suspend async: error -5
May 08 11:49:14 fedora kernel: sd 2:0:0:0: [sdb] Synchronizing SCSI cache
May 08 11:49:14 fedora kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
May 08 11:49:14 fedora kernel: PM: Some devices failed to suspend, or early wake event detected
May 08 11:49:14 fedora kernel: PM: resume devices took 0.857 seconds
May 08 11:49:14 fedora kernel: OOM killer enabled.
May 08 11:49:14 fedora kernel: Restarting tasks ... done.
May 08 11:49:14 fedora kernel: random: crng reseeded on system resumption
May 08 11:49:14 fedora kernel: PM: suspend exit
May 08 11:49:14 fedora kernel: PM: suspend entry (s2idle)
May 08 11:49:14 fedora kernel: Filesystems sync: 0.034 seconds
May 08 11:49:14 fedora kernel: Freezing user space processes
May 08 11:49:14 fedora kernel: Freezing user space processes completed (elapsed 0.002 seconds)
May 08 11:49:14 fedora kernel: OOM killer disabled.
May 08 11:49:14 fedora kernel: Freezing remaining freezable tasks
May 08 11:49:14 fedora kernel: Freezing remaining freezable tasks completed (elapsed 0.003 seconds)
May 08 11:49:14 fedora kernel: printk: Suspending console(s) (use no_console_suspend to debug)
May 08 11:49:14 fedora kernel: NVRM: GPU 0000:04:00.0: PreserveVideoMemoryAllocations module parameter is set. System Power Management attempted without driver procfs suspend interface. Please refer to the 'Configuring Power Management Support' section in the driver README.
May 08 11:49:14 fedora kernel: nvidia 0000:04:00.0: PM: pci_pm_suspend(): nv_pmops_suspend+0x0/0x30 [nvidia] returns -5
May 08 11:49:14 fedora kernel: nvidia 0000:04:00.0: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x170 returns -5
May 08 11:49:14 fedora kernel: nvidia 0000:04:00.0: PM: failed to suspend async: error -5
May 08 11:49:14 fedora kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
May 08 11:49:14 fedora kernel: sd 2:0:0:0: [sdb] Synchronizing SCSI cache
May 08 11:49:14 fedora kernel: PM: Some devices failed to suspend, or early wake event detected
May 08 11:49:14 fedora kernel: PM: resume devices took 0.078 seconds
May 08 11:49:14 fedora kernel: OOM killer enabled.
May 08 11:49:14 fedora kernel: Restarting tasks ... done.
May 08 11:49:14 fedora kernel: random: crng reseeded on system resumption
May 08 11:49:14 fedora kernel: PM: suspend exit
May 08 11:49:17 fedora kernel: rfkill: input handler disabled

My information:

State: idle
AutomaticUpdates: stage; rpm-ostreed-automatic.timer: no runs since boot
Deployments:
● a367027847eae70bb508a4d52b7b02640fae4705c5a0e11ecb3cb63797e0dafb
                Timestamp: 2024-05-01T19:08:49Z

  ostree-image-signed:docker://ghcr.io/ublue-os/bluefin-dx-nvidia:latest
                   Digest: sha256:dc9c027f53ecc1cde1c5bf7b632d2cf16e81256f3a0dda8bd633afaf834f814c
                  Version: 40.20240501.0 (2024-05-01T19:08:49Z)
                   Pinned: yes

Thanks in advance for any help.

I was thinking, that the problem might be caused by some user specific configuration. Creating a new user, I can still reproduce the same behavior:
VSCode → Suspend → kernel_bug → nvidia-sleep.sh failed → log in → cannot even sudo poweroff without --force