Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Nov 2024 08:12:21 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        "phk@freebsd.org" <phk@FreeBSD.org>, dev-commits-src-main@freebsd.org
Subject:   RE: git: 7749de244014 - main - Add new kern.vt.slow_down tunable.
Message-ID:  <037444AA-53A8-4B28-8568-3E0046C1E251@yahoo.com>
References:  <037444AA-53A8-4B28-8568-3E0046C1E251.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D7749de244014a057b55552ea9d68fd8a=
eb262ea0
>=20
> 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
>=20
>     Add new kern.vt.slow_down tunable.
>    =20
>     On a laptop with no other console devices than the screen, things
>     scroll of the screen faster than eye or camera can capture it.
>    =20
>     This tunable slows the console down and makes it update =
synchronously,
>     so console output continues when timers or interrupts do not.
>    =20
>     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(+)
>=20
> 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=3D"<colorspec>"
>  .Cd kern.vt.fb.default_mode=3D"<X>x<Y>"
>  .Cd kern.vt.fb.modes.<connector>=3D"<X>x<Y>"
> +.Cd kern.vt.slow_down=3D<delay>"
>  .Cd screen.font=3D"<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");
> =20
> +/* 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 =3D (_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 &=3D ~VDF_SPLASH;
>  		vt_flush(vd);
> +	} else if (vt_slow_down > 0) {

That test treats < 0 the same as =3D=3D 0, only > 0 is distinct.

> +		int i, j;
> +		for (i =3D 0; i < vt_slow_down; i++) {
> +			for (j =3D 0; j < 1000; j++)
> +				vt_flush(vd);
> +		}
>  	} else if (!(vd->vd_flags & VDF_ASYNC)) {
>  		vt_flush(vd);
>  	}


=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?037444AA-53A8-4B28-8568-3E0046C1E251>