From owner-dev-commits-src-all@freebsd.org Mon Oct 4 03:36:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D275F675910; Mon, 4 Oct 2021 03:36:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HN5wv5Lkvz3H5q; Mon, 4 Oct 2021 03:36:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 975B612719; Mon, 4 Oct 2021 03:36:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1943aVlw095008; Mon, 4 Oct 2021 03:36:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1943aVcN095007; Mon, 4 Oct 2021 03:36:31 GMT (envelope-from git) Date: Mon, 4 Oct 2021 03:36:31 GMT Message-Id: <202110040336.1943aVcN095007@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: c39bfe47139b - stable/13 - vt: call driver's postswitch when panicking on ttyv0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c39bfe47139bac99e5519c22ccde42b2660b6500 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2021 03:36:31 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=c39bfe47139bac99e5519c22ccde42b2660b6500 commit c39bfe47139bac99e5519c22ccde42b2660b6500 Author: Greg V AuthorDate: 2021-04-24 11:53:34 +0000 Commit: Toomas Soome CommitDate: 2021-10-03 21:46:49 +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 Differential Revision: https://reviews.freebsd.org/D29961 (cherry picked from commit c937a405bdce2fd12c534446a8cc9e5548dd27eb) --- 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 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); }