Re: recursion handling: Re: [PATCH next v2 3/3] printk: remove logbuf_lock, add syslog_lock

From: Sergey Senozhatsky
Date: Sat Dec 05 2020 - 04:46:42 EST


On (20/12/04 17:10), Petr Mladek wrote:
>
> One reason is the use of per-cpu variables. Alternative solution would
> be to store printk_context into task_struct.

We can keep per-CPU, disable preemption and have counters for
every context (task, soft/hard irq, NMI). Shouldn't be a problem

vprintk_emit()
{
preempt_disable()
vprintk_store()
preempt_enable()

preempt_disable()
console_unlock()
preempt_enable()
}

vprintk_store() is a small fraction of console_unlock() time wise.

-ss