RE: git: 7749de244014 - main - Add new kern.vt.slow_down tunable.
Date: Sat, 23 Nov 2024 16:12:21 UTC
Poul-Henning Kamp <phk_at_FreeBSD.org> wrote on Date: Sat, 23 Nov 2024 15:03:55 UTC : > The branch main has been updated by phk: > > URL: https://cgit.FreeBSD.org/src/commit/?id=7749de244014a057b55552ea9d68fd8aeb262ea0 > > commit 7749de244014a057b55552ea9d68fd8aeb262ea0 > Author: Poul-Henning Kamp <phk@FreeBSD.org> > AuthorDate: 2024-11-23 15:01:09 +0000 > Commit: Poul-Henning Kamp <phk@FreeBSD.org> > CommitDate: 2024-11-23 15:01:09 +0000 > > Add new kern.vt.slow_down tunable. > > On a laptop with no other console devices than the screen, things > scroll of the screen faster than eye or camera can capture it. > > This tunable slows the console down and makes it update synchronously, > so console output continues when timers or interrupts do not. > > Differential Revision: https://reviews.freebsd.org/D47710 > --- > share/man/man4/vt.4 | 11 +++++++++++ > sys/dev/vt/vt_core.c | 9 +++++++++ > 2 files changed, 20 insertions(+) > > diff --git a/share/man/man4/vt.4 b/share/man/man4/vt.4 > index 4c115b68a80d..d3d3c4b38013 100644 > --- a/share/man/man4/vt.4 > +++ b/share/man/man4/vt.4 > @@ -50,6 +50,7 @@ In > .Cd kern.vt.color.<colornum>.rgb="<colorspec>" > .Cd kern.vt.fb.default_mode="<X>x<Y>" > .Cd kern.vt.fb.modes.<connector>="<X>x<Y>" > +.Cd kern.vt.slow_down=<delay>" > .Cd screen.font="<X>x<Y>" > .Pp > In > @@ -266,6 +267,16 @@ It will contain a list of connectors and their associated tunables. > This is currently only supported by the > .Cm vt_fb > backend when it is paired with a KMS video driver. > +.It Va kern.vt.slow_down > +When debugging the kernel on modern laptops, the screen is often > +the only available console, and relevant information will scroll > +out of view before it can be captured by eye or camera. > +.Pp > +Setting > +.Va kern.vt.slow_down > +to a non-zero number Seems to not be true in the code for: less than 0. I've no clue which is intended to be the intent: the wording above or the code below. > will make console output synchronous (ie: > +not dependent on timers and interrupts) and slow it down in proportion > +to the number. > .It Va screen.font > Set this value to the base name of the desired font file located in > .Pa /boot/fonts . > diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c > index 87020b6e6f19..1be98466112e 100644 > --- a/sys/dev/vt/vt_core.c > +++ b/sys/dev/vt/vt_core.c > @@ -132,6 +132,9 @@ static VT_SYSCTL_INT(debug, 0, "vt(9) debug level"); > static VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode"); > static VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend"); > > +/* Slow down and dont rely on timers and interrupts */ > +static VT_SYSCTL_INT(slow_down, 0, "Non-zero make console slower and synchronous."); I see in sys/dev/vt/vt.h : #define VT_SYSCTL_INT(_name, _default, _descr) \ int vt_##_name = (_default); \ SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RWTUN, &vt_##_name, 0, _descr) so vt_slow_down has a signed value (int type, not unsigned int type). > + > /* Allow to disable some keyboard combinations. */ > static VT_SYSCTL_INT(kbd_halt, 1, "Enable halt keyboard combination. " > "See kbdmap(5) to configure."); > @@ -1657,6 +1660,12 @@ vtterm_done(struct terminal *tm) > } > vd->vd_flags &= ~VDF_SPLASH; > vt_flush(vd); > + } else if (vt_slow_down > 0) { That test treats < 0 the same as == 0, only > 0 is distinct. > + int i, j; > + for (i = 0; i < vt_slow_down; i++) { > + for (j = 0; j < 1000; j++) > + vt_flush(vd); > + } > } else if (!(vd->vd_flags & VDF_ASYNC)) { > vt_flush(vd); > } === Mark Millard marklmi at yahoo.com