Suspend / Resume issues with the driver version 470 doesn't work on my laptop

The monitor of my Thinkpad P17 Gen 2 laptop is very dark after waking up / resuming from suspend, which is equivalent to being unusable at all. External monitory is ok.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute
$ cat /proc/driver/nvidia/version 
NVRM version: NVIDIA UNIX x86_64 Kernel Module  470.63.01  Tue Aug  3 20:44:16 UTC 2021
GCC version:
$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd000025B8sv000017AAsd000022DEbc03sc00i00
vendor   : NVIDIA Corporation
driver   : nvidia-driver-470-server - distro non-free
driver   : nvidia-driver-460-server - distro non-free
driver   : nvidia-driver-460 - distro non-free
driver   : nvidia-driver-470 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

dmesg:

[  130.074778] RIP: 0010:nv_drm_master_set+0x27/0x30 [nvidia_drm]
[  130.074783] Code: 90 b5 df 0f 1f 44 00 00 55 48 8b 47 48 48 8b 78 20 48 8b 05 bb 6c 00 00 48 89 e5 48 8b 40 28 e8 ef ef f1 df 84 c0 74 02 5d c3 <0f> 0b 5d c3 0f 1f 44 00 00 0f 1f 44 00 00 55 48 89 e5 41 57 41 56
[  130.074785] RSP: 0018:ffff9ee947133b80 EFLAGS: 00010246
[  130.074788] RAX: 0000000000000000 RBX: ffff8c4c5d289200 RCX: 0000000000000008
[  130.074789] RDX: ffffffffc3a3ced8 RSI: 0000000000000292 RDI: ffffffffc3a3cea0
[  130.074791] RBP: ffff9ee947133b80 R08: 0000000000000008 R09: ffff9ee947133b68
[  130.074792] R10: 0000000000000000 R11: ffff8c4b9360991a R12: ffff8c4bdc352900
[  130.074793] R13: ffff8c4b88239800 R14: 0000000000000000 R15: ffff8c4b88239800
[  130.074795] FS:  00007f4e70044c80(0000) GS:ffff8c5c97680000(0000) knlGS:0000000000000000
[  130.074796] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  130.074798] CR2: 00007f4e7074c3ea CR3: 000000019b78a004 CR4: 0000000000770ee0
[  130.074800] PKRU: 55555554
[  130.074801] Call Trace:
[  130.074802]  drm_new_set_master+0x7e/0x100 [drm]
[  130.074822]  drm_master_open+0x6e/0xa0 [drm]
[  130.074842]  drm_open+0xf8/0x250 [drm]
[  130.074863]  drm_stub_open+0xba/0x140 [drm]
[  130.074887]  chrdev_open+0xf7/0x220
[  130.074891]  ? cdev_device_add+0x90/0x90
[  130.074894]  do_dentry_open+0x156/0x370
[  130.074899]  vfs_open+0x2d/0x30
[  130.074904]  do_open+0x1c3/0x340
[  130.074907]  path_openat+0x10a/0x1d0
[  130.074910]  ? psi_group_change+0x42/0x220
[  130.074913]  do_filp_open+0x8c/0x130
[  130.074917]  ? __check_object_size+0x1c/0x20
[  130.074920]  do_sys_openat2+0x9b/0x150
[  130.074925]  __x64_sys_openat+0x56/0x90
[  130.074929]  do_syscall_64+0x38/0x90
[  130.074931]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  130.074935] RIP: 0033:0x7f4e704de8db
[  130.074937] Code: 25 00 00 41 00 3d 00 00 41 00 74 4b 64 8b 04 25 18 00 00 00 85 c0 75 67 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 91 00 00 00 48 8b 4c 24 28 64 48 2b 0c 25
[  130.074939] RSP: 002b:00007ffd8b6e8f10 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
[  130.074942] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f4e704de8db
[  130.074944] RDX: 0000000000000002 RSI: 00007ffd8b6e8fe0 RDI: 00000000ffffff9c
[  130.074945] RBP: 00007ffd8b6e8fe0 R08: 0000000000000000 R09: 00007ffd8b6e8e20
[  130.074946] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
[  130.074948] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[  130.074950] ---[ end trace 891fb0926d35dabc ]---

I have checked out this topic in the forum but to no avail: [FIXED] Suspend / Resume issues with the driver version 470 - #4 by KHTeh

Stack trace in demsg when options nvidia_drm modeset=1 is configured:

[  195.862426] Call Trace:
[  195.862427]  drm_new_set_master+0x7e/0x100 [drm]
[  195.862449]  drm_master_open+0x6e/0xa0 [drm]
[  195.862471]  drm_open+0xf8/0x250 [drm]
[  195.862494]  drm_stub_open+0xba/0x140 [drm]
[  195.862520]  chrdev_open+0xf7/0x220
[  195.862524]  ? cdev_device_add+0x90/0x90
[  195.862527]  do_dentry_open+0x156/0x370
[  195.862531]  vfs_open+0x2d/0x30
[  195.862535]  do_open+0x1c3/0x340
[  195.862538]  path_openat+0x10a/0x1d0
[  195.862541]  ? psi_group_change+0x42/0x220
[  195.862544]  do_filp_open+0x8c/0x130
[  195.862549]  ? __check_object_size+0x1c/0x20
[  195.862552]  do_sys_openat2+0x9b/0x150
[  195.862556]  __x64_sys_openat+0x56/0x90
[  195.862560]  do_syscall_64+0x38/0x90
[  195.862563]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  195.862567] RIP: 0033:0x7ff62edd08db
[  195.862569] Code: 25 00 00 41 00 3d 00 00 41 00 74 4b 64 8b 04 25 18 00 00 00 85 c0 75 67 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 91 00 00 00 48 8b 4c 24 28 64 48 2b 0c 25
[  195.862571] RSP: 002b:00007ffd86c25810 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
[  195.862573] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007ff62edd08db
[  195.862575] RDX: 0000000000000002 RSI: 00007ffd86c258e0 RDI: 00000000ffffff9c
[  195.862576] RBP: 00007ffd86c258e0 R08: 0000000000000000 R09: 00007ffd86c25720
[  195.862578] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
[  195.862579] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[  195.862582] ---[ end trace af495a49ff84593d ]---
``
What's the default and/or recommended for this option? I didn't check before making the change.

Well, a stack trace is most likely a bug.
Run nvidia-bug-report.sh as root after the crash. Attach it here with the laptops model name/number. And also send all that to linux-bugs@nvidia.com.

Also read this:
https://download.nvidia.com/XFree86/Linux-x86_64/470.74/README/configlaptop.html

and this:

https://download.nvidia.com/XFree86/Linux-x86_64/470.74/README/powermanagement.html

Are you using the systemd configuration?

I have updated my laptop model in my original post.

I have removed /lib/systemd/system-sleep/nvidia according to [FIXED] Suspend / Resume issues with the driver version 470 - #3 by humblebee but it doesn’t make any difference at all.

Attached bug report: nvidia-bug-report.log.gz (324.5 KB)

[    2.516641] Missing case (val == 65535)
[    2.516646] WARNING: CPU: 3 PID: 478 at drivers/gpu/drm/i915/intel_dram.c:96 skl_dram_get_dimm_info+0x79/0x1b0 [i915]
[    2.516673] Modules linked in: coretemp(+) mac80211(+) snd_hda_core kvm_intel snd_hwdep nvidia(PO+) libarc4 kvm joydev soundwire_bus nls_iso8859_1 mei_hdcp intel_rapl_msr i915(+) fjes(-) iwlwifi crct10dif_pclmul ghash_clmulni_intel snd_soc_core drm_kms_helper aesni_intel processor_thermal_device snd_compress cec processor_thermal_rfim ac97_bus crypto_simd snd_pcm_dmaengine rc_core i2c_algo_bit cryptd processor_thermal_mbox fb_sys_fops input_leds mei_me thinkpad_acpi glue_helper syscopyarea intel_cstate nvram efi_pstore sysfillrect snd_seq_midi serio_raw wmi_bmof cfg80211 ee1004 ledtrig_audio snd_pcm processor_thermal_rapl ucsi_acpi(+) sysimgblt snd_seq_midi_event mei intel_rapl_common typec_ucsi intel_soc_dts_iosf snd_rawmidi typec snd_seq snd_seq_device snd_timer snd int3403_thermal soundcore int340x_thermal_zone mac_hid intel_hid int3400_thermal sparse_keymap acpi_thermal_rel acpi_pad acpi_tad sch_fq_codel stp llc ip_vs_wrr ip_vs_sh ip_vs_rr ip_vs nf_conntrack nf_defrag_ipv6
[    2.516695]  nf_defrag_ipv4 libcrc32c msr parport_pc ppdev lp drm parport ip_tables x_tables autofs4 crc32_pclmul sdhci_pci psmouse cqhci i2c_i801 i2c_smbus sdhci igc nvme thunderbolt xhci_pci nvme_core xhci_pci_renesas wmi video pinctrl_tigerlake
[    2.516703] CPU: 3 PID: 478 Comm: systemd-udevd Tainted: P        W  O      5.11.0-37-generic #41-Ubuntu
[    2.516704] Hardware name: LENOVO 20YUCTO1WW/20YUCTO1WW, BIOS N37ET34W (1.15 ) 09/01/2021
[    2.516704] RIP: 0010:skl_dram_get_dimm_info+0x79/0x1b0 [i915]
[    2.516730] Code: 0f 84 34 01 00 00 41 f7 c0 00 01 00 00 0f 84 27 01 00 00 41 0f b7 d0 48 c7 c6 b1 6b fd c0 48 c7 c7 b5 6b fd c0 e8 07 1e 7c e1 <0f> 0b 44 0f b7 0b b9 01 00 00 00 31 c0 31 f6 88 43 02 41 c1 ff 09
[    2.516731] RSP: 0018:ffffbe36011b7980 EFLAGS: 00010282
[    2.516732] RAX: 0000000000000000 RBX: ffffbe36011b79fa RCX: ffff9b27574d8ac8
[    2.516732] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff9b27574d8ac0
[    2.516733] RBP: ffffbe36011b79a8 R08: 0000000000000000 R09: ffffbe36011b7760
[    2.516733] R10: ffffbe36011b7758 R11: ffffffffa37535e8 R12: 0000000000000001
[    2.516734] R13: 0000000000000053 R14: ffff9b1645580000 R15: 000000000000ffff
[    2.516735] FS:  00007fb8218a08c0(0000) GS:ffff9b27574c0000(0000) knlGS:0000000000000000
[    2.516735] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    2.516736] CR2: 00007fb8213ae4e0 CR3: 0000000108a5e006 CR4: 0000000000770ee0
[    2.516737] PKRU: 55555554
[    2.516737] Call Trace:
[    2.516737]  skl_dram_get_channel_info+0x45/0x150 [i915]
[    2.516763]  skl_dram_get_channels_info+0xa5/0x190 [i915]
[    2.516787]  skl_get_dram_info+0x6e/0x100 [i915]
[    2.516815]  intel_dram_detect+0x3e/0xd0 [i915]
[    2.516843]  i915_driver_hw_probe+0x1cc/0x210 [i915]
[    2.516875]  i915_driver_probe+0xe5/0x2f0 [i915]
[    2.516905]  ? mutex_lock+0x13/0x40
[    2.516907]  ? acpi_dev_found+0x66/0x70
[    2.516909]  i915_pci_probe+0x58/0x140 [i915]
[    2.516939]  local_pci_probe+0x48/0x80
[    2.516941]  pci_call_probe+0x53/0xf0
[    2.516943]  pci_device_probe+0xad/0xf0
[    2.516945]  really_probe+0x23a/0x4a0
[    2.516947]  driver_probe_device+0xe9/0x160
[    2.516949]  device_driver_attach+0xab/0xb0
[    2.516952]  __driver_attach+0x8f/0x150
[    2.516954]  ? device_driver_attach+0xb0/0xb0
[    2.516956]  bus_for_each_dev+0x7e/0xc0
[    2.516958]  driver_attach+0x1e/0x20
[    2.516959]  bus_add_driver+0x135/0x1f0
[    2.516961]  driver_register+0x95/0xf0
[    2.516963]  __pci_register_driver+0x54/0x60
[    2.516964]  i915_init+0x66/0x86 [i915]
[    2.517011]  ? 0xffffffffc0c70000
[    2.517012]  do_one_initcall+0x48/0x1d0
[    2.517014]  ? kmem_cache_alloc_trace+0xf6/0x200
[    2.517016]  ? do_init_module+0x28/0x290
[    2.517018]  do_init_module+0x62/0x290
[    2.517020]  load_module+0x6fd/0x780
[    2.517021]  __do_sys_finit_module+0xc2/0x120
[    2.517024]  __x64_sys_finit_module+0x1a/0x20
[    2.517025]  do_syscall_64+0x38/0x90
[    2.517027]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[    2.517029] RIP: 0033:0x7fb821d58f6d
[    2.517030] Code: 28 0d 00 0f 05 eb a9 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d cb de 0c 00 f7 d8 64 89 01 48
[    2.517031] RSP: 002b:00007ffdf53714c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[    2.517033] RAX: ffffffffffffffda RBX: 000055d26ae00800 RCX: 00007fb821d58f6d
[    2.517034] RDX: 0000000000000000 RSI: 00007fb821efee2d RDI: 0000000000000016
[    2.517035] RBP: 0000000000020000 R08: 0000000000000000 R09: 000055d269ece89d
[    2.517035] R10: 0000000000000016 R11: 0000000000000246 R12: 00007fb821efee2d
[    2.517037] R13: 0000000000000000 R14: 000055d26ae04ca0 R15: 000055d26ae00800
[    2.517038] ---[ end trace 5a1250b97f82d1b8 ]---

Well, that’s the intel driver crashing.

It works now after upgrading to Ubuntu 21.10