lkml.org 
[lkml]   [2016]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] printk/nmi: avoid direct printk()-s from __printk_nmi_flush()
On Thu 2016-09-01 16:55:07, Sergey Senozhatsky wrote:
> On (08/30/16 13:19), Petr Mladek wrote:
> >
> > I see. But then we will need to be more careful because printk_func
> > and printk_func_saved will be manipulated in different contexts:
> > normal, irq, nmi. A solution might be using an atomic counter
> > and selecting the right vprintk_func according to the value.
>
> alt_printk_enter() must be done with local IRQs disabled. so IRQ cannot
> race with `normal' alt_printk. other IRQs cannot race with the current IRQ,
> because we have local IRQs disabled. the only thing that can race here is - NMI.
> both `normal' and IRQ alt_printk can use the same per-CPU buffer, they never
> race. NMI needs to have its own.

Yes. Well, my concern was how to atomically change the printk_func
pointer and save the previous value at the same time. You could not
use locks because NMIs are involved.

Best Regards,
Petr

\
 
 \ /
  Last update: 2016-09-17 09:58    [W:0.146 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site