[PATCH 6/6] smp: Delete _SMP_Request_other_cores_to_dispatch()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 14 14:32:01 UTC 2013


Use an event triggered unicast to inform remote processors about a
necessary thread dispatch instead.
---
 cpukit/score/include/rtems/score/smp.h |    8 --------
 cpukit/score/src/isrsmp.c              |    3 ---
 cpukit/score/src/schedulersimplesmp.c  |    9 +++++++++
 cpukit/score/src/smp.c                 |   21 ---------------------
 cpukit/score/src/threaddispatch.c      |    5 -----
 5 files changed, 9 insertions(+), 37 deletions(-)

diff --git a/cpukit/score/include/rtems/score/smp.h b/cpukit/score/include/rtems/score/smp.h
index fedf9ab..2c2b46a 100644
--- a/cpukit/score/include/rtems/score/smp.h
+++ b/cpukit/score/include/rtems/score/smp.h
@@ -96,14 +96,6 @@ void _SMP_Broadcast_message(
 void _SMP_Request_other_cores_to_perform_first_context_switch(void);
 
 /**
- *  @brief Request dispatch on other cores.
- *
- *  Send message to other cores requesting them to perform
- *  a thread dispatch operation.
- */
-void _SMP_Request_other_cores_to_dispatch(void);
-
-/**
  *  @brief Request other cores to shutdown.
  *
  *  Send message to other cores requesting them to shutdown.
diff --git a/cpukit/score/src/isrsmp.c b/cpukit/score/src/isrsmp.c
index 9244287..d97c9c3 100644
--- a/cpukit/score/src/isrsmp.c
+++ b/cpukit/score/src/isrsmp.c
@@ -96,8 +96,5 @@ int _ISR_SMP_Exit(void)
 
   _Thread_Dispatch_decrement_disable_level();
 
-   if ( retval == 0 )
-    _SMP_Request_other_cores_to_dispatch();
-
   return retval;
 }
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index ec1b0e2..2329c1a 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -56,9 +56,18 @@ static void _Scheduler_simple_smp_Allocate_processor(
   }
 
   if ( heir != victim ) {
+    Per_CPU_Control *cpu_of_executing =
+      &_Per_CPU_Information[ _SMP_Get_current_processor() ];
+
     heir->cpu = cpu_of_victim;
     cpu_of_victim->heir = heir;
     cpu_of_victim->dispatch_necessary = true;
+
+    if ( cpu_of_victim != cpu_of_executing ) {
+      _CPU_SMP_Send_interrupt(
+        cpu_of_victim - &_Per_CPU_Information[ 0 ]
+      );
+    }
   }
 }
 
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 4d2a1b5..6cd4fdd 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -162,27 +162,6 @@ void _SMP_Request_other_cores_to_perform_first_context_switch( void )
   }
 }
 
-void _SMP_Request_other_cores_to_dispatch( void )
-{
-  if ( _System_state_Is_up( _System_state_Get() ) ) {
-    uint32_t self = _SMP_Get_current_processor();
-    uint32_t ncpus = _SMP_Get_processor_count();
-    uint32_t cpu;
-
-    for ( cpu = 0 ; cpu < ncpus ; ++cpu ) {
-      const Per_CPU_Control *per_cpu = &_Per_CPU_Information[ cpu ];
-
-      if (
-        cpu != self
-          && per_cpu->state == PER_CPU_STATE_UP
-          && per_cpu->dispatch_necessary
-      ) {
-        _SMP_Send_message( cpu, 0 );
-      }
-    }
-  }
-}
-
 void _SMP_Request_other_cores_to_shutdown( void )
 {
   uint32_t self = _SMP_Get_current_processor();
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index 7000220..9ef5618 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -80,11 +80,6 @@ void _Thread_Dispatch( void )
      * once someone calls _Thread_Dispatch().
      */
     _Thread_Disable_dispatch();
-
-    /*
-     *  If necessary, send dispatch request to other cores.
-     */
-    _SMP_Request_other_cores_to_dispatch();
   #endif
 
   /*
-- 
1.7.7




More information about the devel mailing list