RE: POC: Alternative solution: Re: [PATCH 0/4] printk: reimplement LOG_CONT handling
From: David Laight
Date: Sat Aug 15 2020 - 21:29:37 EST
From: Joe Perches
> Sent: 15 August 2020 00:52
...
> > This is why I think any discussion that says "people should buffer
> > their lines themselves and we should get rid if pr_cont()" is
> > fundamentally broken.
> >
> > Don't go down that hole. I won't take it. It's wrong.
>
> I don't think it's wrong per se.
>
> It's reasonable to avoid pr_cont when appropriate.
>
> Trivial buffering, or adding and using YA vsprintf
> extension can avoid unnecessary message interleaving.
>
> For instance, I just sent this patch to allow removal
> of print_vma_addr and its use of pr_cont.
>
> https://lore.kernel.org/lkml/09f11651f0e913e159b955ac447cd8cadf36cb0d.camel@xxxxxxxxxxx/
ISTM that is a bit complex for a printf format.
Even with the 'noinline_for_stack' it is going to
use a lot of stack - and error printfs are already likely
to be near the stack limit.
The recursion for %pV might also cause grief.
In that case formatting the data into an on-stack char[]
before the printf is probably the simplest solution.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)