score: Rework SMP multicast action

Use a FIFO list of jobs per processor to carry out the SMP multicast
action.  Use a done indicator per job to reduce the bus traffic a bit.
This commit is contained in:
Sebastian Huber committed 2019-04-12 09:44:48 +02:00
1 parent df8d7bd76f
commit e90486ab41
6 files changed
+224 -85

No files matched your search

+40
View File
@@ -74,6 +74,8 @@ struct _Thread_Control;
struct Scheduler_Context;
struct Per_CPU_Job;
/**
* @defgroup PerCPU RTEMS Per CPU Information
*
@@ -494,6 +496,37 @@ typedef struct Per_CPU_Control {
*/
Atomic_Uintptr before_multitasking_action;
/**
* @brief FIFO list of jobs to be performed by this processor.
*
* @see _SMP_Multicast_action().
*/
struct {
/**
* @brief Lock to protect the FIFO list of jobs to be performed by this
* processor.
*/
ISR_lock_Control Lock;
/**
* @brief Head of the FIFO list of jobs to be performed by this
* processor.
*
* This member is protected by the Per_CPU_Control::Jobs::Lock lock.
*/
struct Per_CPU_Job *head;
/**
* @brief Tail of the FIFO list of jobs to be performed by this
* processor.
*
* This member is only valid if the head is not @c NULL.
*
* This member is protected by the Per_CPU_Control::Jobs::Lock lock.
*/
struct Per_CPU_Job **tail;
} Jobs;
/**
* @brief Indicates if the processor has been successfully started via
* _CPU_SMP_Start_processor().
@@ -710,6 +743,13 @@ bool _Per_CPU_State_wait_for_non_initial_state(
uint32_t timeout_in_ns
);
/**
* @brief Performs the jobs of the specified processor.
*
* @param[in, out] cpu The jobs of this processor will be performed.
*/
void _Per_CPU_Perform_jobs( Per_CPU_Control *cpu );
#endif /* defined( RTEMS_SMP ) */
/*
+4 -9
View File
@@ -51,11 +51,11 @@ extern "C" {
#define SMP_MESSAGE_TEST 0x2UL
/**
* @brief SMP message to request a multicast action.
* @brief SMP message to perform per-processor jobs.
*
* @see _SMP_Send_message().
*/
#define SMP_MESSAGE_MULTICAST_ACTION 0x4UL
#define SMP_MESSAGE_PERFORM_JOBS 0x4UL
/**
* @brief SMP message to request a clock tick.
@@ -157,11 +157,6 @@ static inline void _SMP_Set_test_message_handler(
_SMP_Test_message_handler = handler;
}
/**
* @brief Processes all pending multicast actions.
*/
void _SMP_Multicast_actions_process( void );
/**
* @brief Interrupt handler for inter-processor interrupts.
*
@@ -195,8 +190,8 @@ static inline long unsigned _SMP_Inter_processor_interrupt_handler(
( *_SMP_Test_message_handler )( cpu_self );
}
if ( ( message & SMP_MESSAGE_MULTICAST_ACTION ) != 0 ) {
_SMP_Multicast_actions_process();
if ( ( message & SMP_MESSAGE_PERFORM_JOBS ) != 0 ) {
_Per_CPU_Perform_jobs( cpu_self );
}
}
+1
View File
@@ -118,6 +118,7 @@ void _SMP_Handler_initialize( void )
cpu = _Per_CPU_Get_by_index( cpu_index );
_ISR_lock_Set_name( &cpu->Lock, "Per-CPU" );
_ISR_lock_Set_name( &cpu->Jobs.Lock, "Per-CPU Jobs" );
_ISR_lock_Set_name( &cpu->Watchdog.Lock, "Per-CPU Watchdog" );
_Chain_Initialize_empty( &cpu->Threads_in_need_for_help );
}
File diff suppressed because it is too large. Load diff
+4 -1
View File
@@ -126,12 +126,15 @@ static void call_tests_isr_disabled( SMP_barrier_State *bs )
broadcast_test_init();
for (i = 0; i < RTEMS_ARRAY_SIZE( test_cases ); ++i) {
ISR_Level isr_level;
Per_CPU_Control *cpu_self;
ISR_Level isr_level;
cpu_self = _Thread_Dispatch_disable();
_ISR_Local_disable( isr_level );
barrier( bs );
( *test_cases[ i ] )();
_ISR_Local_enable( isr_level );
_Thread_Dispatch_enable( cpu_self );
barrier( bs );
}
@@ -59,11 +59,14 @@ static void multicast_action_irq_disabled(
void *arg
)
{
Per_CPU_Control *cpu_self;
rtems_interrupt_level level;
cpu_self = _Thread_Dispatch_disable();
rtems_interrupt_local_disable(level);
_SMP_Multicast_action(targets, handler, arg);
rtems_interrupt_local_enable(level);
_Thread_Dispatch_enable(cpu_self);
}
static void multicast_action_dispatch_disabled(