Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Sep 2021 18:07:37 GMT
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c937a405bdce - main - vt: call driver's postswitch when panicking on ttyv0
Message-ID:  <202109201807.18KI7bbK034186@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tsoome:

URL: https://cgit.FreeBSD.org/src/commit/?id=c937a405bdce2fd12c534446a8cc9e5548dd27eb

commit c937a405bdce2fd12c534446a8cc9e5548dd27eb
Author:     Greg V <greg@unrelenting.technology>
AuthorDate: 2021-04-24 11:53:34 +0000
Commit:     Toomas Soome <tsoome@FreeBSD.org>
CommitDate: 2021-09-20 17:29:37 +0000

    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
    MFC after:      2 weeks
    Differential Revision: https://reviews.freebsd.org/D29961
---
 sys/dev/vt/vt_core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 2693c32d45be..fac1ad898db9 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -594,7 +594,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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109201807.18KI7bbK034186>