lkml.org 
[lkml]   [2011]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: printk() vs tty_io

* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Thu, Dec 15, 2011 at 1:56 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > We probably could, I can have a closer look, but the main question is,
> > are we going to commit to no wakeups from console implementations? That
> > would mean removing the USB serial console support and other such stuff.
>
> I guess we can't.
>
> So new approach:
>
> - screw it. the rq lock is just too central, you cannot call
> printk from under it. And if you have an oops under it, you're
> screwed.
>
> Peter, why do you want to try to work from under the rq
> lock?

Well, no real strong reason: we had that nasty xtime_lock
related lockup in printk() (which was arguably much worse than
the rq lock dependency - and it got fixed), and everyone assumed
that somehow we could just remove the rq lock dependency from
printk() as well.

It appears we can't - and that's OK.

Was an intellectual excercise which didnt work out.

> - Make a special "debug printk" that is not synchronous. Just
> make it buffer things, and have it actually print out from a
> worker thread or whatever. This one *only* takes the lock for
> that buffer itself, and works everywhere. We could probably
> even do tricks to make it NMI-safe.

We kind of already have such a thing: trace_printk() - which
works from the weirdest of atomic contexts as well.

IIRC Peter uses trace_printk() to develop the scheduler all the
time.

What we could perhaps do is a sort of 'shut up regular printk
and feed all printks into the trace buffers' kind of debug
switch.

> Make code that isn't an oops or other very synchronous
> "have to print out *now*" aim to use this "softer" printk.

For early and nast oopses we have a very primitive printk:
earlyprintk=keep which can just act as a full printk
replacement. I use earlyprintk=keep while regular printk is
disabled (there's no console).

[ earlyprintk can be used to debug everything except printk()
lockups, obviously. ]

Thanks,

Ingo


\
 
 \ /
  Last update: 2011-12-15 19:11    [W:0.069 / U:1.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site