tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: highlighted kernel messages on serial console



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
from a single kernel printf, but in between them I expect that it is
possible.

> Though... sometimes two problems can provide an opportunity.
> 
> 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.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index