aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/smp.h
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2011-05-10 15:29:39 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-05-19 01:31:03 -0400
commit23d72bfd8f9f24aa9efafed3586a99f5669c23d7 (patch)
treef8fbd87c64de43c1d85a830f1f3342818414764a /arch/powerpc/include/asm/smp.h
parent17f9c8a73bac2c7dfe28a520516ea6b8bbbe977e (diff)
powerpc: Consolidate ipi message mux and demux
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> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/smp.h')
-rw-r--r--arch/powerpc/include/asm/smp.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 6f7c95c0027a..26f861560c51 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -20,6 +20,7 @@
20#include <linux/threads.h> 20#include <linux/threads.h>
21#include <linux/cpumask.h> 21#include <linux/cpumask.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/irqreturn.h>
23 24
24#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
25 26
@@ -37,6 +38,7 @@ extern void cpu_die(void);
37 38
38struct smp_ops_t { 39struct smp_ops_t {
39 void (*message_pass)(int cpu, int msg); 40 void (*message_pass)(int cpu, int msg);
41 void (*cause_ipi)(int cpu, unsigned long data);
40 int (*probe)(void); 42 int (*probe)(void);
41 int (*kick_cpu)(int nr); 43 int (*kick_cpu)(int nr);
42 void (*setup_cpu)(int nr); 44 void (*setup_cpu)(int nr);
@@ -49,7 +51,6 @@ struct smp_ops_t {
49}; 51};
50 52
51extern void smp_send_debugger_break(void); 53extern void smp_send_debugger_break(void);
52extern void smp_message_recv(int);
53extern void start_secondary_resume(void); 54extern void start_secondary_resume(void);
54extern void __devinit smp_generic_give_timebase(void); 55extern void __devinit smp_generic_give_timebase(void);
55extern void __devinit smp_generic_take_timebase(void); 56extern void __devinit smp_generic_take_timebase(void);
@@ -109,13 +110,16 @@ extern int cpu_to_core_id(int cpu);
109#define PPC_MSG_CALL_FUNC_SINGLE 2 110#define PPC_MSG_CALL_FUNC_SINGLE 2
110#define PPC_MSG_DEBUGGER_BREAK 3 111#define PPC_MSG_DEBUGGER_BREAK 3
111 112
112/* 113/* for irq controllers that have dedicated ipis per message (4) */
113 * irq controllers that have dedicated ipis per message and don't
114 * need additional code in the action handler may use this
115 */
116extern int smp_request_message_ipi(int virq, int message); 114extern int smp_request_message_ipi(int virq, int message);
117extern const char *smp_ipi_name[]; 115extern const char *smp_ipi_name[];
118 116
117/* for irq controllers with only a single ipi */
118extern void smp_muxed_ipi_set_data(int cpu, unsigned long data);
119extern void smp_muxed_ipi_message_pass(int cpu, int msg);
120extern void smp_muxed_ipi_resend(void);
121extern irqreturn_t smp_ipi_demux(void);
122
119void smp_init_iSeries(void); 123void smp_init_iSeries(void);
120void smp_init_pSeries(void); 124void smp_init_pSeries(void);
121void smp_init_cell(void); 125void smp_init_cell(void);
@@ -185,6 +189,8 @@ extern unsigned long __secondary_hold_spinloop;
185extern unsigned long __secondary_hold_acknowledge; 189extern unsigned long __secondary_hold_acknowledge;
186extern char __secondary_hold; 190extern char __secondary_hold;
187 191
192extern irqreturn_t debug_ipi_action(int irq, void *data);
193
188#endif /* __ASSEMBLY__ */ 194#endif /* __ASSEMBLY__ */
189 195
190#endif /* __KERNEL__ */ 196#endif /* __KERNEL__ */