[lkml]   [2000]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH #2] console lock grabbed too early in printk...

_YES_ and I found the deadlock. :) I'll describe it for you... it's the
result of two seemingly innocuous things:
1. printk of arguments to the sys_access function
2. printk of mappings of vm pages

The sequence of events goes like this:
1. printk of args to sys_access
2. printk grabs the console lock
3. vfprintf is called, but one of the strings (the filename) resides on a
page that hasn't been materialized yet.
4. page fault occurs
5. page fault handler runs, maps page
6. Page mapping causes printk
7. printk causes deadlock as it attempts to grab the console lock that the
kernel thread already has...

As you can imagine, this was a bugger to track down... take away the
printks and thigns work... but do they work just 'cause of timing
differences, or because of printk? Well, it turns out it was printk and I
don't think other people should have to deal with that...

console_lock protecting "buf" is pretty silly in addition... which the fix
also happens to address. The kernel will continue to get more and more
fine grained as time goes on (to a point of course :) and I think it is
time that "buf" had it's turn. :)

For me, I want to be able to do my debugging... and I want to save OTHER
people the pain and suffering I went through in the future... 'cause I
already have a "fixed" kernel. :)


On Sun, 2 Jul 2000, Jeff Garzik wrote:

> On Sun, 2 Jul 2000, Chris Lattner wrote:
> > Like I said a few times already... kmalloc is only called in a situation
> > where deadlock would occur before... I would have no problem calling it
> > with GFP_ATOMIC and dropping the message if OOM...
> -Is- a deadlock occurring for you, or others, though? If so, we had
> better find the problem and fix it before dicking around with making
> printk prettier and faster.
> I thought this thread was about reducing the time that console_lock
> had to be held...
> Jeff

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:57    [W:0.089 / U:3.648 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site