Kernel error is still occurring with a patched kernel on a fresh Manjaro install

Hello, I would like to ask your help to fix this issue, I have tried my best but seems out of reach for my skills.
I have been trying to enable HDMI out on my laptop (Ryzen 7 4800h + Nvidia RTX 2060) without success.
journalctl was showing the following error when I connected the external screen.

Nov 18 12:48:25 legion5P kernel: ------------[ cut here ]------------
Nov 18 12:48:25 legion5P kernel: Unhandled error in __nv_drm_gem_user_memory_handle_vma_fault: -22
Nov 18 12:48:25 legion5P kernel: WARNING: CPU: 13 PID: 1595 at /storage/manjaro/makepkg/linux59-nvidia->
Nov 18 12:48:25 legion5P kernel: Modules linked in: ccm rfcomm fuse cmac algif_hash algif_skcipher af_a>
Nov 18 12:48:25 legion5P kernel:  cec rc_core drm agpgart syscopyarea sysfillrect sysimgblt fb_sys_fops>
Nov 18 12:48:25 legion5P kernel: CPU: 13 PID: 1595 Comm: Xorg Tainted: P           OE     5.9.8-2-MANJA>
Nov 18 12:48:25 legion5P kernel: Hardware name: LENOVO 82GU/LNVNB161216, BIOS FSCN09WW 06/28/2020
Nov 18 12:48:25 legion5P kernel: RIP: 0010:__nv_drm_gem_user_memory_handle_vma_fault+0x8c/0x90 [nvidia_>
Nov 18 12:48:25 legion5P kernel: Code: 41 bc 00 01 00 00 44 89 e0 41 5c c3 0f 0b 89 c2 48 c7 c6 80 d6 0>
Nov 18 12:48:25 legion5P kernel: RSP: 0018:ffffad7340d03b78 EFLAGS: 00010286
Nov 18 12:48:25 legion5P kernel: RAX: 0000000000000000 RBX: ffffad7340d03bc8 RCX: 0000000000000000
Nov 18 12:48:25 legion5P kernel: RDX: 0000000000000001 RSI: ffffffffb2b8941a RDI: 00000000ffffffff
Nov 18 12:48:25 legion5P kernel: RBP: ffff961954d6a578 R08: 000000000000051f R09: 0000000000000001
Nov 18 12:48:25 legion5P kernel: R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000002
Nov 18 12:48:25 legion5P kernel: R13: 0000000000000000 R14: ffff961954d6a578 R15: ffffad7340d03bc8
Nov 18 12:48:25 legion5P kernel: FS:  00007f30b43b6540(0000) GS:ffff9619af740000(0000) knlGS:0000000000>
Nov 18 12:48:25 legion5P kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Nov 18 12:48:25 legion5P kernel: CR2: 0000557ce4b06db0 CR3: 00000007bb5ae000 CR4: 0000000000350ee0
Nov 18 12:48:25 legion5P kernel: Call Trace:
Nov 18 12:48:25 legion5P kernel:  __do_fault+0x38/0xd0
Nov 18 12:48:25 legion5P kernel:  handle_mm_fault+0x1496/0x1a40
Nov 18 12:48:25 legion5P kernel:  __get_user_pages+0x25f/0x7c0
Nov 18 12:48:25 legion5P kernel:  __gup_longterm_locked+0x61/0x1e0
Nov 18 12:48:25 legion5P kernel:  os_lock_user_pages+0xa5/0x190 [nvidia]
Nov 18 12:48:25 legion5P kernel:  _nv000635rm+0x7a/0xf0 [nvidia]
Nov 18 12:48:25 legion5P kernel:  ? _nv000710rm+0x70c/0x880 [nvidia]
Nov 18 12:48:25 legion5P kernel:  ? _raw_spin_unlock_irqrestore+0x20/0x40
Nov 18 12:48:25 legion5P kernel:  ? rm_ioctl+0x54/0xb0 [nvidia]
Nov 18 12:48:25 legion5P kernel:  ? nvidia_ioctl+0x5b7/0x900 [nvidia]
Nov 18 12:48:25 legion5P kernel:  ? nvidia_frontend_unlocked_ioctl+0x37/0x50 [nvidia]
Nov 18 12:48:25 legion5P kernel:  ? __x64_sys_ioctl+0x83/0xb0
Nov 18 12:48:25 legion5P kernel:  ? do_syscall_64+0x33/0x40
Nov 18 12:48:25 legion5P kernel:  ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
Nov 18 12:48:25 legion5P kernel: ---[ end trace bb42f144c1da021f ]---
Nov 18 12:48:25 legion5P kernel: Cannot map memory with base addr 0x7f30372ca000 and size of 0x8ca pages

After reading the forums, I decided to attempt with a custom kernel.

I tried to apply the patch mentioned here.
Which I could not find in the log for v5.9.y, I guess it has not been applied yet.
According to this thread at nvidia’s forum, the patch is relevant for my problem.

To apply the patch, I followed a combination of this manjaro-based guide and this arch-based guide, as follows,

  1. cloned the package repo for v5.9 from manjaro’s gitlab
  2. added a new file with the patch I needed
  3. added an entry to the PKGBUILD file to include the new file
  4. updated the sha512 sums array by executing: makepkg -g >> PKGBUILD
  5. checked that the sha512 sums array was increased by 1 element
  6. executed makepkg -Csf to compile with the patches applied
  7. executed sudo pacman -U on the file generated linux59-5.9.8-2-x86_64.pkg.tar.zst
  8. rebooted, selected the new kernel, the system boots but there is no video
  9. reinstalled the nvidia drivers: mhwd -a pci nonfree 0300 -f
  10. rebooted, selected the new kernel, log in

Then, I plugged the HDMI, the screen never turned on and saw the error appear in the journal again. (I am omitting the message for brevity but have it at hand if needed).

On a second attempt, I added -march=native to /etc/makepkg.conf
and changed in config
CONFIG_TRANSPARENT_HUGEPAGE=y
to
CONFIG_TRANSPARENT_HUGEPAGE=n
and executed again from number 6 from above.

After rebooting, I plugged the HDMI monitor but still the screen does not change. Checking the journal, I see the error is occuring again.

I can see nvidia drivers are installed, and it seems like hybrid graphics should be working

$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD RENOIR (DRM 3.39.0, 5.9.8-2-MANJARO, LLVM 11.0.0)
$ prime-run glxinfo | grep "OpenGL renderer"
OpenGL renderer string: GeForce RTX 2060/PCIe/SSE2

I have tried with other kernels (v5.4, v5.4-rt, v5.6, v5.7, v5.8, v5.9 (stock), v5.9-rt, v5.10) and found that only v5.6 worked great but is now deprecated.

So, I cannot fix this, I have lost a couple of days trying and I would really like to solve it.
Any help would be greately appreciated

For reference, the final error message recorded in the journal follows,

Nov 18 16:55:28 legion5P kernel: ------------[ cut here ]------------
Nov 18 16:55:28 legion5P kernel: Unhandled error in __nv_drm_gem_user_memory_handle_vma_fault: -22
Nov 18 16:55:28 legion5P kernel: WARNING: CPU: 10 PID: 1320 at /storage/manjaro/makepkg/linux59-nvidia-455xx/src/NVIDIA-Linux-x86_64-455.45.01-no-compat32/kernel/nvidia-drm/nvidia-drm-gem-u>
Nov 18 16:55:28 legion5P kernel: Modules linked in: ccm rfcomm fuse cmac algif_hash algif_skcipher af_alg bnep btusb btrtl btbcm btintel bluetooth hid_logitech_hidpp ecdh_generic ecc crc16 >
Nov 18 16:55:28 legion5P kernel:  cec rc_core drm agpgart syscopyarea sysfillrect sysimgblt fb_sys_fops nvidia(POE) crypto_user ip_tables x_tables btrfs blake2b_generic libcrc32c crc32c_gen>
Nov 18 16:55:28 legion5P kernel: CPU: 10 PID: 1320 Comm: Xorg Tainted: P           OE     5.9.8-2-MANJARO #1
Nov 18 16:55:28 legion5P kernel: Hardware name: LENOVO 82GU/LNVNB161216, BIOS FSCN09WW 06/28/2020
Nov 18 16:55:28 legion5P kernel: RIP: 0010:__nv_drm_gem_user_memory_handle_vma_fault+0x8c/0x90 [nvidia_drm]
Nov 18 16:55:28 legion5P kernel: Code: 41 bc 00 01 00 00 44 89 e0 41 5c c3 0f 0b 89 c2 48 c7 c6 80 d6 39 c0 48 c7 c7 cb d8 39 c0 c6 05 8d 7b 00 00 01 e8 31 e7 44 f8 <0f> 0b eb cc 0f 1f 44 0>
Nov 18 16:55:28 legion5P kernel: RSP: 0018:ffffb03900cdbb78 EFLAGS: 00010286
Nov 18 16:55:28 legion5P kernel: RAX: 0000000000000000 RBX: ffffb03900cdbbc8 RCX: 0000000000000000
Nov 18 16:55:28 legion5P kernel: RDX: 0000000000000001 RSI: ffffffffb918941a RDI: 00000000ffffffff
Nov 18 16:55:28 legion5P kernel: RBP: ffff9d8871649838 R08: 000000000000050c R09: 0000000000000001
Nov 18 16:55:28 legion5P kernel: R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000002
Nov 18 16:55:28 legion5P kernel: R13: 0000000000000000 R14: ffff9d8871649838 R15: ffffb03900cdbbc8
Nov 18 16:55:28 legion5P kernel: FS:  00007f338a83c540(0000) GS:ffff9d88af680000(0000) knlGS:0000000000000000
Nov 18 16:55:28 legion5P kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Nov 18 16:55:28 legion5P kernel: CR2: 000055c3b6ac5850 CR3: 00000007c39c8000 CR4: 0000000000350ee0
Nov 18 16:55:28 legion5P kernel: Call Trace:
Nov 18 16:55:28 legion5P kernel:  __do_fault+0x38/0xd0
Nov 18 16:55:28 legion5P kernel:  handle_mm_fault+0x1496/0x1a40
Nov 18 16:55:28 legion5P kernel:  __get_user_pages+0x25f/0x7c0
Nov 18 16:55:28 legion5P kernel:  __gup_longterm_locked+0x61/0x1e0
Nov 18 16:55:28 legion5P kernel:  os_lock_user_pages+0xa5/0x190 [nvidia]
Nov 18 16:55:28 legion5P kernel:  _nv000635rm+0x7a/0xf0 [nvidia]
Nov 18 16:55:28 legion5P kernel:  ? _nv000710rm+0x70c/0x880 [nvidia]
Nov 18 16:55:28 legion5P kernel:  ? _raw_spin_unlock_irqrestore+0x20/0x40
Nov 18 16:55:28 legion5P kernel:  ? rm_ioctl+0x54/0xb0 [nvidia]
Nov 18 16:55:28 legion5P kernel:  ? nvidia_ioctl+0x5b7/0x900 [nvidia]
Nov 18 16:55:28 legion5P kernel:  ? nvidia_frontend_unlocked_ioctl+0x37/0x50 [nvidia]
Nov 18 16:55:28 legion5P kernel:  ? __x64_sys_ioctl+0x83/0xb0
Nov 18 16:55:28 legion5P kernel:  ? do_syscall_64+0x33/0x40
Nov 18 16:55:28 legion5P kernel:  ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
Nov 18 16:55:28 legion5P kernel: ---[ end trace 3bb15a554f2c6903 ]---
Nov 18 16:55:28 legion5P kernel: Cannot map memory with base addr 0x7f3325736000 and size of 0x8ca pages

You seem to have managed to solve it, correct?

Sorry for the wait, I did solve the problem and wrote an entry on my personal blog for reference. Hope if helps.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.