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

2020-12-07 Thread Petr Mladek
On Sun 2020-12-06 22:50:54, John Ogness wrote: > On 2020-12-04, Petr Mladek wrote: > > On Tue 2020-12-01 21:59:41, John Ogness wrote: > >> Since the ringbuffer is lockless, there is no need for it to be > >> protected by @logbuf_lock. Remove @logbuf_lock. > >> > >> --- a/kernel/printk/printk.c >

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

2020-12-06 Thread John Ogness
On 2020-12-05, Sergey Senozhatsky 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

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

2020-12-06 Thread John Ogness
On 2020-12-05, Sergey Senozhatsky wrote: >> We should allow at least some level of recursion. Otherwise, we would >> not see warnings printed from vsprintf code. > > One level of recursion seems reasonable on one hand, but on the other > hand I also wonder if we can get useful info from recursion

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

2020-12-06 Thread John Ogness
On 2020-12-04, Petr Mladek wrote: > On Tue 2020-12-01 21:59:41, John Ogness wrote: >> Since the ringbuffer is lockless, there is no need for it to be >> protected by @logbuf_lock. Remove @logbuf_lock. >> >> --- a/kernel/printk/printk.c >> +++ b/kernel/printk/printk.c >> @@ -1847,6 +1811,65 @@

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

2020-12-05 Thread Sergey Senozhatsky
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

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

2020-12-04 Thread Sergey Senozhatsky
On (20/12/04 17:10), Petr Mladek wrote: [..] > char *get_printk_counter_by_ctx() > { > int ctx = 0; > > if (in_nmi) > ctx = 1; > > if (!printk_percpu_data_ready()) > return _count_early[ctx]; > > return this_cpu_ptr(printk_count[ctx]); > } > >

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

2020-12-04 Thread Petr Mladek
On Tue 2020-12-01 21:59:41, John Ogness wrote: > Since the ringbuffer is lockless, there is no need for it to be > protected by @logbuf_lock. Remove @logbuf_lock. > > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1847,6 +1811,65 @@ static void call_console_drivers(const char