Comments

Consolidate the mux and demux of ipi messages into smp.c and call
a new smp_ops callback to actually trigger the ipi.
The powerpc architecture code is optimised for having 4 distinct
ipi triggers, which are mapped to 4 distinct messages (ipi many, ipi
single, scheduler ipi, and enter debugger). However, several interrupt
controllers only provide a single software triggered interrupt that
can be delivered to each cpu. To resolve this limitation, each smp_ops
implementation created a per-cpu variable that is manipulated with atomic
bitops. Since these lines will be contended they are optimialy marked as
shared_aligned and take a full cache line for each cpu. Distro kernels
may have 2 or 3 of these in their config, each taking per-cpu space
even though at most one will be in use.
This consolidation removes smp_message_recv and replaces the single call
actions cases with direct calls from the common message recognition loop.
The complicated debugger ipi case with its muxed crash handling code is
moved to debug_ipi_action which is now called from the demux code (instead
of the multi-message action calling smp_message_recv).
I put a call to reschedule_action to increase the likelyhood of correctly
merging the anticipated scheduler_ipi() hook coming from the scheduler
tree; that single required call can be inlined later.
The actual message decode is a copy of the old pseries xics code with its
memory barriers and cache line spacing, augmented with a per-cpu unsigned
long based on the book-e doorbell code. The optional data is set via a
callback from the implementation and is passed to the new cause-ipi hook
along with the logical cpu number. While currently only the doorbell
implemntation uses this data it should be almost zero cost to retrieve and
pass it -- it adds a single register load for the argument from the same
cache line to which we just completed a store and the register is dead
on return from the call. I extended the data element from unsigned int
to unsigned long in case some other code wanted to associate a pointer.
The doorbell check_self is replaced by a call to smp_muxed_ipi_resend,
conditioned on the CPU_DBELL feature. The ifdef guard could be relaxed
to CONFIG_SMP but I left it with BOOKE for now.
Also, the doorbell interrupt vector for book-e was not calling irq_enter
and irq_exit, which throws off cpu accounting and causes code to not
realize it is running in interrupt context. Add the missing calls.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
This requires patch 3780 be applied first for cell to compile.
---
arch/powerpc/include/asm/dbell.h | 3 +-
arch/powerpc/include/asm/smp.h | 14 +++--
arch/powerpc/include/asm/xics.h | 2 +-
arch/powerpc/kernel/dbell.c | 46 +++-------------
arch/powerpc/kernel/irq.c | 4 +-
arch/powerpc/kernel/smp.c | 92 +++++++++++++++++++++----------
arch/powerpc/platforms/85xx/smp.c | 6 ++-
arch/powerpc/platforms/iseries/irq.c | 3 +-
arch/powerpc/platforms/iseries/smp.c | 23 +-------
arch/powerpc/platforms/iseries/smp.h | 6 --
arch/powerpc/platforms/powermac/smp.c | 27 ++-------
arch/powerpc/platforms/pseries/smp.c | 3 +-
arch/powerpc/sysdev/xics/icp-hv.c | 10 +---
arch/powerpc/sysdev/xics/icp-native.c | 10 +---
arch/powerpc/sysdev/xics/xics-common.c | 30 +----------
15 files changed, 107 insertions(+), 172 deletions(-)
delete mode 100644 arch/powerpc/platforms/iseries/smp.h

On Wed, 2011-05-11 at 00:29 -0500, Milton Miller wrote:
> Consolidate the mux and demux of ipi messages into smp.c and call> a new smp_ops callback to actually trigger the ipi.
.../...
I'm merging the whole series. I had to do some fixups to this one and
the one adding the CONFIG option, missing cell & wsp bits among others,
but mostly trivial.
Cheers,
Ben.

On Thu, 2011-05-19 at 16:57 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2011-05-11 at 00:29 -0500, Milton Miller wrote:> > Consolidate the mux and demux of ipi messages into smp.c and call> > a new smp_ops callback to actually trigger the ipi.> > .../...> > I'm merging the whole series. I had to do some fixups to this one and> the one adding the CONFIG option, missing cell & wsp bits among others,> but mostly trivial.
I forgot to mention... I dropped the change to include/linux/smp.h to
remove the unused MSG_ flags for now. It will not have been in -next
long enough to hit Linus via my tree, just in case somebody started
using the flags while we were not looking :-)
I suggest you send it to Linus directly after he pulls my tree during
the merge window.
Cheers,
Ben.