Messages in this thread | | | Date | Thu, 24 Sep 2020 18:06:53 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [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.
OK.
> 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.
-ss
| |