vtterm_cngrab + kms does too much to be useful

Andriy Gapon avg at FreeBSD.org
Mon Aug 15 13:55:43 UTC 2016

Here is an example:

NMI ... going to debugger

panic: malloc: called with spinlock or critical section held

(kgdb) bt
#0  doadump (textdump=1) at /usr/src/sys/kern/kern_shutdown.c:297
#1  0xffffffff8063c33f in kern_reboot (howto=<optimized out>) at
#2  0xffffffff8063c988 in vpanic (fmt=<optimized out>, ap=0xfffffe03e218cac0) at
#3  0xffffffff8063c693 in panic (fmt=<unavailable>) at
#4  0xffffffff8061abaa in malloc (size=5136, mtp=0xffffffff821b2810
<DRM_MEM_KMS>, flags=257) at /usr/src/sys/kern/kern_malloc.c:475
#5  0xffffffff821849ea in drm_crtc_helper_set_config (set=0xfffff800282b4a00) at
#6  0xffffffff8218a03e in drm_fb_helper_restore_fbdev_mode (fb_helper=<optimized
out>) at /usr/src/sys/modules/drm2/drm2/../../../dev/drm2/drm_fb_helper.c:344
#7  0xffffffff82189efc in vt_kms_postswitch (arg=<unavailable>) at
#8  0xffffffff805237ba in vt_fb_postswitch (vd=<optimized out>) at
#9  0xffffffff805290fd in vt_window_switch (vw=0xffffffff80c4e4c0
<vt_conswindow>) at /usr/src/sys/dev/vt/vt_core.c:540
#10 0xffffffff80527410 in vtterm_cngrab (tm=<optimized out>) at
#11 0xffffffff806868fe in termcn_cngrab (cp=<optimized out>) at
#12 0xffffffff805e8ef2 in cngrab () at /usr/src/sys/kern/kern_cons.c:368
#13 0xffffffff8067399e in kdb_trap (type=19, code=0, tf=0xfffffe03e218cf30) at
#14 0xffffffff8083e2bc in trap (frame=0xfffffe03e218cf30) at

I do not have any solution for this.
It's certainly nice to be able to switch to console when kdb becomes active.
But the code that does switching should be prepared to work in the rather
restrictive context.  Which the kms code is not.

P.S. It seems that the latest version of drm_fb_helper.c in Linux is quite
different from what we have.

Andriy Gapon

More information about the freebsd-current mailing list