summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-14 09:14:31 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-30 09:53:25 +0200
commitd5ef7ae2a36bee532702d609f1dbb209cc47dd29 (patch)
treefe23444d0b02c06e7447ab169c88f7a16258bf5f
parent3f317e9033d45ffb8939e60b4105d4980046ab59 (diff)
downloadrtems-d5ef7ae2a36bee532702d609f1dbb209cc47dd29.tar.bz2
smp: Delete _SMP_Request_other_cores_to_dispatch()
Use an event triggered unicast to inform remote processors about a necessary thread dispatch instead.
-rw-r--r--cpukit/score/include/rtems/score/smp.h8
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h15
-rw-r--r--cpukit/score/src/isrsmp.c3
-rw-r--r--cpukit/score/src/schedulersimplesmp.c6
-rw-r--r--cpukit/score/src/smp.c21
-rw-r--r--cpukit/score/src/threaddispatch.c5
-rw-r--r--cpukit/score/src/threadinitialize.c4
7 files changed, 23 insertions, 39 deletions
diff --git a/cpukit/score/include/rtems/score/smp.h b/cpukit/score/include/rtems/score/smp.h
index fedf9ab6d7..2c2b46ab32 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/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 7a48c2684b..f5a0ff9faa 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -634,8 +634,21 @@ RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_global_exit_status( void )
RTEMS_INLINE_ROUTINE void _Thread_Signal_notification( Thread_Control *thread )
{
- if ( _ISR_Is_in_progress() && _Thread_Is_executing( thread ) )
+ if ( _ISR_Is_in_progress() && _Thread_Is_executing( thread ) ) {
_Thread_Dispatch_necessary = true;
+ } else {
+#if defined(RTEMS_SMP)
+ if ( thread->is_executing ) {
+ const Per_CPU_Control *cpu_of_executing = _Per_CPU_Get();
+ Per_CPU_Control *cpu_of_thread = thread->cpu;
+
+ if ( cpu_of_executing != cpu_of_thread ) {
+ cpu_of_thread->dispatch_necessary = true;
+ _Per_CPU_Send_interrupt( cpu_of_thread );
+ }
+ }
+#endif
+ }
}
#if !defined(__DYNAMIC_REENT__)
diff --git a/cpukit/score/src/isrsmp.c b/cpukit/score/src/isrsmp.c
index c743f92fd9..2f292b0bea 100644
--- a/cpukit/score/src/isrsmp.c
+++ b/cpukit/score/src/isrsmp.c
@@ -72,8 +72,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 55c40a67e8..aeef215b3a 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -58,9 +58,15 @@ static void _Scheduler_simple_smp_Allocate_processor(
}
if ( heir != victim ) {
+ const Per_CPU_Control *cpu_of_executing = _Per_CPU_Get();
+
heir->cpu = cpu_of_victim;
cpu_of_victim->heir = heir;
cpu_of_victim->dispatch_necessary = true;
+
+ if ( cpu_of_victim != cpu_of_executing ) {
+ _Per_CPU_Send_interrupt( cpu_of_victim );
+ }
}
}
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 35e8a01b90..5b299b4feb 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -165,27 +165,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 ac906e44d9..c5d0a2199b 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -65,11 +65,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();
#else
_Thread_Dispatch_set_disable_level( 1 );
#endif
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index bd0031fa7c..a87614721a 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -181,7 +181,9 @@ bool _Thread_Initialize(
#if defined(RTEMS_SMP)
the_thread->is_scheduled = false;
the_thread->is_executing = false;
- the_thread->cpu = NULL;
+
+ /* Initialize the cpu field for the non-SMP schedulers */
+ the_thread->cpu = _Per_CPU_Get_by_index( 0 );
#endif
the_thread->current_state = STATES_DORMANT;