forked from Imagelibrary/rtems
smp: Delete _SMP_Request_other_cores_to_dispatch()
Use an event triggered unicast to inform remote processors about a necessary thread dispatch instead.
This commit is contained in:
@@ -95,14 +95,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.
|
||||
*
|
||||
|
||||
@@ -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__)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user