[lkml]   [2020]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH printk 3/5] printk: use buffer pool for sprint buffers
On (20/09/24 10:54), Petr Mladek wrote:
> > Just a question:
> >
> > Can dynamic_textbuf be a PER_CPU array of five textbuf[1024] buffers
> > (for normal printk, nmi, hard irq, soft irq and one extra buffer for
> > recursive printk calls)?
> That would be my preferred fallback when the approach with
> vsprintf(NULL, ) is not acceptable for some reasons.


> But I still think that calling vsprintf(NULL, ) is the most trivial
> and good enough solution.

It's probably good enough.

> IMHO, the solution with per-CPU buffers is not that trivial, for
> example:
> What if recursive printk() is interrupted by NMI and it causes
> yet another recursion?
> Is one level of recursion enough?

We might try the current approach - when we, for example, have
recursion in printk_safe() we just end up writing data to the
same per-CPU buffer. We need to limit the depth of recursion
one way or another. With per-CPU counter we will just bail out
of "deeply recursive printk" without attempting to store its
messages; with the buffers approach we will write the data to
a static buffer and see how badly it will be overlapped at the
end. Just a thought.


 \ /
  Last update: 2020-09-24 11:08    [W:0.082 / U:1.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site