[rtems commit] score: _SMP_Inter_processor_interrupt_handler()

Sebastian Huber sebh at rtems.org
Wed Feb 19 08:52:43 UTC 2014


Module:    rtems
Branch:    master
Commit:    8a65a960071c6b67731c7330603acc0f5cc150a5
Changeset: http://git.rtems.org/rtems/commit/?id=8a65a960071c6b67731c7330603acc0f5cc150a5

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Feb 18 13:36:35 2014 +0100

score: _SMP_Inter_processor_interrupt_handler()

Inline _SMP_Inter_processor_interrupt_handler() to avoid function call
overhead.  Remove debug output.

---

 cpukit/score/include/rtems/score/smpimpl.h |   24 +++++++++++++++-
 cpukit/score/src/smp.c                     |   41 ----------------------------
 2 files changed, 23 insertions(+), 42 deletions(-)

diff --git a/cpukit/score/include/rtems/score/smpimpl.h b/cpukit/score/include/rtems/score/smpimpl.h
index cbb3466..d68af43 100644
--- a/cpukit/score/include/rtems/score/smpimpl.h
+++ b/cpukit/score/include/rtems/score/smpimpl.h
@@ -19,6 +19,8 @@
 #define _RTEMS_SCORE_SMPIMPL_H
 
 #include <rtems/score/smp.h>
+#include <rtems/score/percpu.h>
+#include <rtems/fatal.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -92,7 +94,27 @@ void _SMP_Start_multitasking_on_secondary_processor( void )
 /**
  * @brief Interrupt handler for inter-processor interrupts.
  */
-void _SMP_Inter_processor_interrupt_handler( void );
+static inline void _SMP_Inter_processor_interrupt_handler( void )
+{
+  Per_CPU_Control *self_cpu = _Per_CPU_Get();
+
+  if ( self_cpu->message != 0 ) {
+    uint32_t  message;
+    ISR_Level level;
+
+    _Per_CPU_ISR_disable_and_acquire( self_cpu, level );
+    message = self_cpu->message;
+    self_cpu->message = 0;
+    _Per_CPU_Release_and_ISR_enable( self_cpu, level );
+
+    if ( ( message & SMP_MESSAGE_SHUTDOWN ) != 0 ) {
+      _Per_CPU_Change_state( self_cpu, PER_CPU_STATE_SHUTDOWN );
+
+      rtems_fatal( RTEMS_FATAL_SOURCE_SMP, SMP_FATAL_SHUTDOWN );
+      /* does not continue past here */
+    }
+  }
+}
 
 /**
  *  @brief Sends a SMP message to a processor.
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 1353d14..59036eb 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -23,7 +23,6 @@
 #include <rtems/score/threaddispatch.h>
 #include <rtems/score/threadimpl.h>
 #include <rtems/config.h>
-#include <rtems/fatal.h>
 
 #if defined(RTEMS_DEBUG)
   #include <rtems/bspIo.h>
@@ -63,46 +62,6 @@ void _SMP_Start_multitasking_on_secondary_processor( void )
   _Thread_Start_multitasking();
 }
 
-void _SMP_Inter_processor_interrupt_handler( void )
-{
-  Per_CPU_Control *self_cpu = _Per_CPU_Get();
-
-
-  if ( self_cpu->message != 0 ) {
-    uint32_t  message;
-    ISR_Level level;
-
-    _Per_CPU_ISR_disable_and_acquire( self_cpu, level );
-    message = self_cpu->message;
-    self_cpu->message = 0;
-    _Per_CPU_Release_and_ISR_enable( self_cpu, level );
-
-    #if defined(RTEMS_DEBUG)
-      {
-        void *sp = __builtin_frame_address(0);
-        if ( !(message & SMP_MESSAGE_SHUTDOWN) ) {
-          printk(
-            "ISR on CPU %d -- (0x%02x) (0x%p)\n",
-            _Per_CPU_Get_index( self_cpu ),
-            message,
-            sp
-          );
-          if ( message & SMP_MESSAGE_SHUTDOWN )
-            printk( "shutdown\n" );
-        }
-        printk( "Dispatch level %d\n", _Thread_Dispatch_get_disable_level() );
-      }
-    #endif
-
-    if ( ( message & SMP_MESSAGE_SHUTDOWN ) != 0 ) {
-      _Per_CPU_Change_state( self_cpu, PER_CPU_STATE_SHUTDOWN );
-
-      rtems_fatal( RTEMS_FATAL_SOURCE_SMP, SMP_FATAL_SHUTDOWN );
-      /* does not continue past here */
-    }
-  }
-}
-
 void _SMP_Send_message( uint32_t cpu, uint32_t message )
 {
   Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu );




More information about the vc mailing list