Re: highlighted kernel messages on serial console

Rhialto <[email protected]> Mon, 3 Aug 2026 11:55:42 +0200
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
--izFc9QniMGZnTDu7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun 02 Aug 2026 at 20:59:56 +0100, David Brownlee wrote:
> There is a further complication that sometimes a message line may come
> from multiple print statements.

I suppose that also is the opportunity for userland output to get mixed
in. I don't expect that userland output will get mixed into the text
=66rom a single kernel printf, but in between them I expect that it is
possible.

> Though... sometimes two problems can provide an opportunity.
>=20
> Could the kernel print mechanism use the presence of \n in output to
> track lines?
> Add an inLine boolean to track.
> If false, send the start sequence and switch to true.
> On detection of \n switch to false and output end sequence
> (potentially skipping the \n in the output)

With potentially interspersed userland output we might need to take the
idea even further and have 4 different character sequences:

- start of kernel output line (as before)
- end of kernel output line (as before)
- end of kernel output but not end of line (implying start of
  interspersed userland output)
- restart of kernel output not at the start of a line (implying end of
  interspersed userland output)

Alternatively, we only output the "begin kernel output" and "end kernel
output" on kernel/userland text boundaries, regardless of line endings.
In that case, the serial console output driver at some level needs to
keep track of whether it is outputting kernel or userland text, and add
the sequences accordingly when it changes. That way, a kernel line that
is output in multiple pieces won't get unneeded sequences inserted.

> David
-Olaf.
--=20
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose

--izFc9QniMGZnTDu7
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQFPBAEBCAA5FiEEFVAhiiWjqgwBVdQAmYnGRWHD+9MFAmpwZZobFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwzAAoJEJmJxkVhw/vTX84H/0VrpgJjbIw0cYOrjMZj
4lLoCxH2s8reidlQDdDolqOZoUSp863Mjez7mA0sDAZyQcX37/p4woZkwZq4yHSv
eIqW5kQImPYPSE1cXtNRJ/B7pgxeTCPStvQ/8d0/t504BkfDevEpirZS5wEl069W
Ls/BNyaP0jbG+SIVSJrZ2jU9aQdw290S4chW08mT61zoIdo+mBaCvzojiGfzBDEl
fGGYO0PkCOb2EHrUkMbNwdg1U0kkB9p8igiQ+ZqHzeVdCgkCElaCtMZTGTWenY1N
+JKpGZSoTJI0Ml3sdEtvm2qLfkWkcXkRFln2trJWqc1siZQLVJIKnZH0WwF3yQpf
V60=
=exIa
-----END PGP SIGNATURE-----

--izFc9QniMGZnTDu7--