Re: [PATCH 3/3] printk: Avoid all wakeups from printk

Ingo Molnar
2011-06-09T14:20:08Z

* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> On Thu, 2011-06-09 at 15:55 +0200, Ingo Molnar wrote:
>
> > > @@ -943,19 +939,14 @@ asmlinkage int vprintk(const char *fmt,
> > > if (*p == '\n')
> > > new_text_line = 1;
> > > }
> > > + printk_cpu = UINT_MAX;
> > > + spin_unlock(&logbuf_lock);
> >
> > Hm, is that printk_cpu setting inside the critical section safe? What
> > happens if we get an NMI on this CPU in that window?
>
> That's what the old code did, also NMI really shouldn't printk(), but
> yeah, can flip those two lines, but in that same vein I should also flip
> the setting of that variable with acquiring the lock.

Flipping it won't be enough - we could override another CPU's
protection ...

Thanks,

Ingo