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

From: Linus Torvalds
Date: Thu Jan 29 2009 - 13:41:21 EST




On Thu, 29 Jan 2009, Peter Zijlstra wrote:
>
> 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.

Sure. But this isn't the "wait=1" case. In the waiting case, we don't need
to allocate anything at all, we can just use the stack.

So the only case that matters for interrupts is indeed "wait=0", but
that's very much also the case we're talking about.

> 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.

Yes. I agree that the _concept_ of the patch is good. No argument there.

I'm just worried about the details.

> That leaves us with 6 cases,
>
> root@laptop:/usr/src/linux-2.6# git grep "smp_call_function_single(.*0)"

This misses a _lot_ of cases. What about this one:

kernel/relay.c: err = smp_call_function_single(i,

where you're not seeing if it's a non-waiting one or not (it's a waiting
one, but my point is that your grep is missing cases).

Doing

git grep -w smp_call_function_single | grep -v '1);'

is probably more likely to find the cases to look for.

But you're right, I'm still not seeing anything that looks _likely_ to be
a problem. But I worry that it's something somebody may want to do.

Linus
--
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/