Re: linux.git: printk() problem
From: Joe Perches
Date: Sun Oct 23 2016 - 16:33:53 EST
On Sun, 2016-10-23 at 12:32 -0700, Linus Torvalds wrote:
> On Sun, Oct 23, 2016 at 12:06 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> > On Sun, 2016-10-23 at 11:11 -0700, Linus Torvalds wrote:
> > >
> > > And those two per se sound fairly easy to handle ("KERN_CONT means
> > > append to the line buffer, otherwise flush the line buffer and move to
> > > the record buffer").
> > >
> > > But what complicates things more is then the "console output", which
> > > has two issues:
> > >
> > > - it is done outside the locking regime for the line buffer and the
> > > record buffer.
> > >
> > > - it is done on _partial_ line buffers.
> >
> >
> > EOL KERN_<LEVEL> and thread interleaving still exists.
>
>
> Note that the thread interleaving is still trivial: it's easily done
> at the point where we decide "can we append to the line buffer or
> not". That's pretty simple. Just flush the record when the thread
> changes.
>
> So the interleaving will never go away, it's very fundamental - unless
> we make the line buffer just be a per-thread thing. And yes, that
> would be the cleanest solution, but it's also an extra buffer for each
> thread, so realistically it's just not going to happen.
I doubt there are cases where more than a few of
these interleaving threads are simultaneous.
Perhaps it could be a pool of active thread
continuation buffers.
> End result: I'm not worried about the interleaving. It will cause ugly
> output, but we've always had that, and the solution to it is "if you
> absolutely don't want interleaving, then don't try to print partial
> lines!".
> The classic "don't do that then" response, in other world.
Yup, best solution.