Re: [patch] block/IDE/interrupt lockup

Andrew Morton (akpm@zip.com.au)
Sat, 30 Mar 2002 11:06:25 -0800


Alan Cox wrote:
>
> > The kernel calls request_irq() inside cli() in lots of places.
> > That's the same bug: "if you called cli(), how come you're
> > allowing kmalloc to clear it?".
>
> Those places should if possible be fixed. I take patches. If we can get 2.4
> to BUG() on those kmalloc violations and clean them up it sounds like
> progress

What I'd like is a debugging function `can_sleep()'. This
is good for documentary purposes, and will catch bugs.

So kmalloc() would gain:

if (gfp_flags & __GFP_WAIT)
can_sleep();

can_sleep() would do the following:

- If CONFIG_PREEMPT, check the locking depth (minus BKL depth),
whine if non-zero.

- If inside cli(), whine.

- If inside __cli(), also whine (not really a bug, but a design error).

- whining will include generation of a backtrace.

I suspect a 2.4 version would generate too many bug reports :)
It would have to implement its own lock depth accounting if
we want the sleep-inside-spinlock checking.

There's some arch-dependent stuff in there. I'll do a 2.5
patch. I suspect it'll generate showers of stuff. We can
feed fixes back into 2.4.

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/