]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
powerpc: Avoid extra indirect function call in sending IPIs
authorPaul Mackerras <paulus@samba.org>
Wed, 25 May 2011 23:34:12 +0000 (23:34 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 20 Jun 2011 01:21:32 +0000 (11:21 +1000)
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>
arch/powerpc/kernel/smp.c
arch/powerpc/platforms/85xx/smp.c
arch/powerpc/platforms/iseries/smp.c
arch/powerpc/platforms/powermac/smp.c
arch/powerpc/platforms/pseries/smp.c
arch/powerpc/platforms/wsp/smp.c

index 8ebc6700b98d18769f6e8afd1eb54f9f0363ec58..2975f64cf31027dafe5557d794c9062833f591b8 100644 (file)
@@ -238,15 +238,25 @@ irqreturn_t smp_ipi_demux(void)
 }
 #endif /* CONFIG_PPC_SMP_MUXED_IPI */
 
+static inline void do_message_pass(int cpu, int msg)
+{
+       if (smp_ops->message_pass)
+               smp_ops->message_pass(cpu, msg);
+#ifdef CONFIG_PPC_SMP_MUXED_IPI
+       else
+               smp_muxed_ipi_message_pass(cpu, msg);
+#endif
+}
+
 void smp_send_reschedule(int cpu)
 {
        if (likely(smp_ops))
-               smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE);
+               do_message_pass(cpu, PPC_MSG_RESCHEDULE);
 }
 
 void arch_send_call_function_single_ipi(int cpu)
 {
-       smp_ops->message_pass(cpu, PPC_MSG_CALL_FUNC_SINGLE);
+       do_message_pass(cpu, PPC_MSG_CALL_FUNC_SINGLE);
 }
 
 void 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)
        unsigned int cpu;
 
        for_each_cpu(cpu, mask)
-               smp_ops->message_pass(cpu, PPC_MSG_CALL_FUNCTION);
+               do_message_pass(cpu, PPC_MSG_CALL_FUNCTION);
 }
 
 #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
@@ -268,7 +278,7 @@ void smp_send_debugger_break(void)
 
        for_each_online_cpu(cpu)
                if (cpu != me)
-                       smp_ops->message_pass(cpu, PPC_MSG_DEBUGGER_BREAK);
+                       do_message_pass(cpu, PPC_MSG_DEBUGGER_BREAK);
 }
 #endif
 
index d6a93a10c0f5c431d65c096c1fcf7dcfe8c0b289..8eef8d2b44727022ea77578f292b417eeb7cb224 100644 (file)
@@ -236,7 +236,7 @@ void __init mpc85xx_smp_init(void)
        }
 
        if (cpu_has_feature(CPU_FTR_DBELL)) {
-               smp_85xx_ops.message_pass = smp_muxed_ipi_message_pass;
+               /* .message_pass defaults to smp_muxed_ipi_message_pass */
                smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
        }
 
index e3265adde5d32baab9051eca1dea610357c73b7f..2df48c2287bdcfaad589e3ba44c19bce98ba9f73 100644 (file)
@@ -75,7 +75,7 @@ static void __devinit smp_iSeries_setup_cpu(int nr)
 }
 
 static struct smp_ops_t iSeries_smp_ops = {
-       .message_pass = smp_muxed_ipi_message_pass,
+       .message_pass = NULL,   /* Use smp_muxed_ipi_message_pass */
        .cause_ipi    = smp_iSeries_cause_ipi,
        .probe        = smp_iSeries_probe,
        .kick_cpu     = smp_iSeries_kick_cpu,
index db092d7c4c5b3ee41062af909af2e3a355bc06b7..d15fca32297878970e8b1130098fcaef18a7c7e3 100644 (file)
@@ -447,7 +447,7 @@ void __init smp_psurge_give_timebase(void)
 
 /* PowerSurge-style Macs */
 struct smp_ops_t psurge_smp_ops = {
-       .message_pass   = smp_muxed_ipi_message_pass,
+       .message_pass   = NULL, /* Use smp_muxed_ipi_message_pass */
        .cause_ipi      = smp_psurge_cause_ipi,
        .probe          = smp_psurge_probe,
        .kick_cpu       = smp_psurge_kick_cpu,
index fbffd7e47ab85fd86face2f8cba35c6537c5fe65..84dafd33edc58f7081b1abd235d72ffa7057025a 100644 (file)
@@ -207,7 +207,7 @@ static struct smp_ops_t pSeries_mpic_smp_ops = {
 };
 
 static struct smp_ops_t pSeries_xics_smp_ops = {
-       .message_pass   = smp_muxed_ipi_message_pass,
+       .message_pass   = NULL, /* Use smp_muxed_ipi_message_pass */
        .cause_ipi      = NULL, /* Filled at runtime by xics_smp_probe() */
        .probe          = xics_smp_probe,
        .kick_cpu       = smp_pSeries_kick_cpu,
index 9d20fa9d3710e0a07670188af71ac8e573dd4ac3..71bd105f38636b0435fae0590deec38cd02ddf1e 100644 (file)
@@ -75,7 +75,7 @@ static int __init smp_a2_probe(void)
 }
 
 static struct smp_ops_t a2_smp_ops = {
-       .message_pass   = smp_muxed_ipi_message_pass,
+       .message_pass   = NULL, /* Use smp_muxed_ipi_message_pass */
        .cause_ipi      = doorbell_cause_ipi,
        .probe          = smp_a2_probe,
        .kick_cpu       = smp_a2_kick_cpu,