Re: Dumb question: BKL on reboot ?

Dave Hansen
2003-08-20T20:24:30Z

On Wed, 2003-08-20 at 11:35, David S. Miller wrote:
> On Wed, 20 Aug 2003 11:29:18 -0700
> Andrew Morton <akpm@osdl.org> wrote:
>
> > Where exactly does the rebooting CPU get stuck in machine_restart()? If
> > someone has done lock_kernel() with local interrupts disabled then yes,
> > it'll deadlock. But that's unlikely? Confused.

I thought it was legal to do that. The normal interrupts-off spinlock
deadlock happens because a thread does a spin_lock() with no irq
disable, then gets interrupted. The interrupt handler tries to take the
lock, and gets stuck.

If the BKL is put in that situation, the interrupt handler will see
current->lock_depth > 0, and not actually take the spinlock; it will
just increment the lock_depth. It won't deadlock.

Or, are you saying that a CPU could have the BKL, and have
stop_this_cpu() called on it? I guess we could add
release_kernel_lock() to stop_this_cpu().
--
Dave Hansen
haveblue@us.ibm.com