aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2011-05-25 19:34:12 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-06-19 21:21:32 -0400
commit9ca980dce523760ce04a798470d36fd5aa596b78 (patch)
treebef37cf5113f56a8e77d6bebf2f57a9df9ae8c21 /arch
parent7ac87abb8166b99584149fcfb2efef5773a078e9 (diff)
powerpc: Avoid extra indirect function call in sending IPIs
On many platforms (including pSeries), smp_ops->message_pass is always smp_muxed_ipi_message_pass. This changes arch/powerpc/kernel/smp.c so that if smp_ops->message_pass is NULL, it calls smp_muxed_ipi_message_pass directly. This means that a platform doesn't need to set both .message_pass and .cause_ipi, only one of them. It is a slight performance improvement in that it gets rid of an indirect function call at the expense of a predictable conditional branch. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/smp.c18
-rw-r--r--arch/powerpc/platforms/85xx/smp.c2
-rw-r--r--arch/powerpc/platforms/iseries/smp.c2
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/smp.c2
-rw-r--r--arch/powerpc/platforms/wsp/smp.c2
6 files changed, 19 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8ebc6700b98..2975f64cf31 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -238,15 +238,25 @@ irqreturn_t smp_ipi_demux(void)
238} 238}
239#endif /* CONFIG_PPC_SMP_MUXED_IPI */ 239#endif /* CONFIG_PPC_SMP_MUXED_IPI */
240 240
241static inline void do_message_pass(int cpu, int msg)
242{
243 if (smp_ops->message_pass)
244 smp_ops->message_pass(cpu, msg);
245#ifdef CONFIG_PPC_SMP_MUXED_IPI
246 else
247 smp_muxed_ipi_message_pass(cpu, msg);
248#endif
249}
250
241void smp_send_reschedule(int cpu) 251void smp_send_reschedule(int cpu)
242{ 252{
243 if (likely(smp_ops)) 253 if (likely(smp_ops))
244 smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE); 254 do_message_pass(cpu, PPC_MSG_RESCHEDULE);
245} 255}
246 256
247void arch_send_call_function_single_ipi(int cpu) 257void arch_send_call_function_single_ipi(int cpu)
248{ 258{
249 smp_ops->message_pass(cpu, PPC_MSG_CALL_FUNC_SINGLE); 259 do_message_pass(cpu, PPC_MSG_CALL_FUNC_SINGLE);
250} 260}
251 261
252void arch_send_call_function_ipi_mask(const struct cpumask *mask) 262void arch_send_call_function_ipi_mask(const struct cpumask *mask)
@@ -254,7 +264,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
254 unsigned int cpu; 264 unsigned int cpu;
255 265
256 for_each_cpu(cpu, mask) 266 for_each_cpu(cpu, mask)
257 smp_ops->message_pass(cpu, PPC_MSG_CALL_FUNCTION); 267 do_message_pass(cpu, PPC_MSG_CALL_FUNCTION);
258} 268}
259 269
260#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC) 270#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
@@ -268,7 +278,7 @@ void smp_send_debugger_break(void)
268 278
269 for_each_online_cpu(cpu) 279 for_each_online_cpu(cpu)
270 if (cpu != me) 280 if (cpu != me)
271 smp_ops->message_pass(cpu, PPC_MSG_DEBUGGER_BREAK); 281 do_message_pass(cpu, PPC_MSG_DEBUGGER_BREAK);
272} 282}
273#endif 283#endif
274 284
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index d6a93a10c0f..8eef8d2b447 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -236,7 +236,7 @@ void __init mpc85xx_smp_init(void)
236 } 236 }
237 237
238 if (cpu_has_feature(CPU_FTR_DBELL)) { 238 if (cpu_has_feature(CPU_FTR_DBELL)) {
239 smp_85xx_ops.message_pass = smp_muxed_ipi_message_pass; 239 /* .message_pass defaults to smp_muxed_ipi_message_pass */
240 smp_85xx_ops.cause_ipi = doorbell_cause_ipi; 240 smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
241 } 241 }
242 242
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index e3265adde5d..2df48c2287b 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -75,7 +75,7 @@ static void __devinit smp_iSeries_setup_cpu(int nr)
75} 75}
76 76
77static struct smp_ops_t iSeries_smp_ops = { 77static struct smp_ops_t iSeries_smp_ops = {
78 .message_pass = smp_muxed_ipi_message_pass, 78 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
79 .cause_ipi = smp_iSeries_cause_ipi, 79 .cause_ipi = smp_iSeries_cause_ipi,
80 .probe = smp_iSeries_probe, 80 .probe = smp_iSeries_probe,
81 .kick_cpu = smp_iSeries_kick_cpu, 81 .kick_cpu = smp_iSeries_kick_cpu,
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index db092d7c4c5..d15fca32297 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -447,7 +447,7 @@ void __init smp_psurge_give_timebase(void)
447 447
448/* PowerSurge-style Macs */ 448/* PowerSurge-style Macs */
449struct smp_ops_t psurge_smp_ops = { 449struct smp_ops_t psurge_smp_ops = {
450 .message_pass = smp_muxed_ipi_message_pass, 450 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
451 .cause_ipi = smp_psurge_cause_ipi, 451 .cause_ipi = smp_psurge_cause_ipi,
452 .probe = smp_psurge_probe, 452 .probe = smp_psurge_probe,
453 .kick_cpu = smp_psurge_kick_cpu, 453 .kick_cpu = smp_psurge_kick_cpu,
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index fbffd7e47ab..84dafd33edc 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -207,7 +207,7 @@ static struct smp_ops_t pSeries_mpic_smp_ops = {
207}; 207};
208 208
209static struct smp_ops_t pSeries_xics_smp_ops = { 209static struct smp_ops_t pSeries_xics_smp_ops = {
210 .message_pass = smp_muxed_ipi_message_pass, 210 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
211 .cause_ipi = NULL, /* Filled at runtime by xics_smp_probe() */ 211 .cause_ipi = NULL, /* Filled at runtime by xics_smp_probe() */
212 .probe = xics_smp_probe, 212 .probe = xics_smp_probe,
213 .kick_cpu = smp_pSeries_kick_cpu, 213 .kick_cpu = smp_pSeries_kick_cpu,
diff --git a/arch/powerpc/platforms/wsp/smp.c b/arch/powerpc/platforms/wsp/smp.c
index 9d20fa9d371..71bd105f386 100644
--- a/arch/powerpc/platforms/wsp/smp.c
+++ b/arch/powerpc/platforms/wsp/smp.c
@@ -75,7 +75,7 @@ static int __init smp_a2_probe(void)
75} 75}
76 76
77static struct smp_ops_t a2_smp_ops = { 77static struct smp_ops_t a2_smp_ops = {
78 .message_pass = smp_muxed_ipi_message_pass, 78 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
79 .cause_ipi = doorbell_cause_ipi, 79 .cause_ipi = doorbell_cause_ipi,
80 .probe = smp_a2_probe, 80 .probe = smp_a2_probe,
81 .kick_cpu = smp_a2_kick_cpu, 81 .kick_cpu = smp_a2_kick_cpu,