Re: [PATCH -v2] use per cpu data for single cpu ipi calls

From: Steven Rostedt
Date: Thu Jan 29 2009 - 13:31:40 EST



On Thu, 29 Jan 2009, Peter Zijlstra wrote:

> On Thu, 2009-01-29 at 10:08 -0800, Linus Torvalds wrote:
>
> > And are you really sure it cannot be called from within interrupts? I'm
> > finding a lot of callers of smp_call_function_single(), and while I
> > couldn't find any that look like interrupts, I also couldn't find any
> > indication that it never happens.
>
> Calls with wait=1 are deadlockable when done from within irqs or irq
> disabled sections because two cpus could cross ipi each other and stay
> waiting.
>
> That leaves us with the !wait case, which wasn't safe because that
> kmalloc could fail, and the fallback was wait, which yields the same
> deadlock.
>
> That leaves us with 6 cases,
>
> root@laptop:/usr/src/linux-2.6# git grep "smp_call_function_single(.*0)"
> arch/blackfin/kernel/kgdb.c: smp_call_function_single(cpu, kgdb_passive_cpu_callback, NULL, 0);
> arch/ia64/kernel/smpboot.c: if (smp_call_function_single(master, sync_master, NULL, 0) < 0) {
> arch/ia64/kvm/kvm-ia64.c: smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0);
> arch/x86/kvm/x86.c: smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0);
> arch/x86/oprofile/nmi_int.c: smp_call_function_single(cpu, nmi_cpu_start, NULL, 0);
> arch/x86/pci/amd_bus.c: smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0);
>
> The kgdb one looks to be buggy, as it calls smp_call_function_single()
> from under irqs disabled.
>
> Such users should use __smp_call_single_function() with a pre-allocated
> csd.
>
> Didn't check the others.

Regardless of this, I like your change better than my original. We should
do that anyway.

-- Steve

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