summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-03 09:31:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-03 09:37:31 +0200
commit3aad9d9b08950f132e5fb285ef8e9cda2d1b3844 (patch)
treef8de36da9699904afb62250069bc1ffd56839157
parentbsps: BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN (diff)
downloadrtems-3aad9d9b08950f132e5fb285ef8e9cda2d1b3844.tar.bz2
score: Generalize SMP scheduler block support
Add extract from scheduled function to the _Scheduler_SMP_Block() operation. This allows a scheduler implementation to do extra work in case a scheduled node is blocked.
-rw-r--r--cpukit/include/rtems/score/schedulersmpimpl.h19
-rw-r--r--cpukit/score/src/scheduleredfsmp.c3
-rw-r--r--cpukit/score/src/schedulerpriorityaffinitysmp.c1
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c1
-rw-r--r--cpukit/score/src/schedulersimplesmp.c1
-rw-r--r--cpukit/score/src/schedulerstrongapa.c1
6 files changed, 18 insertions, 8 deletions
diff --git a/cpukit/include/rtems/score/schedulersmpimpl.h b/cpukit/include/rtems/score/schedulersmpimpl.h
index e152eb0878..09c95662b6 100644
--- a/cpukit/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/include/rtems/score/schedulersmpimpl.h
@@ -867,9 +867,11 @@ static inline bool _Scheduler_SMP_Enqueue_scheduled(
}
static inline void _Scheduler_SMP_Extract_from_scheduled(
- Scheduler_Node *node
+ Scheduler_Context *context,
+ Scheduler_Node *node
)
{
+ (void) context;
_Chain_Extract_unprotected( &node->Node.Chain );
}
@@ -968,6 +970,8 @@ static inline void _Scheduler_SMP_Preempt_and_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_scheduled Function to extract a node from the set of
+ * scheduled nodes.
* @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.
@@ -978,6 +982,7 @@ static inline void _Scheduler_SMP_Block(
Scheduler_Context *context,
Thread_Control *thread,
Scheduler_Node *node,
+ Scheduler_SMP_Extract extract_from_scheduled,
Scheduler_SMP_Extract extract_from_ready,
Scheduler_SMP_Get_highest_ready get_highest_ready,
Scheduler_SMP_Move move_from_ready_to_scheduled,
@@ -1001,7 +1006,7 @@ static inline void _Scheduler_SMP_Block(
_Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) {
- _Scheduler_SMP_Extract_from_scheduled( node );
+ ( *extract_from_scheduled )( context, node );
_Scheduler_SMP_Schedule_highest_ready(
context,
node,
@@ -1096,7 +1101,7 @@ static inline void _Scheduler_SMP_Update_priority(
node_state = _Scheduler_SMP_Node_state( node );
if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) {
- _Scheduler_SMP_Extract_from_scheduled( node );
+ _Scheduler_SMP_Extract_from_scheduled( context, node );
( *update )( context, node, priority );
( *enqueue_scheduled )( context, node, insert_priority );
} else if ( node_state == SCHEDULER_SMP_NODE_READY ) {
@@ -1130,7 +1135,7 @@ static inline void _Scheduler_SMP_Yield(
insert_priority = SCHEDULER_PRIORITY_APPEND( insert_priority );
if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) {
- _Scheduler_SMP_Extract_from_scheduled( node );
+ _Scheduler_SMP_Extract_from_scheduled( context, node );
( *enqueue_scheduled )( context, node, insert_priority );
needs_help = false;
} else if ( node_state == SCHEDULER_SMP_NODE_READY ) {
@@ -1299,7 +1304,7 @@ static inline void _Scheduler_SMP_Withdraw_node(
_Scheduler_Thread_change_state( thread, next_state );
_Thread_Scheduler_release_critical( thread, &lock_context );
- _Scheduler_SMP_Extract_from_scheduled( node );
+ _Scheduler_SMP_Extract_from_scheduled( context, node );
_Scheduler_SMP_Schedule_highest_ready(
context,
node,
@@ -1393,7 +1398,7 @@ static inline Thread_Control *_Scheduler_SMP_Remove_processor(
chain_node = _Chain_Next( chain_node );
} while ( _Thread_Get_CPU( victim_user ) != cpu );
- _Scheduler_SMP_Extract_from_scheduled( victim_node );
+ _Scheduler_SMP_Extract_from_scheduled( context, victim_node );
victim_owner = _Scheduler_Node_get_owner( victim_node );
if ( !victim_owner->is_idle ) {
@@ -1452,7 +1457,7 @@ static inline void _Scheduler_SMP_Set_affinity(
insert_priority = SCHEDULER_PRIORITY_APPEND( insert_priority );
if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) {
- _Scheduler_SMP_Extract_from_scheduled( node );
+ _Scheduler_SMP_Extract_from_scheduled( context, node );
_Scheduler_SMP_Preempt_and_schedule_highest_ready(
context,
node,
diff --git a/cpukit/score/src/scheduleredfsmp.c b/cpukit/score/src/scheduleredfsmp.c
index 0980a336cc..66e9a8ef36 100644
--- a/cpukit/score/src/scheduleredfsmp.c
+++ b/cpukit/score/src/scheduleredfsmp.c
@@ -311,7 +311,7 @@ static inline void _Scheduler_EDF_SMP_Move_from_scheduled_to_ready(
{
Priority_Control insert_priority;
- _Chain_Extract_unprotected( &scheduled_to_ready->Node.Chain );
+ _Scheduler_SMP_Extract_from_scheduled( context, scheduled_to_ready );
insert_priority = _Scheduler_SMP_Node_priority( scheduled_to_ready );
_Scheduler_EDF_SMP_Insert_ready(
context,
@@ -403,6 +403,7 @@ void _Scheduler_EDF_SMP_Block(
context,
thread,
node,
+ _Scheduler_SMP_Extract_from_scheduled,
_Scheduler_EDF_SMP_Extract_from_ready,
_Scheduler_EDF_SMP_Get_highest_ready,
_Scheduler_EDF_SMP_Move_from_ready_to_scheduled,
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 4808c84c3f..a82106566b 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -174,6 +174,7 @@ void _Scheduler_priority_affinity_SMP_Block(
context,
thread,
node,
+ _Scheduler_SMP_Extract_from_scheduled,
_Scheduler_priority_SMP_Extract_from_ready,
_Scheduler_priority_affinity_SMP_Get_highest_ready,
_Scheduler_priority_SMP_Move_from_ready_to_scheduled,
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 205d3257ca..6479563eb0 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -102,6 +102,7 @@ void _Scheduler_priority_SMP_Block(
context,
thread,
node,
+ _Scheduler_SMP_Extract_from_scheduled,
_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/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index 4ab4987c3a..e0f56ffe67 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -174,6 +174,7 @@ void _Scheduler_simple_SMP_Block(
context,
thread,
node,
+ _Scheduler_SMP_Extract_from_scheduled,
_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 19d4ebe348..865c11832e 100644
--- a/cpukit/score/src/schedulerstrongapa.c
+++ b/cpukit/score/src/schedulerstrongapa.c
@@ -234,6 +234,7 @@ void _Scheduler_strong_APA_Block(
context,
the_thread,
node,
+ _Scheduler_SMP_Extract_from_scheduled,
_Scheduler_strong_APA_Extract_from_ready,
_Scheduler_strong_APA_Get_highest_ready,
_Scheduler_strong_APA_Move_from_ready_to_scheduled,