aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg V <greg@unrelenting.technology>2021-04-24 11:53:34 +0000
committerToomas Soome <tsoome@FreeBSD.org>2021-10-03 21:46:49 +0000
commitc39bfe47139bac99e5519c22ccde42b2660b6500 (patch)
treef1e233735fcf2ee6f2b2f441090807abd05d43c5
parente6e348e49c0af43b2aa28db7084912015ccb4172 (diff)
downloadsrc-c39bfe47139bac99e5519c22ccde42b2660b6500.tar.gz
src-c39bfe47139bac99e5519c22ccde42b2660b6500.zip
vt: call driver's postswitch when panicking on ttyv0
In vt_kms, the postswitch callback restores fbdev mode when panicking or entering the debugger. This ensures that even when a graphical applicatino was running on the first tty, simple framebuffer mode would be restored and the panic would be visible instead of the frozen GUI. But vt wouldn't call the postswitch callback when we're already on the first tty, so running a GUI on it would prevent you from reading any panics. Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D29961 (cherry picked from commit c937a405bdce2fd12c534446a8cc9e5548dd27eb)
-rw-r--r--sys/dev/vt/vt_core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index d4baa65f06c9..884050f4f0c5 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -595,7 +595,13 @@ vt_window_switch(struct vt_window *vw)
VT_LOCK(vd);
if (curvw == vw) {
- /* Nothing to do. */
+ /*
+ * Nothing to do, except ensure the driver has the opportunity to
+ * switch to console mode when panicking, making sure the panic
+ * is readable (even when a GUI was using ttyv0).
+ */
+ if ((kdb_active || panicstr) && vd->vd_driver->vd_postswitch)
+ vd->vd_driver->vd_postswitch(vd);
VT_UNLOCK(vd);
return (0);
}