Kernel NULL pointer dereference on Ubuntu 21.04 after suspend

Hiya. I’m having an issue getting my suspend to resume from suspend. This is since switching to an LG OLED display as a main monitor connected via HDMI. I have a second monitor connected via DisplayPort. What I have found is if my system is suspended and I come back to resume the system by pressing the keyboard or moving the mouse, if my OLED display is off (because it has turned itself off independently) then my machine will lock up with the kernel NULL pointer dereference in the logs.

So I always made sure to turn my display on before resuming.

But now it seems like it’s also happening when the display is on already with the same error.

When this happens I’m still able to SSH to the machine and use it remotely, but just unable to get the display to work.

Sep  8 09:42:58 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-2: disconnected
Sep  8 09:42:58 ludobox kernel: [ 5072.079748] BUG: kernel NULL pointer dereference, address: 0000000000000000
Sep  8 09:42:58 ludobox kernel: [ 5072.079755] #PF: supervisor read access in kernel mode
Sep  8 09:42:58 ludobox kernel: [ 5072.079758] #PF: error_code(0x0000) - not-present page
Sep  8 09:42:58 ludobox kernel: [ 5072.079760] PGD 0 P4D 0 
Sep  8 09:42:58 ludobox kernel: [ 5072.079763] Oops: 0000 [#1] SMP NOPTI
Sep  8 09:42:58 ludobox kernel: [ 5072.079766] CPU: 72 PID: 3308 Comm: Xorg Tainted: P           OE     5.11.0-34-generic #36-Ubuntu
Sep  8 09:42:58 ludobox kernel: [ 5072.079770] Hardware name: ASUS System Product Name/Pro WS WRX80E-SAGE SE WIFI, BIOS 0504 06/02/2021
Sep  8 09:42:58 ludobox kernel: [ 5072.079772] RIP: 0010:_nv002189kms+0x12/0x30 [nvidia_modeset]
Sep  8 09:42:58 ludobox kernel: [ 5072.079808] Code: c0 48 85 d2 74 07 80 7a 08 00 0f 95 c0 f3 c3 66 0f 1f 84 00 00 00 00 00 48 8b 87 20 7f 00 00 40 84 f6 40 0f 95 c6 40 0f b6 f6 <48> 8b 38 48 8b 07 48 8b 80 10 01 00 00 e9 1c 86 88 ef 66 2e 0f 1f
Sep  8 09:42:58 ludobox kernel: [ 5072.079811] RSP: 0018:ffffb666458f7ce0 EFLAGS: 00010246
Sep  8 09:42:58 ludobox kernel: [ 5072.079814] RAX: 0000000000000000 RBX: ffffb66648f4b008 RCX: 0000000000000001
Sep  8 09:42:58 ludobox kernel: [ 5072.079817] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffb66648f4b008
Sep  8 09:42:58 ludobox kernel: [ 5072.079818] RBP: ffffb6664158e058 R08: 0000000000000000 R09: 0000000000000be8
Sep  8 09:42:58 ludobox kernel: [ 5072.079820] R10: ffff9e541ed4c008 R11: 0000000000010004 R12: ffff9e541ee02008
Sep  8 09:42:58 ludobox kernel: [ 5072.079822] R13: 0000000000000001 R14: ffffb6664158d008 R15: ffffb6664158d828
Sep  8 09:42:58 ludobox kernel: [ 5072.079824] FS:  00007f8caed23a40(0000) GS:ffff9e91fe000000(0000) knlGS:0000000000000000
Sep  8 09:42:58 ludobox kernel: [ 5072.079827] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Sep  8 09:42:58 ludobox kernel: [ 5072.079829] CR2: 0000000000000000 CR3: 00000001c1858000 CR4: 0000000000350ee0
Sep  8 09:42:58 ludobox kernel: [ 5072.079831] Call Trace:
Sep  8 09:42:58 ludobox kernel: [ 5072.079833]  ? _nv002198kms+0x1ed/0x220 [nvidia_modeset]
Sep  8 09:42:58 ludobox kernel: [ 5072.079866]  ? _nv002567kms+0x119b/0x1a80 [nvidia_modeset]
Sep  8 09:42:58 ludobox kernel: [ 5072.079897]  ? __check_object_size.part.0+0x4a/0x150
Sep  8 09:42:58 ludobox kernel: [ 5072.079903]  ? _nv000562kms+0x50/0x50 [nvidia_modeset]
Sep  8 09:42:58 ludobox kernel: [ 5072.079928]  ? nvKmsIoctl+0x96/0x1d0 [nvidia_modeset]
Sep  8 09:42:58 ludobox kernel: [ 5072.079953]  ? nvkms_ioctl+0x107/0x180 [nvidia_modeset]
Sep  8 09:42:58 ludobox kernel: [ 5072.079978]  ? nvidia_frontend_unlocked_ioctl+0x3b/0x50 [nvidia]
Sep  8 09:42:58 ludobox kernel: [ 5072.080304]  ? __x64_sys_ioctl+0x91/0xc0
Sep  8 09:42:58 ludobox kernel: [ 5072.080309]  ? do_syscall_64+0x38/0x90
Sep  8 09:42:58 ludobox kernel: [ 5072.080313]  ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
Sep  8 09:42:58 ludobox kernel: [ 5072.080318] Modules linked in: rfcomm xt_conntrack nft_chain_nat xt_MASQUERADE nf_nat nf_conntrack_netlink nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xfrm_user nft_counter xt_addrtype nft_compat br_netfilter bridge stp llc nf_tables libcrc32c nfnetlink cmac algif_hash algif_skcipher af_alg overlay bnep binfmt_misc intel_rapl_msr intel_rapl_common amd64_edac_mod edac_mce_amd amd_energy kvm_amd kvm crct10dif_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper rapl eeepc_wmi efi_pstore ipmi_ssif wmi_bmof nvidia_uvm(POE) nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg soundwire_intel soundwire_generic_allocation soundwire_cadence snd_hda_codec snd_hda_core soundwire_bus nls_iso8859_1 snd_soc_core uvcvideo videobuf2_vmalloc snd_compress videobuf2_memops btusb ac97_bus videobuf2_v4l2 btrtl snd_pcm_dmaengine iwlmvm snd_usb_audio btbcm videobuf2_common btintel snd_usbmidi_lib snd_seq_midi bluetooth ast videodev snd_hwdep
Sep  8 09:42:58 ludobox kernel: [ 5072.080380]  snd_seq_midi_event mac80211 drm_vram_helper ecdh_generic drm_ttm_helper input_leds joydev ecc snd_pcm mc snd_rawmidi libarc4 ttm snd_seq drm_kms_helper snd_seq_device cec snd_timer iwlwifi rc_core i2c_algo_bit fb_sys_fops snd syscopyarea sysfillrect ccp soundcore sysimgblt cfg80211 mxm_wmi k10temp acpi_ipmi ipmi_si ipmi_devintf ipmi_msghandler mac_hid sch_fq_codel nct6775 hwmon_vid msr parport_pc ppdev lp parport drm ip_tables x_tables autofs4 hid_microsoft ff_memless hid_generic usbhid hid crc32_pclmul asus_wmi sparse_keymap video ixgbe xfrm_algo mfd_aaeon ahci dca mdio libahci nvme nvme_core xhci_pci xhci_pci_renesas i2c_piix4 wmi
Sep  8 09:42:58 ludobox kernel: [ 5072.080436] CR2: 0000000000000000
Sep  8 09:42:58 ludobox kernel: [ 5072.080439] ---[ end trace d5255af0adfca2d3 ]---
Sep  8 09:42:58 ludobox kernel: [ 5072.087110] RIP: 0010:_nv002189kms+0x12/0x30 [nvidia_modeset]
Sep  8 09:42:58 ludobox kernel: [ 5072.087146] Code: c0 48 85 d2 74 07 80 7a 08 00 0f 95 c0 f3 c3 66 0f 1f 84 00 00 00 00 00 48 8b 87 20 7f 00 00 40 84 f6 40 0f 95 c6 40 0f b6 f6 <48> 8b 38 48 8b 07 48 8b 80 10 01 00 00 e9 1c 86 88 ef 66 2e 0f 1f
Sep  8 09:42:58 ludobox kernel: [ 5072.087149] RSP: 0018:ffffb666458f7ce0 EFLAGS: 00010246
Sep  8 09:42:58 ludobox kernel: [ 5072.087152] RAX: 0000000000000000 RBX: ffffb66648f4b008 RCX: 0000000000000001
Sep  8 09:42:58 ludobox kernel: [ 5072.087154] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffb66648f4b008
Sep  8 09:42:58 ludobox kernel: [ 5072.087156] RBP: ffffb6664158e058 R08: 0000000000000000 R09: 0000000000000be8
Sep  8 09:42:58 ludobox kernel: [ 5072.087158] R10: ffff9e541ed4c008 R11: 0000000000010004 R12: ffff9e541ee02008
Sep  8 09:42:58 ludobox kernel: [ 5072.087160] R13: 0000000000000001 R14: ffffb6664158d008 R15: ffffb6664158d828
Sep  8 09:42:58 ludobox kernel: [ 5072.087162] FS:  00007f8caed23a40(0000) GS:ffff9e91fe000000(0000) knlGS:0000000000000000
Sep  8 09:42:58 ludobox kernel: [ 5072.087164] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Sep  8 09:42:58 ludobox kernel: [ 5072.087166] CR2: 0000000000000000 CR3: 00000001c1858000 CR4: 0000000000350ee0
Sep  8 09:42:58 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-2: Internal TMDS
Sep  8 09:42:58 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-2: 165.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-0: disconnected
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-0: Internal DisplayPort
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-0: 2670.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-1: disconnected
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-1: Internal TMDS
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-1: 165.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-2: disconnected
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-2: Internal TMDS
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-2: 165.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): BenQ LCD (DFP-3): connected
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): BenQ LCD (DFP-3): Internal DisplayPort
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): BenQ LCD (DFP-3): 2670.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-4: disconnected
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-4: Internal TMDS
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-4: 165.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-5: disconnected
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-5: Internal TMDS
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-5: 165.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-6: disconnected
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-6: Internal DisplayPort
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-6: 2670.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-7: disconnected
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-7: Internal TMDS
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0): DFP-7: 165.0 MHz maximum pixel clock
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (--) NVIDIA(GPU-0):
Sep  8 09:42:59 ludobox /usr/libexec/gdm-x-session[3308]: (II) NVIDIA(0): Setting mode "NULL"
Sep  8 09:44:22 ludobox systemd[1]: Started Session 15 of user ludo.
Sep  8 09:45:01 ludobox CRON[98068]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)

I’m on Ubuntu 21.04 with an Nvidia 3090 RTX GPU and driver 470.57.02. Motherboard is an ASUS Pro WS WRX80E-SAGE

Any ideas on how to troubleshoot this would be welcome. Thanks!