[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090130214933.1b91ea3e.akpm@linux-foundation.org>
Date: Fri, 30 Jan 2009 21:49:33 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Andi Kleen <andi@...stfloor.org>
Cc: roger.larsson@...atan.se, linux-kernel@...r.kernel.org,
mingo@...e.hu, rml@...h9.net, pavel@....cz, netdev@...r.kernel.org
Subject: Re: PROBLEM: in_atomic() misuse all over the place
On Sat, 31 Jan 2009 06:55:08 +0100 Andi Kleen <andi@...stfloor.org> wrote:
> > There's a bit of a problem here. If someone accidentally uses
> > gfp_any() inside a spinlock, it will do a sleeping allocation on
> > non-preempt kernels and will do an atomic allocation on preemptible
> > kernels, so we won't get to see the warning which would allow us to fix
> > the bug.
>
> Yes exporting the function to drivers is dangerous I agree because
> it's easy to abuse.
>
> > Would using irq_count() work? If so, that would fix this up.
>
> There's nothing that works reliably to detect spinlocks on non
> preempt kernels.
Hang on. You said
That's typically for softirq vs non softirq, which is important for
the network stack.
that's what in_softirq() does.
Now, if networking is indeed using in_atomic() to detect
are-we-inside-a-spinlock then networking is buggy.
If networking is _not_ doing that then we can safely switch it to
in_sortirq() or in_interrupt(). And this would reenable the bug
detection which networking's use of in_atomic() accidentally
suppressed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists