From f410b31be4687746003d53568ee30854b848468e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 11 Apr 2019 15:39:36 +0200 Subject: score: Improve _SMP_Multicast_action() Let it work during system initialization. --- cpukit/score/src/percpu.c | 2 ++ cpukit/score/src/smpmulticastaction.c | 27 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) (limited to 'cpukit/score/src') diff --git a/cpukit/score/src/percpu.c b/cpukit/score/src/percpu.c index 0e4c0678e7..79e940005c 100644 --- a/cpukit/score/src/percpu.c +++ b/cpukit/score/src/percpu.c @@ -89,6 +89,7 @@ static void _Per_CPU_State_busy_wait( state != PER_CPU_STATE_READY_TO_START_MULTITASKING && state != PER_CPU_STATE_SHUTDOWN ) { + _Per_CPU_Perform_jobs( cpu ); _CPU_SMP_Processor_event_receive(); state = cpu->state; } @@ -99,6 +100,7 @@ static void _Per_CPU_State_busy_wait( && state != PER_CPU_STATE_SHUTDOWN ) { _Per_CPU_State_before_multitasking_action( cpu ); + _Per_CPU_Perform_jobs( cpu ); _CPU_SMP_Processor_event_receive(); state = cpu->state; } diff --git a/cpukit/score/src/smpmulticastaction.c b/cpukit/score/src/smpmulticastaction.c index a1df0269e1..966a119217 100644 --- a/cpukit/score/src/smpmulticastaction.c +++ b/cpukit/score/src/smpmulticastaction.c @@ -32,7 +32,6 @@ #include #include #include -#include typedef struct Per_CPU_Job Per_CPU_Job; @@ -181,11 +180,30 @@ static void _SMP_Wait_for_action_jobs( for ( cpu_index = 0; cpu_index < cpu_max; ++cpu_index ) { if ( _Processor_mask_Is_set( targets, cpu_index ) ) { const Per_CPU_Job *job; + Per_CPU_Control *cpu; job = &jobs->Jobs[ cpu_index ]; + cpu = _Per_CPU_Get_by_index( cpu_index ); while ( _Atomic_Load_ulong( &job->done, ATOMIC_ORDER_ACQUIRE ) == 0 ) { - _Per_CPU_Try_perform_jobs( cpu_self ); + switch ( cpu->state ) { + case PER_CPU_STATE_INITIAL: + case PER_CPU_STATE_READY_TO_START_MULTITASKING: + case PER_CPU_STATE_REQUEST_START_MULTITASKING: + _CPU_SMP_Processor_event_broadcast(); + /* Fall through */ + case PER_CPU_STATE_UP: + /* + * Calling this function with the current processor is intentional. + * We have to perform our own jobs here in case inter-processor + * interrupts are not working. + */ + _Per_CPU_Try_perform_jobs( cpu_self ); + break; + default: + _SMP_Fatal( SMP_FATAL_WRONG_CPU_STATE_TO_PERFORM_JOBS ); + break; + } } } } @@ -204,11 +222,6 @@ void _SMP_Multicast_action( cpu_max = _SMP_Get_processor_maximum(); _Assert( cpu_max <= CPU_MAXIMUM_PROCESSORS ); - if ( ! _System_state_Is_up( _System_state_Get() ) ) { - ( *handler )( arg ); - return; - } - if ( targets == NULL ) { targets = _SMP_Get_online_processors(); } -- cgit v1.2.3