Author: avg Date: Mon Feb 16 13:02:00 2015 New Revision: 278849 URL: https://svnweb.freebsd.org/changeset/base/278849
Log: vt: move suspend/resume event handlers registration outside of mutex scope This is to avoid a witness warning about a waiting memory allocation in the evnt hanlder registration code. Reported by: markj MFC after: 3 days X-MFC with: r277795 Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Feb 16 12:56:55 2015 (r278848) +++ head/sys/dev/vt/vt_core.c Mon Feb 16 13:02:00 2015 (r278849) @@ -2518,6 +2518,7 @@ vt_upgrade(struct vt_device *vd) { struct vt_window *vw; unsigned int i; + int register_handlers; if (!vty_enabled(VTY_VT)) return; @@ -2546,6 +2547,7 @@ vt_upgrade(struct vt_device *vd) if (vd->vd_curwindow == NULL) vd->vd_curwindow = vd->vd_windows[VT_CONSWINDOW]; + register_handlers = 0; if (!(vd->vd_flags & VDF_ASYNC)) { /* Attach keyboard. */ vt_allocate_keyboard(vd); @@ -2557,18 +2559,21 @@ vt_upgrade(struct vt_device *vd) vd->vd_flags |= VDF_ASYNC; callout_reset(&vd->vd_timer, hz / VT_TIMERFREQ, vt_timer, vd); vd->vd_timer_armed = 1; + register_handlers = 1; + } + + VT_UNLOCK(vd); + + /* Refill settings with new sizes. */ + vt_resize(vd); + if (register_handlers) { /* Register suspend/resume handlers. */ EVENTHANDLER_REGISTER(power_suspend_early, vt_suspend_handler, vd, EVENTHANDLER_PRI_ANY); EVENTHANDLER_REGISTER(power_resume, vt_resume_handler, vd, EVENTHANDLER_PRI_ANY); } - - VT_UNLOCK(vd); - - /* Refill settings with new sizes. */ - vt_resize(vd); } static void _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"