Changed for consistency with other scheduler operations. Update #2556. --- cpukit/score/include/rtems/score/scheduler.h | 3 ++- cpukit/score/include/rtems/score/scheduleredf.h | 14 ++--------- .../score/include/rtems/score/scheduleredfimpl.h | 9 ++++---- cpukit/score/include/rtems/score/schedulerimpl.h | 16 +++++++++---- .../score/include/rtems/score/schedulerpriority.h | 14 ++--------- .../rtems/score/schedulerpriorityaffinitysmp.h | 11 ++------- .../include/rtems/score/schedulerpriorityimpl.h | 13 +++++++---- .../include/rtems/score/schedulerprioritysmp.h | 3 ++- cpukit/score/include/rtems/score/schedulersimple.h | 14 ++--------- .../include/rtems/score/schedulersimpleimpl.h | 4 +++- .../score/include/rtems/score/schedulersimplesmp.h | 3 ++- .../score/include/rtems/score/schedulersmpimpl.h | 27 +++++++++++++--------- .../score/include/rtems/score/schedulerstrongapa.h | 3 ++- cpukit/score/src/scheduleredfblock.c | 4 +++- cpukit/score/src/schedulerpriorityaffinitysmp.c | 6 +++-- cpukit/score/src/schedulerpriorityblock.c | 4 +++- cpukit/score/src/schedulerprioritysmp.c | 4 +++- cpukit/score/src/schedulersimpleblock.c | 4 +++- cpukit/score/src/schedulersimplechangepriority.c | 2 +- cpukit/score/src/schedulersimplesmp.c | 4 +++- cpukit/score/src/schedulerstrongapa.c | 4 +++- testsuites/smptests/smpscheduler03/init.c | 9 +++++--- 22 files changed, 89 insertions(+), 86 deletions(-)
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h index 745fbec..eb8db7c 100644 --- a/cpukit/score/include/rtems/score/scheduler.h +++ b/cpukit/score/include/rtems/score/scheduler.h @@ -72,7 +72,8 @@ typedef struct { /** @see _Scheduler_Block() */ void ( *block )( const Scheduler_Control *, - Thread_Control * + Thread_Control *, + Scheduler_Node * ); /** @see _Scheduler_Unblock() */ diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h index 005f2da..2ecf1a4 100644 --- a/cpukit/score/include/rtems/score/scheduleredf.h +++ b/cpukit/score/include/rtems/score/scheduleredf.h @@ -108,20 +108,10 @@ typedef struct { */ void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler ); -/** - * @brief Removes thread from ready queue. - * - * This routine removes @a the_thread from the scheduling decision, - * that is, removes it from the ready queue. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - * - * @param[in] scheduler The scheduler instance. - * @param[in] the_thread is the thread to be blocked. - */ void _Scheduler_EDF_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ); /** diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h index 61acedd..bfb5b45 100644 --- a/cpukit/score/include/rtems/score/scheduleredfimpl.h +++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h @@ -136,16 +136,17 @@ RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract( RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract_body( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { Scheduler_EDF_Context *context; - Scheduler_EDF_Node *node; + Scheduler_EDF_Node *the_node; context = _Scheduler_EDF_Get_context( scheduler ); - node = _Scheduler_EDF_Thread_get_node( the_thread ); + the_node = _Scheduler_EDF_Node_downcast( node ); - _Scheduler_EDF_Extract( context, node ); + _Scheduler_EDF_Extract( context, the_node ); } RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body( diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index a431a3a..e630cc2 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -330,7 +330,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block( Thread_Control *the_thread ) scheduler = _Scheduler_Get( the_thread ); _Scheduler_Acquire_critical( scheduler, &lock_context ); - ( *scheduler->Operations.block )( scheduler, the_thread ); + ( *scheduler->Operations.block )( + scheduler, + the_thread, + _Thread_Scheduler_get_home_node( the_thread ) + ); _Scheduler_Release_critical( scheduler, &lock_context ); } @@ -708,16 +712,20 @@ bool _Scheduler_Set_affinity( RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block( const Scheduler_Control *scheduler, Thread_Control *the_thread, + Scheduler_Node *node, void ( *extract )( const Scheduler_Control *, - Thread_Control * ), + Thread_Control *, + Scheduler_Node * + ), void ( *schedule )( const Scheduler_Control *, Thread_Control *, - bool ) + bool + ) ) { - ( *extract )( scheduler, the_thread ); + ( *extract )( scheduler, the_thread, node ); /* TODO: flash critical section? */ diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h index 175def4..89912aa 100644 --- a/cpukit/score/include/rtems/score/schedulerpriority.h +++ b/cpukit/score/include/rtems/score/schedulerpriority.h @@ -111,20 +111,10 @@ typedef struct { */ void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler ); -/** - * @brief Removes @a the_thread from the scheduling decision. - * - * This routine removes @a the_thread from the scheduling decision, - * that is, removes it from the ready queue. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - * - * @param[in] scheduler The scheduler instance. - * @param[in] the_thread is the thread to be blocked - */ void _Scheduler_priority_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ); /** diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h index be28dec..bc3ea49 100644 --- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h +++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @@ -86,17 +86,10 @@ void _Scheduler_priority_affinity_SMP_Node_initialize( Priority_Control priority ); -/** - * @brief SMP Priority Affinity Scheduler Block Operation - * - * This method is the block operation for this scheduler. - * - * @param[in] scheduler is the scheduler instance information - * @param[in] thread is the thread to block - */ void _Scheduler_priority_affinity_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ); /** diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h index 38f9f5b..e9e9873 100644 --- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h +++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h @@ -140,16 +140,19 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract( RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { - Scheduler_priority_Context *context = - _Scheduler_priority_Get_context( scheduler ); - Scheduler_priority_Node *node = _Scheduler_priority_Thread_get_node( the_thread ); + Scheduler_priority_Context *context; + Scheduler_priority_Node *the_node; + + context = _Scheduler_priority_Get_context( scheduler ); + the_node = _Scheduler_priority_Node_downcast( node ); _Scheduler_priority_Ready_queue_extract( &the_thread->Object.Node, - &node->Ready_queue, + &the_node->Ready_queue, &context->Bit_map ); } diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h index 8350038..de37d34 100644 --- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h +++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h @@ -107,7 +107,8 @@ void _Scheduler_priority_SMP_Node_initialize( void _Scheduler_priority_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ); Thread_Control *_Scheduler_priority_SMP_Unblock( diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h index d8bc02e..4ef0db8 100644 --- a/cpukit/score/include/rtems/score/schedulersimple.h +++ b/cpukit/score/include/rtems/score/schedulersimple.h @@ -98,20 +98,10 @@ Scheduler_Void_or_thread _Scheduler_simple_Yield( Scheduler_Node *node ); -/** - * @brief Remove a simple-priority-based thread from the queue. - * - * This routine removes @a the_thread from the scheduling decision, - * that is, removes it from the ready queue. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - * - * @param[in] scheduler The scheduler instance. - * @param[in] the_thread is the thread that is to be blocked - */ void _Scheduler_simple_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ); /** diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h index 85951fa..c94f9b3 100644 --- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h +++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h @@ -88,10 +88,12 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo( RTEMS_INLINE_ROUTINE void _Scheduler_simple_Extract( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { (void) scheduler; + (void) node; _Chain_Extract_unprotected( &the_thread->Object.Node ); } diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h index 36f5fb3..db36b84 100644 --- a/cpukit/score/include/rtems/score/schedulersimplesmp.h +++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h @@ -90,7 +90,8 @@ void _Scheduler_simple_SMP_Node_initialize( void _Scheduler_simple_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ); Thread_Control *_Scheduler_simple_SMP_Unblock( diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h index 6deb160..f797735 100644 --- a/cpukit/score/include/rtems/score/schedulersmpimpl.h +++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h @@ -868,6 +868,7 @@ static inline void _Scheduler_SMP_Schedule_highest_ready( * * @param[in] context The scheduler instance context. * @param[in] thread The thread of the scheduling operation. + * @param[in] node The scheduler node of the thread to block. * @param[in] extract_from_ready Function to extract a node from the set of * ready nodes. * @param[in] get_highest_ready Function to get the highest ready node. @@ -877,41 +878,45 @@ static inline void _Scheduler_SMP_Schedule_highest_ready( static inline void _Scheduler_SMP_Block( Scheduler_Context *context, Thread_Control *thread, + Scheduler_Node *node, Scheduler_SMP_Extract extract_from_ready, Scheduler_SMP_Get_highest_ready get_highest_ready, Scheduler_SMP_Move move_from_ready_to_scheduled, Scheduler_SMP_Allocate_processor allocate_processor ) { - Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_node( thread ); - bool is_scheduled = node->state == SCHEDULER_SMP_NODE_SCHEDULED; - bool block; + Scheduler_SMP_Node_state node_state; + bool block; - _Assert( is_scheduled || node->state == SCHEDULER_SMP_NODE_READY ); + node_state = _Scheduler_SMP_Node_state( node ); + _Assert( node_state != SCHEDULER_SMP_NODE_BLOCKED ); block = _Scheduler_Block_node( context, thread, - &node->Base, - is_scheduled, + node, + node_state == SCHEDULER_SMP_NODE_SCHEDULED, _Scheduler_SMP_Get_idle_thread ); if ( block ) { - _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED ); + _Scheduler_SMP_Node_change_state( + _Scheduler_SMP_Node_downcast( node ), + SCHEDULER_SMP_NODE_BLOCKED + ); - if ( is_scheduled ) { - _Scheduler_SMP_Extract_from_scheduled( &node->Base ); + if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) { + _Scheduler_SMP_Extract_from_scheduled( node ); _Scheduler_SMP_Schedule_highest_ready( context, - &node->Base, + node, extract_from_ready, get_highest_ready, move_from_ready_to_scheduled, allocate_processor ); } else { - ( *extract_from_ready )( context, &node->Base ); + ( *extract_from_ready )( context, node ); } } } diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h index aa352e2..a83616c 100644 --- a/cpukit/score/include/rtems/score/schedulerstrongapa.h +++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h @@ -107,7 +107,8 @@ void _Scheduler_strong_APA_Node_initialize( void _Scheduler_strong_APA_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ); Thread_Control *_Scheduler_strong_APA_Unblock( diff --git a/cpukit/score/src/scheduleredfblock.c b/cpukit/score/src/scheduleredfblock.c index 80cb83d..1269e8e 100644 --- a/cpukit/score/src/scheduleredfblock.c +++ b/cpukit/score/src/scheduleredfblock.c @@ -23,12 +23,14 @@ void _Scheduler_EDF_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { _Scheduler_Generic_block( scheduler, the_thread, + node, _Scheduler_EDF_Extract_body, _Scheduler_EDF_Schedule_body ); diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c index 9282b1a..451df88 100644 --- a/cpukit/score/src/schedulerpriorityaffinitysmp.c +++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c @@ -190,7 +190,8 @@ static Scheduler_Node *_Scheduler_priority_affinity_SMP_Get_highest_ready( */ void _Scheduler_priority_affinity_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ) { Scheduler_Context *context = _Scheduler_Get_context( scheduler ); @@ -198,6 +199,7 @@ void _Scheduler_priority_affinity_SMP_Block( _Scheduler_SMP_Block( context, thread, + node, _Scheduler_priority_SMP_Extract_from_ready, _Scheduler_priority_affinity_SMP_Get_highest_ready, _Scheduler_priority_SMP_Move_from_ready_to_scheduled, @@ -599,7 +601,7 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity( current_state = thread->current_state; if ( _States_Is_ready( current_state ) ) { - _Scheduler_priority_affinity_SMP_Block( scheduler, thread ); + _Scheduler_priority_affinity_SMP_Block( scheduler, thread, &node->Base.Base.Base ); } CPU_COPY( node->Affinity.set, cpuset ); diff --git a/cpukit/score/src/schedulerpriorityblock.c b/cpukit/score/src/schedulerpriorityblock.c index ba3c825..611c4cd 100644 --- a/cpukit/score/src/schedulerpriorityblock.c +++ b/cpukit/score/src/schedulerpriorityblock.c @@ -24,12 +24,14 @@ void _Scheduler_priority_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { _Scheduler_Generic_block( scheduler, the_thread, + node, _Scheduler_priority_Extract_body, _Scheduler_priority_Schedule_body ); diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c index 3c88161..ab3e663 100644 --- a/cpukit/score/src/schedulerprioritysmp.c +++ b/cpukit/score/src/schedulerprioritysmp.c @@ -92,7 +92,8 @@ static Scheduler_Node *_Scheduler_priority_SMP_Get_highest_ready( void _Scheduler_priority_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ) { Scheduler_Context *context = _Scheduler_Get_context( scheduler ); @@ -100,6 +101,7 @@ void _Scheduler_priority_SMP_Block( _Scheduler_SMP_Block( context, thread, + node, _Scheduler_priority_SMP_Extract_from_ready, _Scheduler_priority_SMP_Get_highest_ready, _Scheduler_priority_SMP_Move_from_ready_to_scheduled, diff --git a/cpukit/score/src/schedulersimpleblock.c b/cpukit/score/src/schedulersimpleblock.c index ad409bb..2fd50b7 100644 --- a/cpukit/score/src/schedulersimpleblock.c +++ b/cpukit/score/src/schedulersimpleblock.c @@ -23,12 +23,14 @@ void _Scheduler_simple_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { _Scheduler_Generic_block( scheduler, the_thread, + node, _Scheduler_simple_Extract, _Scheduler_simple_Schedule_body ); diff --git a/cpukit/score/src/schedulersimplechangepriority.c b/cpukit/score/src/schedulersimplechangepriority.c index e430c75..cad75f8 100644 --- a/cpukit/score/src/schedulersimplechangepriority.c +++ b/cpukit/score/src/schedulersimplechangepriority.c @@ -38,7 +38,7 @@ Scheduler_Void_or_thread _Scheduler_simple_Update_priority( context = _Scheduler_simple_Get_context( scheduler ); _Scheduler_Node_get_priority( node, &prepend_it ); - _Scheduler_simple_Extract( scheduler, the_thread ); + _Scheduler_simple_Extract( scheduler, the_thread, node ); if ( prepend_it ) { _Scheduler_simple_Insert_priority_lifo( &context->Ready, the_thread ); diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c index b476c08..3d4efea 100644 --- a/cpukit/score/src/schedulersimplesmp.c +++ b/cpukit/score/src/schedulersimplesmp.c @@ -159,7 +159,8 @@ static void _Scheduler_simple_SMP_Extract_from_ready( void _Scheduler_simple_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ) { Scheduler_Context *context = _Scheduler_Get_context( scheduler ); @@ -167,6 +168,7 @@ void _Scheduler_simple_SMP_Block( _Scheduler_SMP_Block( context, thread, + node, _Scheduler_simple_SMP_Extract_from_ready, _Scheduler_simple_SMP_Get_highest_ready, _Scheduler_simple_SMP_Move_from_ready_to_scheduled, diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c index 2b2f4e4..b5a5545 100644 --- a/cpukit/score/src/schedulerstrongapa.c +++ b/cpukit/score/src/schedulerstrongapa.c @@ -218,7 +218,8 @@ static Scheduler_Node *_Scheduler_strong_APA_Get_highest_ready( void _Scheduler_strong_APA_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { Scheduler_Context *context = _Scheduler_Get_context( scheduler ); @@ -226,6 +227,7 @@ void _Scheduler_strong_APA_Block( _Scheduler_SMP_Block( context, the_thread, + node, _Scheduler_strong_APA_Extract_from_ready, _Scheduler_strong_APA_Get_highest_ready, _Scheduler_strong_APA_Move_from_ready_to_scheduled, diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c index f9588a3..dc3507f 100644 --- a/testsuites/smptests/smpscheduler03/init.c +++ b/testsuites/smptests/smpscheduler03/init.c @@ -460,7 +460,10 @@ static void test_yield_op(void) rtems_test_assert(sc == RTEMS_SUCCESSFUL); } -static void block_op(Thread_Control *thread) +static void block_op( + Thread_Control *thread, + Scheduler_SMP_Node *scheduler_node +) { const Scheduler_Control *scheduler; ISR_lock_Context state_lock_context; @@ -470,7 +473,7 @@ static void block_op(Thread_Control *thread) scheduler = _Scheduler_Get( thread ); _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); - (*scheduler->Operations.block)(scheduler, thread); + (*scheduler->Operations.block)(scheduler, thread, &scheduler_node->Base); _Scheduler_Release_critical( scheduler, &scheduler_lock_context ); _Thread_State_release( thread, &state_lock_context ); @@ -521,7 +524,7 @@ static void test_case_unblock_op( break; } - block_op(executing); + block_op(executing, executing_node); rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_BLOCKED); needs_help = unblock_op(executing); -- 1.8.4.5 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel