On Thursday 07 June 2007 16:07:04 Satyam Sharma wrote: > Hi, > > I'm about six months late here(!), but I noticed this bug in > arch/x86_64/kernel/smp.c while preparing another related > patch today and then found this thread during Googling ... > > On 2/9/07, Heiko Carstens <[EMAIL PROTECTED]> wrote: > > On i386/x86_64 smp_call_function_single() takes call_lock with > > spin_lock_bh(). To me this would imply that it is legal to call > > smp_call_function_single() from softirq context. > > It's not since smp_call_function() takes call_lock with just > > spin_lock(). We can easily deadlock: > > > > -> [process context] > > -> smp_call_function() > > -> spin_lock(&call_lock) > > -> IRQ -> do_softirq -> tasklet > > -> [softirq context] > > -> smp_call_function_single() > > -> spin_lock_bh(&call_lock) > > -> dead > > You're absolutely right, and this bug still exists in the latest -git.
bug is definitely too strong a word. It might be unnecessary to disable bhs, but I don't see any bug in here as long as you can't show a case where the smp_call_function() is called from BHs. There was a patch floating around to use it from sysrq to display state of all CPUs (and sysrq is softirq), but I don't think that ever made it mainline. And smp_call_function() can be called from panic which can violate quite some assumptions, but some deadlock possibility there is ok. I also don't like making it soft/hard irq save because that would make it much more intrusive to the machine for no good reason (e.g. slab can call it quite often in some cases) The _bh should be probably just removed and possibly a WARN_ON added. -Andi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/