summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-31 13:08:33 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-10 09:22:09 +0100
commit05ca53ddf6bc8333c2f3ad861c5415467c3262d2 (patch)
tree9b011af47a8304527c77ba8992418e473f540ecf /cpukit/score/src
parentscore: Add and use Thread_Control::is_idle (diff)
downloadrtems-05ca53ddf6bc8333c2f3ad861c5415467c3262d2.tar.bz2
rtems: Add scheduler processor add/remove
Update #2797.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/schedulerpriorityaffinitysmp.c30
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c30
-rw-r--r--cpukit/score/src/schedulersimplesmp.c38
-rw-r--r--cpukit/score/src/schedulersmpstartidle.c2
-rw-r--r--cpukit/score/src/schedulerstrongapa.c38
-rw-r--r--cpukit/score/src/threadinitialize.c9
6 files changed, 145 insertions, 2 deletions
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 3ca3b73f10..7689469c54 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -578,6 +578,36 @@ void _Scheduler_priority_affinity_SMP_Withdraw_node(
);
}
+void _Scheduler_priority_affinity_SMP_Add_processor(
+ const Scheduler_Control *scheduler,
+ Thread_Control *idle
+)
+{
+ Scheduler_Context *context = _Scheduler_Get_context( scheduler );
+
+ _Scheduler_SMP_Add_processor(
+ context,
+ idle,
+ _Scheduler_priority_SMP_Has_ready,
+ _Scheduler_priority_affinity_SMP_Enqueue_scheduled_fifo
+ );
+}
+
+Thread_Control *_Scheduler_priority_affinity_SMP_Remove_processor(
+ const Scheduler_Control *scheduler,
+ Per_CPU_Control *cpu
+)
+{
+ Scheduler_Context *context = _Scheduler_Get_context( scheduler );
+
+ return _Scheduler_SMP_Remove_processor(
+ context,
+ cpu,
+ _Scheduler_priority_SMP_Extract_from_ready,
+ _Scheduler_priority_affinity_SMP_Enqueue_fifo
+ );
+}
+
/*
* This is the public scheduler specific Change Priority operation.
*/
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 79b3d597a8..b4786ea872 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -312,6 +312,36 @@ void _Scheduler_priority_SMP_Withdraw_node(
);
}
+void _Scheduler_priority_SMP_Add_processor(
+ const Scheduler_Control *scheduler,
+ Thread_Control *idle
+)
+{
+ Scheduler_Context *context = _Scheduler_Get_context( scheduler );
+
+ _Scheduler_SMP_Add_processor(
+ context,
+ idle,
+ _Scheduler_priority_SMP_Has_ready,
+ _Scheduler_priority_SMP_Enqueue_scheduled_fifo
+ );
+}
+
+Thread_Control *_Scheduler_priority_SMP_Remove_processor(
+ const Scheduler_Control *scheduler,
+ Per_CPU_Control *cpu
+)
+{
+ Scheduler_Context *context = _Scheduler_Get_context( scheduler );
+
+ return _Scheduler_SMP_Remove_processor(
+ context,
+ cpu,
+ _Scheduler_priority_SMP_Extract_from_ready,
+ _Scheduler_priority_SMP_Enqueue_fifo
+ );
+}
+
bool _Scheduler_priority_SMP_Yield(
const Scheduler_Control *scheduler,
Thread_Control *thread,
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index 392d4ff78a..221fcc3df5 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -69,6 +69,14 @@ static void _Scheduler_simple_SMP_Do_update(
_Scheduler_SMP_Node_update_priority( smp_node, new_priority );
}
+static bool _Scheduler_simple_SMP_Has_ready( Scheduler_Context *context )
+{
+ Scheduler_simple_SMP_Context *self =
+ _Scheduler_simple_SMP_Get_self( context );
+
+ return !_Chain_Is_empty( &self->Ready );
+}
+
static Scheduler_Node *_Scheduler_simple_SMP_Get_highest_ready(
Scheduler_Context *context,
Scheduler_Node *node
@@ -379,6 +387,36 @@ void _Scheduler_simple_SMP_Withdraw_node(
);
}
+void _Scheduler_simple_SMP_Add_processor(
+ const Scheduler_Control *scheduler,
+ Thread_Control *idle
+)
+{
+ Scheduler_Context *context = _Scheduler_Get_context( scheduler );
+
+ _Scheduler_SMP_Add_processor(
+ context,
+ idle,
+ _Scheduler_simple_SMP_Has_ready,
+ _Scheduler_simple_SMP_Enqueue_scheduled_fifo
+ );
+}
+
+Thread_Control *_Scheduler_simple_SMP_Remove_processor(
+ const Scheduler_Control *scheduler,
+ Per_CPU_Control *cpu
+)
+{
+ Scheduler_Context *context = _Scheduler_Get_context( scheduler );
+
+ return _Scheduler_SMP_Remove_processor(
+ context,
+ cpu,
+ _Scheduler_simple_SMP_Extract_from_ready,
+ _Scheduler_simple_SMP_Enqueue_fifo
+ );
+}
+
bool _Scheduler_simple_SMP_Yield(
const Scheduler_Control *scheduler,
Thread_Control *thread,
diff --git a/cpukit/score/src/schedulersmpstartidle.c b/cpukit/score/src/schedulersmpstartidle.c
index c28a4c3f98..d34ba12a43 100644
--- a/cpukit/score/src/schedulersmpstartidle.c
+++ b/cpukit/score/src/schedulersmpstartidle.c
@@ -26,7 +26,7 @@ void _Scheduler_SMP_Start_idle(
self = _Scheduler_SMP_Get_self( context );
node = _Scheduler_SMP_Thread_get_node( idle );
- _Scheduler_Thread_change_state( thread, THREAD_SCHEDULER_SCHEDULED );
+ _Scheduler_Thread_change_state( idle, THREAD_SCHEDULER_SCHEDULED );
node->state = SCHEDULER_SMP_NODE_SCHEDULED;
_Thread_Set_CPU( idle, cpu );
diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c
index eaa352e793..07d27e97b2 100644
--- a/cpukit/score/src/schedulerstrongapa.c
+++ b/cpukit/score/src/schedulerstrongapa.c
@@ -200,6 +200,14 @@ void _Scheduler_strong_APA_Node_initialize(
);
}
+static bool _Scheduler_strong_APA_Has_ready( Scheduler_Context *context )
+{
+ Scheduler_strong_APA_Context *self =
+ _Scheduler_strong_APA_Get_self( context );
+
+ return !_Priority_bit_map_Is_empty( &self->Bit_map );
+}
+
static Scheduler_Node *_Scheduler_strong_APA_Get_highest_ready(
Scheduler_Context *context,
Scheduler_Node *node
@@ -438,6 +446,36 @@ void _Scheduler_strong_APA_Withdraw_node(
);
}
+void _Scheduler_strong_APA_Add_processor(
+ const Scheduler_Control *scheduler,
+ Thread_Control *idle
+)
+{
+ Scheduler_Context *context = _Scheduler_Get_context( scheduler );
+
+ _Scheduler_SMP_Add_processor(
+ context,
+ idle,
+ _Scheduler_strong_APA_Has_ready,
+ _Scheduler_strong_APA_Enqueue_scheduled_fifo
+ );
+}
+
+Thread_Control *_Scheduler_strong_APA_Remove_processor(
+ const Scheduler_Control *scheduler,
+ Per_CPU_Control *cpu
+)
+{
+ Scheduler_Context *context = _Scheduler_Get_context( scheduler );
+
+ return _Scheduler_SMP_Remove_processor(
+ context,
+ cpu,
+ _Scheduler_strong_APA_Extract_from_ready,
+ _Scheduler_strong_APA_Enqueue_fifo
+ );
+}
+
bool _Scheduler_strong_APA_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 16c225e929..2cbe13854c 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -190,7 +190,14 @@ bool _Thread_Initialize(
priority_for_index = priority;
scheduler_node = scheduler_node_for_index;
} else {
- priority_for_index = 0;
+ /*
+ * Use the idle thread priority for the non-home scheduler instances by
+ * default.
+ */
+ priority_for_index = _Scheduler_Map_priority(
+ scheduler_for_index,
+ scheduler_for_index->maximum_priority
+ );
}
_Scheduler_Node_initialize(