Blackfin: SMP: disable preempt with smp_processor_id to send messages
authorSonic Zhang <sonic.zhang@analog.com>
Fri, 25 Jun 2010 05:55:16 +0000 (05:55 +0000)
committerMike Frysinger <vapier@gentoo.org>
Fri, 18 Mar 2011 08:01:02 +0000 (04:01 -0400)
The smp_processor_id() API requires that preempt be disabled when calling
it, so make sure it is when we go to send messages to other processors.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/mach-common/smp.c

index 40e6cbc363f5fd4663d74a221400f956eeb90d06..5f7617d669055fdee72d67e42a0293994aba5308 100644 (file)
@@ -244,12 +244,13 @@ int smp_call_function(void (*func)(void *info), void *info, int wait)
 {
        cpumask_t callmap;
 
+       preempt_disable();
        callmap = cpu_online_map;
        cpu_clear(smp_processor_id(), callmap);
-       if (cpus_empty(callmap))
-               return 0;
+       if (!cpus_empty(callmap))
+               smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait);
 
-       smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait);
+       preempt_enable();
 
        return 0;
 }
@@ -286,12 +287,13 @@ void smp_send_stop(void)
 {
        cpumask_t callmap;
 
+       preempt_disable();
        callmap = cpu_online_map;
        cpu_clear(smp_processor_id(), callmap);
-       if (cpus_empty(callmap))
-               return;
+       if (!cpus_empty(callmap))
+               smp_send_message(callmap, BFIN_IPI_CPU_STOP, NULL, NULL, 0);
 
-       smp_send_message(callmap, BFIN_IPI_CPU_STOP, NULL, NULL, 0);
+       preempt_enable();
 
        return;
 }