Messages in this thread | | | Date | Thu, 24 Sep 2020 15:17:46 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [PATCH printk 3/5] printk: use buffer pool for sprint buffers |
| |
On (20/09/22 17:44), John Ogness wrote: > +/* > + * The sprint buffers are used with interrupts disabled, so each CPU > + * only requires 2 buffers: for non-NMI and NMI contexts. Recursive > + * printk() calls are handled by the safe buffers. > + */ > +#define SPRINT_CTX_DEPTH 2 > + > +/* Static sprint buffers for early boot (only 1 CPU). */ > +static DECLARE_BITMAP(sprint_static_textbuf_map, SPRINT_CTX_DEPTH); > +static char sprint_static_textbuf[SPRINT_CTX_DEPTH * LOG_LINE_MAX]; > + > +/* Dynamically allocated sprint buffers. */ > +static unsigned int sprint_dynamic_textbuf_count; > +static unsigned long *sprint_dynamic_textbuf_map; > +static char *sprint_dynamic_textbuf;
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)?
So then we'd
vprintk(...) { preempt_disable(); buf = this_cpu_ptr(... preempt_count_to_ctx()); ... preempt_enable(); }
preempt_disable()/preempt_enable() is already in printk().
-ss
| |