Re: start_kernel(): bug: interrupts were enabled early

From: Kevin Hilman
Date: Wed Apr 07 2010 - 15:09:36 EST

Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:

> On Wed, 31 Mar 2010, H. Peter Anvin wrote:
>> The obvious way to fix this would be to use
>> spin_lock_irqsave..spin_lock_irqrestore in __down_read as well as in the
>> other locations; I don't have a good feel for what the cost of doing so
>> would be, though. On x86 it's fairly expensive simply because the only
>> way to save the state is to push it on the stack, which the compiler
>> doesn't deal well with, but this code isn't used on x86.


> So making the slow-path do the spin_[un]lock_irq{save,restore}() versions
> sounds like the right thing. It won't be a performance issue: it _is_ the
> slow-path, and we're already doing the expensive part (the spinlock itself
> and the irq thing).
> So ACK on the idea. Who wants to write the trivial patch and test it?

OK, I'll bite since I was seeing boot-time hangs on ARM (TI OMAP3) due
to this. Patch below.