]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC 303076,303225: Use MTX_SYSINIT for the VESA lock.
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 6 Aug 2016 23:53:33 +0000 (23:53 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 6 Aug 2016 23:53:33 +0000 (23:53 +0000)
commit204999de8cdd2f2ac305b7727011bc0f073126d3
tree04a7025133b5e7e859632b1025016921687bb2e3
parent4b916894c4f0c14535e6d124f3a1a027d33215c5
MFC 303076,303225: Use MTX_SYSINIT for the VESA lock.

303076:
vesa: fix panic on suspend

Fix the following panic seen when migrating a FreeBSD guest on Xen:

panic: mtx_lock() of destroyed mutex @ /usr/src/sys/dev/fb/vesa.c:541
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa4f0
vpanic() at vpanic+0x182/frame 0xfffffe001d2fa570
kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa5e0
__mtx_lock_flags() at __mtx_lock_flags+0x15b/frame 0xfffffe001d2fa630
vesa_bios_save_restore() at vesa_bios_save_restore+0x78/frame 0xfffffe001d2fa680
vga_suspend() at vga_suspend+0xa3/frame 0xfffffe001d2fa6b0
isavga_suspend() at isavga_suspend+0x1d/frame 0xfffffe001d2fa6d0
bus_generic_suspend_child() at bus_generic_suspend_child+0x44/frame
[...]

This is caused because vga_sub_configure (which is called if the VGA adapter
is attached after VESA tried to initialize), points to vesa_configure, which
doesn't initialize the VESA mutex. In order to fix it, make sure
vga_sub_configure points to vesa_load, so that all the needed vesa
components are properly initialized.

303225:
Use MTX_SYSINIT for the VESA lock.

vesa_init_done isn't a reliable guard for the mutex init.  If
vesa_configure() doesn't find valid VESA info it will not set
vesa_init_done, but the lock will remain initialized.  Revert r303076
and use MTX_SYSINIT to deterministically init the lock.

PR: 209203

git-svn-id: svn://svn.freebsd.org/base/stable/9@303808 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/dev/fb/vesa.c