From ad40d05eba230a2c7b78cea9b8c612cc84de5b5e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 12 Apr 2019 07:55:31 +0200 Subject: score: Remove _SMP_Before_multitasking_action() Use _SMP_Multicast_action() instead. --- cpukit/include/rtems/score/percpu.h | 8 ----- cpukit/include/rtems/score/smpimpl.h | 44 ----------------------- cpukit/score/src/percpu.c | 70 ------------------------------------ cpukit/score/src/smp.c | 26 -------------- 4 files changed, 148 deletions(-) (limited to 'cpukit') diff --git a/cpukit/include/rtems/score/percpu.h b/cpukit/include/rtems/score/percpu.h index cd7713db6d..589d2ab63d 100644 --- a/cpukit/include/rtems/score/percpu.h +++ b/cpukit/include/rtems/score/percpu.h @@ -488,14 +488,6 @@ typedef struct Per_CPU_Control { */ Per_CPU_State state; - /** - * @brief Action to be executed by this processor in the - * SYSTEM_STATE_BEFORE_MULTITASKING state on behalf of the boot processor. - * - * @see _SMP_Before_multitasking_action(). - */ - Atomic_Uintptr before_multitasking_action; - /** * @brief FIFO list of jobs to be performed by this processor. * diff --git a/cpukit/include/rtems/score/smpimpl.h b/cpukit/include/rtems/score/smpimpl.h index 9d76eb5a23..d769565b9d 100644 --- a/cpukit/include/rtems/score/smpimpl.h +++ b/cpukit/include/rtems/score/smpimpl.h @@ -260,50 +260,6 @@ void _SMP_Multicast_action( void *arg ); -/** - * @brief Executes a handler with argument on the specified processor on behalf - * of the boot processor. - * - * The calling processor must be the boot processor. In case the specified - * processor is not online or not in the - * PER_CPU_STATE_READY_TO_START_MULTITASKING state, then no action is - * performed. - * - * @param cpu The processor to execute the action. - * @param handler The handler of the action. - * @param arg The argument of the action. - * - * @retval true The handler executed on the specified processor. - * @retval false Otherwise. - * - * @see _SMP_Before_multitasking_action_broadcast(). - */ -bool _SMP_Before_multitasking_action( - Per_CPU_Control *cpu, - SMP_Action_handler handler, - void *arg -); - -/** - * @brief Executes a handler with argument on all online processors except the - * boot processor on behalf of the boot processor. - * - * The calling processor must be the boot processor. - * - * @param handler The handler of the action. - * @param arg The argument of the action. - * - * @retval true The handler executed on all online processors except the boot - * processor. - * @retval false Otherwise. - * - * @see _SMP_Before_multitasking_action(). - */ -bool _SMP_Before_multitasking_action_broadcast( - SMP_Action_handler handler, - void *arg -); - #endif /* defined( RTEMS_SMP ) */ /** diff --git a/cpukit/score/src/percpu.c b/cpukit/score/src/percpu.c index 79e940005c..4cc7362bb5 100644 --- a/cpukit/score/src/percpu.c +++ b/cpukit/score/src/percpu.c @@ -36,11 +36,6 @@ RTEMS_STATIC_ASSERT( #if defined(RTEMS_SMP) -typedef struct { - SMP_Action_handler handler; - void *arg; -} SMP_Before_multicast_action; - ISR_LOCK_DEFINE( static, _Per_CPU_State_lock, "Per-CPU State" ) static void _Per_CPU_State_acquire( ISR_lock_Context *lock_context ) @@ -53,29 +48,6 @@ static void _Per_CPU_State_release( ISR_lock_Context *lock_context ) _ISR_lock_Release_and_ISR_enable( &_Per_CPU_State_lock, lock_context ); } -static void _Per_CPU_State_before_multitasking_action( Per_CPU_Control *cpu ) -{ - uintptr_t action_value; - - action_value = _Atomic_Load_uintptr( - &cpu->before_multitasking_action, - ATOMIC_ORDER_ACQUIRE - ); - - if ( action_value != 0 ) { - SMP_Before_multicast_action *action = - (SMP_Before_multicast_action *) action_value; - - ( *action->handler )( action->arg ); - - _Atomic_Store_uintptr( - &cpu->before_multitasking_action, - 0, - ATOMIC_ORDER_RELEASE - ); - } -} - static void _Per_CPU_State_busy_wait( Per_CPU_Control *cpu, Per_CPU_State new_state @@ -99,7 +71,6 @@ static void _Per_CPU_State_busy_wait( state != PER_CPU_STATE_REQUEST_START_MULTITASKING && 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; @@ -206,47 +177,6 @@ void _Per_CPU_State_change( _SMP_Fatal( SMP_FATAL_SHUTDOWN ); } } - -bool _SMP_Before_multitasking_action( - Per_CPU_Control *cpu, - SMP_Action_handler handler, - void *arg -) -{ - bool done; - - _Assert( _Per_CPU_Is_boot_processor( _Per_CPU_Get() ) ); - - if ( _Per_CPU_Is_processor_online( cpu ) ) { - SMP_Before_multicast_action action = { - .handler = handler, - .arg = arg - }; - Per_CPU_State expected_state = PER_CPU_STATE_READY_TO_START_MULTITASKING; - - _Atomic_Store_uintptr( - &cpu->before_multitasking_action, - (uintptr_t) &action, - ATOMIC_ORDER_RELEASE - ); - - _CPU_SMP_Processor_event_broadcast(); - - _Per_CPU_State_busy_wait( cpu, expected_state ); - - do { - done = _Atomic_Load_uintptr( - &cpu->before_multitasking_action, - ATOMIC_ORDER_ACQUIRE - ) == 0; - } while ( !done && cpu->state == expected_state ); - } else { - done = false; - } - - return done; -} - #else /* * On single core systems, we can efficiently directly access a single diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index 027c2e81d8..17d6c8bc67 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -253,30 +253,4 @@ void _SMP_Send_message_multicast( } } -bool _SMP_Before_multitasking_action_broadcast( - SMP_Action_handler handler, - void *arg -) -{ - bool done; - uint32_t cpu_max; - uint32_t cpu_index; - - done = true; - cpu_max = _SMP_Get_processor_maximum(); - - for ( cpu_index = 0 ; done && cpu_index < cpu_max ; ++cpu_index ) { - Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); - - if ( - !_Per_CPU_Is_boot_processor( cpu ) - && _Per_CPU_Is_processor_online( cpu ) - ) { - done = _SMP_Before_multitasking_action( cpu, handler, arg ); - } - } - - return done; -} - SMP_Test_message_handler _SMP_Test_message_handler; -- cgit v1.2.3