[PATCH 1/1 v2] ARM: only call smp_send_stop() on SMP
Russell King - ARM Linux
linux at arm.linux.org.uk
Sat Jul 28 06:08:31 EDT 2012
On Fri, Jul 27, 2012 at 10:40:24PM +0100, Will Deacon wrote:
> On Fri, Jul 27, 2012 at 10:06:37PM +0100, Russell King - ARM Linux wrote:
> > We support booting a kernel on systems with or without SMP support, even
> > with a SMP kernel. When the kernel is booted on such a system, it is
> > undefined whether smp_cross_call() is a valid function pointer.
>
> So let's define it to point at a dummy function which explodes with a BUG if
> the cpumask passed in isn't empty. That allows SMP kernels to do things like
> `cross call to all other cores' without having to worry about whether there
> are any other cores or not.
We should not be even attempting to do any cross calls when there aren't
any other CPUs in the system - that's rather the point of leaving it as
a NULL pointer so it does explode on such systems.
. the scheduler won't call smp_send_reschedule() when there are no other
CPUs in the system.
. timer ticks won't be broadcast to other CPUs if there are no other CPUs
in the system.
. function calls will not be issued to other CPUs if there are no other
CPUs in the system.
There is only one case where this doesn't happen, and that's the shutdown
path.
For instance, smp_call_function*() all check that the target CPUs are
marked online before the arch code is requested to issue an IPI to the
target CPU.
The only place which is missing this check is smp_send_stop().
Now, we could make machine_shutdown() do this instead:
if (is_smp())
smp_send_stop();
but why bother calling into smp_send_stop(), and ultimately end up with
the _only_ site which calls smp_cross_call() with an empty CPU mask when
we can avoid the call when the CPU mask is empty - and prevent this
special case of smp_cross_call() being called with an empty CPU mask
ever occuring.
More information about the linux-arm-kernel
mailing list