amdgpu/efifb/vt: panic: malloc: called with spinlock or critical section held on CURRENT

From: Neel Chauhan <nc_at_FreeBSD.org>
Date: Mon, 09 Aug 2021 15:44:30 UTC
Hi current@,

I recently got a AMD Ryzen 4700U (Renoir) based HP Envy x360, mainly to 
replace my Intel TigerLake HP Spectre x360.

When I load amdgpu, I get a blank screen which then gives the following 
kernel panic:

Unread portion of the kernel message buffer:
taskqueue_drain with the following non-sleepable locks held:
exclusive sleep mutex vtdev (vtdev) r = 0 (0xffffffff81aea0a8) locked @ 
/usr/src/sys/dev/vt/vt_core.c:3012
stack backtrace:
#0 0xffffffff80c902e1 at witnespanic: malloc: called with spinlock or 
critical section held
cpuid = 6
time = 1628439111
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfffffe00c1ff4470
vpanic() at vpanic+0x187/frame 0xfffffe00c1ff44d0
panic() at panic+0x43/frame 0xfffffe00c1ff4530
malloc_dbg() at malloc_dbg+0xe2/frame 0xfffffe00c1ff4550
malloc() at malloc+0x30/frame 0xfffffe00c1ff45a0
dcn21_validate_bandwidth() at dcn21_validate_bandwidth+0x7e/frame 
0xfffffe00c1ff4630
dc_validate_global_state() at dc_validate_global_state+0x2cc/frame 
0xfffffe00c1ff4690
amdgpu_dm_atomic_check() at amdgpu_dm_atomic_check+0xee1/frame 
0xfffffe00c1ff4940
drm_atomic_check_only() at drm_atomic_check_only+0x424/frame 
0xfffffe00c1ff49c0
drm_atomic_commit() at drm_atomic_commit+0x13/frame 0xfffffe00c1ff49e0
drm_client_modeset_commit_atomic() at 
drm_client_modeset_commit_atomic+0x148/frame 0xfffffe00c1ff4a50
drm_client_modeset_commit_force() at 
drm_client_modeset_commit_force+0x66/frame 0xfffffe00c1ff4a90
drm_fb_helper_restore_fbdev_mode_unlocked() at 
drm_fb_helper_restore_fbdev_mode_unlocked+0x7a/frame 0xfffffe00c1ff4ac0
taskqueue_run_locked() at taskqueue_run_locked+0xaa/frame 
0xfffffe00c1ff4b40
taskqueue_thread_loop() at taskqueue_thread_loop+0xc2/frame 
0xfffffe00c1ff4b70
fork_exit() at fork_exit+0x80/frame 0xfffffe00c1ff4bb0
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00c1ff4bb0

This happens on both 5.5 from Ports and 5.6-wip.

The full stacktrace is attached (using 5.5).

I have filed the respective bug reports:

  * Bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257707

  * drm-kmod GitHub: https://github.com/freebsd/drm-kmod/issues/101

I've read someone use other Renoir-based systems and it seems they have 
graphics on 5.5.

Linux (a 5.6 kernel) and OpenBSD have working graphics.

It could also be an efifb or vt bug.

For reference, The f3a3b061216 snapshot works with i915kms on Intel 
Haswell on an old PC (I live in WA but am currently with family in NY), 
but not with amdgpu on Renoir. Recompiling/updating my kernel and 
rebuilding drm-kmod didn't work.

-Neel (nc@)