summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-10 14:01:55 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 10:05:40 +0100
commit2df4abcee2fd762a9688bef13e152d5b81cc763e (patch)
tree840277642e69e77c326aec7a4ff6322591cb1467
parent501043a18bae037ca7195ce6989d3ffa8cc72660 (diff)
score: Pass scheduler node to yield operation
Changed for consistency with other scheduler operations. Update #2556.
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h3
-rw-r--r--cpukit/score/include/rtems/score/scheduleredf.h19
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h6
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h23
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmp.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h20
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulersmpimpl.h12
-rw-r--r--cpukit/score/include/rtems/score/schedulerstrongapa.h3
-rw-r--r--cpukit/score/src/scheduleredfyield.c11
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c4
-rw-r--r--cpukit/score/src/schedulerpriorityyield.c10
-rw-r--r--cpukit/score/src/schedulersimplesmp.c4
-rw-r--r--cpukit/score/src/schedulersimpleyield.c5
-rw-r--r--cpukit/score/src/schedulerstrongapa.c4
-rw-r--r--testsuites/smptests/smpscheduler03/init.c13
16 files changed, 61 insertions, 82 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 0fc7d5a880..745fbec621 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -65,7 +65,8 @@ typedef struct {
/** @see _Scheduler_Yield() */
Scheduler_Void_or_thread ( *yield )(
const Scheduler_Control *,
- Thread_Control *
+ Thread_Control *,
+ Scheduler_Node *
);
/** @see _Scheduler_Block() */
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 0ae33cf359..005f2da5f0 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -185,25 +185,10 @@ Priority_Control _Scheduler_EDF_Unmap_priority(
Priority_Control priority
);
-/**
- * @brief invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread
- * with equal deadline.
- *
- * This routine is invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread in the queue with
- * equal deadline. This does not have to happen very often.
- *
- * This routine will remove the specified THREAD from the ready queue
- * and place it back. The rbtree ready queue is responsible for FIFO ordering
- * in such a case.
- *
- * @param[in] scheduler The scheduler instance.
- * @param[in,out] the_thread The yielding thread.
- */
Scheduler_Void_or_thread _Scheduler_EDF_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
void _Scheduler_EDF_Release_job(
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 211b7a7fd9..a431a3af08 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -299,7 +299,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Yield( Thread_Control *the_thread )
#if defined(RTEMS_SMP)
needs_help =
#endif
- ( *scheduler->Operations.yield )( scheduler, the_thread );
+ ( *scheduler->Operations.yield )(
+ scheduler,
+ the_thread,
+ _Thread_Scheduler_get_home_node( the_thread )
+ );
#if defined(RTEMS_SMP)
_Scheduler_Ask_for_help_if_necessary( needs_help );
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 4c9c698830..175def49a3 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -166,29 +166,10 @@ void _Scheduler_priority_Node_initialize(
Priority_Control priority
);
-/**
- * @brief The specified THREAD yields.
- *
- * This routine is invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread in the queue.
- *
- * This routine will remove the specified THREAD from the ready queue
- * and place it immediately at the rear of this chain. Reset timeslice
- * and yield the processor functions both use this routine, therefore if
- * reset is true and this is the only thread on the queue then the
- * timeslice counter is reset. The heir THREAD will be updated if the
- * running is also the currently the heir.
- *
- * - INTERRUPT LATENCY:
- * + ready chain
- * + select heir
- *
- * @param[in] scheduler The scheduler instance.
- * @param[in,out] the_thread The yielding thread.
- */
Scheduler_Void_or_thread _Scheduler_priority_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
/**@}*/
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index afde45b82d..8350038d1c 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -129,7 +129,8 @@ Thread_Control *_Scheduler_priority_SMP_Ask_for_help_X(
Thread_Control *_Scheduler_priority_SMP_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Scheduler_Node *node
);
/** @} */
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 5d610691a6..d8bc02ed0d 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -92,26 +92,10 @@ void _Scheduler_simple_Schedule(
Thread_Control *the_thread
);
-/**
- * @brief Invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread in the queue.
- *
- * This routine is invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread in the queue.
- * It will remove the specified THREAD from the scheduler.informaiton
- * (where the ready queue is stored) and place it immediately at the
- * between the last entry of its priority and the next priority thread.
- * Reset timeslice and yield the processor functions both use this routine,
- * therefore if reset is true and this is the only thread on the queue then
- * the timeslice counter is reset. The heir THREAD will be updated if the
- * running is also the currently the heir.
- *
- * @param[in] scheduler The scheduler instance.
- * @param[in,out] the_thread The yielding thread.
- */
Scheduler_Void_or_thread _Scheduler_simple_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 42734455b1..36f5fb38c7 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -112,7 +112,8 @@ Thread_Control *_Scheduler_simple_SMP_Ask_for_help_X(
Thread_Control *_Scheduler_simple_SMP_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Scheduler_Node *node
);
/** @} */
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index cec0357f32..6deb160405 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -1084,22 +1084,22 @@ static inline Thread_Control *_Scheduler_SMP_Ask_for_help_X(
static inline Thread_Control *_Scheduler_SMP_Yield(
Scheduler_Context *context,
Thread_Control *thread,
+ Scheduler_Node *node,
Scheduler_SMP_Extract extract_from_ready,
Scheduler_SMP_Enqueue enqueue_fifo,
Scheduler_SMP_Enqueue_scheduled enqueue_scheduled_fifo
)
{
- Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_node( thread );
Thread_Control *needs_help;
- if ( node->state == SCHEDULER_SMP_NODE_SCHEDULED ) {
- _Scheduler_SMP_Extract_from_scheduled( &node->Base );
+ if ( _Scheduler_SMP_Node_state( node ) == SCHEDULER_SMP_NODE_SCHEDULED ) {
+ _Scheduler_SMP_Extract_from_scheduled( node );
- needs_help = ( *enqueue_scheduled_fifo )( context, &node->Base );
+ needs_help = ( *enqueue_scheduled_fifo )( context, node );
} else {
- ( *extract_from_ready )( context, &node->Base );
+ ( *extract_from_ready )( context, node );
- needs_help = ( *enqueue_fifo )( context, &node->Base, NULL );
+ needs_help = ( *enqueue_fifo )( context, node, NULL );
}
return needs_help;
diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h
index 35d3eddee2..aa352e2964 100644
--- a/cpukit/score/include/rtems/score/schedulerstrongapa.h
+++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h
@@ -129,7 +129,8 @@ Thread_Control *_Scheduler_strong_APA_Ask_for_help_X(
Thread_Control *_Scheduler_strong_APA_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
/** @} */
diff --git a/cpukit/score/src/scheduleredfyield.c b/cpukit/score/src/scheduleredfyield.c
index 3e64e5ca05..a54b1f5c72 100644
--- a/cpukit/score/src/scheduleredfyield.c
+++ b/cpukit/score/src/scheduleredfyield.c
@@ -23,17 +23,18 @@
Scheduler_Void_or_thread _Scheduler_EDF_Yield(
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_Enqueue( context, node, node->priority );
+ _Scheduler_EDF_Extract( context, the_node );
+ _Scheduler_EDF_Enqueue( context, the_node, the_node->priority );
_Scheduler_EDF_Schedule_body( scheduler, the_thread, true );
SCHEDULER_RETURN_VOID_OR_NULL;
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 4936b05fce..3c88161767 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -264,7 +264,8 @@ Thread_Control *_Scheduler_priority_SMP_Ask_for_help_X(
Thread_Control *_Scheduler_priority_SMP_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Scheduler_Node *node
)
{
Scheduler_Context *context = _Scheduler_Get_context( scheduler );
@@ -272,6 +273,7 @@ Thread_Control *_Scheduler_priority_SMP_Yield(
return _Scheduler_SMP_Yield(
context,
thread,
+ node,
_Scheduler_priority_SMP_Extract_from_ready,
_Scheduler_priority_SMP_Enqueue_fifo,
_Scheduler_priority_SMP_Enqueue_scheduled_fifo
diff --git a/cpukit/score/src/schedulerpriorityyield.c b/cpukit/score/src/schedulerpriorityyield.c
index 5dab094f46..4d22dc9b4d 100644
--- a/cpukit/score/src/schedulerpriorityyield.c
+++ b/cpukit/score/src/schedulerpriorityyield.c
@@ -23,11 +23,15 @@
Scheduler_Void_or_thread _Scheduler_priority_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
)
{
- Scheduler_priority_Node *node = _Scheduler_priority_Thread_get_node( the_thread );
- Chain_Control *ready_chain = node->Ready_queue.ready_chain;
+ Scheduler_priority_Node *the_node;
+ Chain_Control *ready_chain;
+
+ the_node = _Scheduler_priority_Node_downcast( node );
+ ready_chain = the_node->Ready_queue.ready_chain;
if ( !_Chain_Has_only_one_node( ready_chain ) ) {
_Chain_Extract_unprotected( &the_thread->Object.Node );
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index 2d333c9400..b476c08edb 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -331,7 +331,8 @@ Thread_Control *_Scheduler_simple_SMP_Ask_for_help_X(
Thread_Control *_Scheduler_simple_SMP_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Scheduler_Node *node
)
{
Scheduler_Context *context = _Scheduler_Get_context( scheduler );
@@ -339,6 +340,7 @@ Thread_Control *_Scheduler_simple_SMP_Yield(
return _Scheduler_SMP_Yield(
context,
thread,
+ node,
_Scheduler_simple_SMP_Extract_from_ready,
_Scheduler_simple_SMP_Enqueue_fifo,
_Scheduler_simple_SMP_Enqueue_scheduled_fifo
diff --git a/cpukit/score/src/schedulersimpleyield.c b/cpukit/score/src/schedulersimpleyield.c
index 66e4450477..cfd123fb8c 100644
--- a/cpukit/score/src/schedulersimpleyield.c
+++ b/cpukit/score/src/schedulersimpleyield.c
@@ -22,12 +22,15 @@
Scheduler_Void_or_thread _Scheduler_simple_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
)
{
Scheduler_simple_Context *context =
_Scheduler_simple_Get_context( scheduler );
+ (void) node;
+
_Chain_Extract_unprotected( &the_thread->Object.Node );
_Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread );
_Scheduler_simple_Schedule_body( scheduler, the_thread, false );
diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c
index f42f470cfc..2b2f4e4839 100644
--- a/cpukit/score/src/schedulerstrongapa.c
+++ b/cpukit/score/src/schedulerstrongapa.c
@@ -390,7 +390,8 @@ Thread_Control *_Scheduler_strong_APA_Ask_for_help_X(
Thread_Control *_Scheduler_strong_APA_Yield(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
)
{
Scheduler_Context *context = _Scheduler_Get_context( scheduler );
@@ -398,6 +399,7 @@ Thread_Control *_Scheduler_strong_APA_Yield(
return _Scheduler_SMP_Yield(
context,
the_thread,
+ node,
_Scheduler_strong_APA_Extract_from_ready,
_Scheduler_strong_APA_Enqueue_fifo,
_Scheduler_strong_APA_Enqueue_scheduled_fifo
diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c
index f4506062bd..f9588a322d 100644
--- a/testsuites/smptests/smpscheduler03/init.c
+++ b/testsuites/smptests/smpscheduler03/init.c
@@ -320,7 +320,10 @@ static void test_update_priority_op(void)
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
-static Thread_Control *yield_op(Thread_Control *thread)
+static Thread_Control *yield_op(
+ Thread_Control *thread,
+ Scheduler_SMP_Node *scheduler_node
+)
{
const Scheduler_Control *scheduler;
ISR_lock_Context state_lock_context;
@@ -331,7 +334,11 @@ static Thread_Control *yield_op(Thread_Control *thread)
scheduler = _Scheduler_Get( thread );
_Scheduler_Acquire_critical( scheduler, &scheduler_lock_context );
- needs_help = (*scheduler->Operations.yield)(scheduler, thread);
+ needs_help = (*scheduler->Operations.yield)(
+ scheduler,
+ thread,
+ &scheduler_node->Base
+ );
_Scheduler_Release_critical( scheduler, &scheduler_lock_context );
_Thread_State_release( thread, &state_lock_context );
@@ -391,7 +398,7 @@ static void test_case_yield_op(
}
rtems_test_assert(executing_node->state == start_state);
- needs_help = yield_op(executing);
+ needs_help = yield_op(executing, executing_node);
rtems_test_assert(executing_node->state == new_state);
if (start_state != new_state) {