Re: Bug in on_each_cpu?

From: Zachary Amsden
Date: Thu Mar 01 2007 - 15:31:51 EST


Andrew Morton wrote:
The handler for smp_call_function() is called with local interrupts
disabled (from the IPI handler).

So to provide a consistent call environment for that handler, on_each_cpu()
will also disable local interrupts when making the direct call on this CPU.

Similarly the !CONFIG_SMP version of on_each_cpu() disables local
interrupts when running the caller's function.

Yes, that is sensible. Something akin to on_each_cpu(synchronize_tscs) would certainly not like interrupts coming in. Similarly, acpi_nmi disable and probably rcu barriers as well. The irq disable here can very validly be used as a barrier, but trying to ensure preserved shared state with irq handlers over the call is a bug.

If one had all the spare time in the world, a new "sense" of irq disable that communicated this fact would be nice from a static or dynamic checking perspective.

Zach

------
sutra I.1 - atha linushasaanam
-
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/