[PATCH 03/30] score: Pass scheduler node to update priority op

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 31 08:51:34 UTC 2016


This enables to call this scheduler operation for all scheduler nodes
available to a thread.

Update #2556.
---
 cpukit/score/include/rtems/score/scheduler.h       |  3 +-
 cpukit/score/include/rtems/score/scheduleredf.h    |  3 +-
 cpukit/score/include/rtems/score/schedulerimpl.h   | 28 +++++++-----
 .../score/include/rtems/score/schedulerpriority.h  |  3 +-
 .../rtems/score/schedulerpriorityaffinitysmp.h     |  3 +-
 .../include/rtems/score/schedulerprioritysmp.h     |  3 +-
 cpukit/score/include/rtems/score/schedulersimple.h |  3 +-
 .../score/include/rtems/score/schedulersimplesmp.h |  3 +-
 .../score/include/rtems/score/schedulersmpimpl.h   | 52 ++++++++++++++--------
 .../score/include/rtems/score/schedulerstrongapa.h |  3 +-
 cpukit/score/src/scheduleredfchangepriority.c      | 19 ++++----
 cpukit/score/src/schedulerpriorityaffinitysmp.c    |  4 +-
 cpukit/score/src/schedulerprioritychangepriority.c | 19 ++++----
 cpukit/score/src/schedulerprioritysmp.c            |  4 +-
 cpukit/score/src/schedulersimplechangepriority.c   |  5 +--
 cpukit/score/src/schedulersimplesmp.c              |  4 +-
 cpukit/score/src/schedulerstrongapa.c              |  4 +-
 testsuites/smptests/smpscheduler03/init.c          | 34 +++++++++-----
 18 files changed, 122 insertions(+), 75 deletions(-)

diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index e85b7f8..0fc7d5a 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -83,7 +83,8 @@ typedef struct {
   /** @see _Scheduler_Update_priority() */
   Scheduler_Void_or_thread ( *update_priority )(
     const Scheduler_Control *,
-    Thread_Control *
+    Thread_Control *,
+    Scheduler_Node *
   );
 
   /** @see _Scheduler_Map_priority() */
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index ab43672..0ae33cf 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -171,7 +171,8 @@ Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
 
 Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *node
 );
 
 Priority_Control _Scheduler_EDF_Map_priority(
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index e44dd4f..211b7a7 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -136,6 +136,17 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Release_critical(
   _ISR_lock_Release( &_Scheduler_Lock, lock_context );
 }
 
+RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Thread_get_node(
+  const Thread_Control *the_thread
+)
+{
+#if defined(RTEMS_SMP)
+  return the_thread->Scheduler.node;
+#else
+  return the_thread->Scheduler.nodes;
+#endif
+}
+
 /**
  * The preferred method to add a new scheduler is to define the jump table
  * entries and add a case to the _Scheduler_Initialize routine.
@@ -381,7 +392,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority( Thread_Control *the_thread
 #if defined(RTEMS_SMP)
   needs_help =
 #endif
-  ( *own_scheduler->Operations.update_priority )( own_scheduler, the_thread );
+  ( *own_scheduler->Operations.update_priority )(
+    own_scheduler,
+    the_thread,
+    _Thread_Scheduler_get_home_node( the_thread )
+  );
 
 #if defined(RTEMS_SMP)
   _Scheduler_Ask_for_help_if_necessary( needs_help );
@@ -768,17 +783,6 @@ RTEMS_INLINE_ROUTINE uint32_t _Scheduler_Get_index(
   return (uint32_t) (scheduler - &_Scheduler_Table[ 0 ]);
 }
 
-RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Thread_get_node(
-  const Thread_Control *the_thread
-)
-{
-#if defined(RTEMS_SMP)
-  return the_thread->Scheduler.node;
-#else
-  return the_thread->Scheduler.nodes;
-#endif
-}
-
 RTEMS_INLINE_ROUTINE void _Scheduler_Thread_set_priority(
   Thread_Control   *the_thread,
   Priority_Control  new_priority,
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index f3e805a..4c9c698 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -155,7 +155,8 @@ Scheduler_Void_or_thread _Scheduler_priority_Unblock(
 
 Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *base_node
 );
 
 void _Scheduler_priority_Node_initialize(
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index 4d06bcb..be28dec 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -138,7 +138,8 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
  */
 Thread_Control *_Scheduler_priority_affinity_SMP_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *node
 );
 
 Thread_Control *_Scheduler_priority_affinity_SMP_Ask_for_help_X(
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 4bd7795..afde45b 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -117,7 +117,8 @@ Thread_Control *_Scheduler_priority_SMP_Unblock(
 
 Thread_Control *_Scheduler_priority_SMP_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *node
 );
 
 Thread_Control *_Scheduler_priority_SMP_Ask_for_help_X(
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 2239379..5d61069 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -147,7 +147,8 @@ Scheduler_Void_or_thread _Scheduler_simple_Unblock(
 
 Scheduler_Void_or_thread _Scheduler_simple_Update_priority(
   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 6d2b77c..4273445 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -100,7 +100,8 @@ Thread_Control *_Scheduler_simple_SMP_Unblock(
 
 Thread_Control *_Scheduler_simple_SMP_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *node
 );
 
 Thread_Control *_Scheduler_simple_SMP_Ask_for_help_X(
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index 4e4edf7..cec0357 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -385,6 +385,20 @@ static inline Scheduler_SMP_Node *_Scheduler_SMP_Node_downcast(
   return (Scheduler_SMP_Node *) node;
 }
 
+static inline Scheduler_SMP_Node_state _Scheduler_SMP_Node_state(
+  const Scheduler_Node *node
+)
+{
+  return ( (const Scheduler_SMP_Node *) node )->state;
+}
+
+static inline Priority_Control _Scheduler_SMP_Node_priority(
+  const Scheduler_Node *node
+)
+{
+  return ( (const Scheduler_SMP_Node *) node )->priority;
+}
+
 static inline void _Scheduler_SMP_Node_initialize(
   const Scheduler_Control *scheduler,
   Scheduler_SMP_Node      *node,
@@ -963,6 +977,7 @@ static inline Thread_Control *_Scheduler_SMP_Unblock(
 static inline Thread_Control *_Scheduler_SMP_Update_priority(
   Scheduler_Context               *context,
   Thread_Control                  *thread,
+  Scheduler_Node                  *node,
   Scheduler_SMP_Extract            extract_from_ready,
   Scheduler_SMP_Update             update,
   Scheduler_SMP_Enqueue            enqueue_fifo,
@@ -971,41 +986,42 @@ static inline Thread_Control *_Scheduler_SMP_Update_priority(
   Scheduler_SMP_Enqueue_scheduled  enqueue_scheduled_lifo
 )
 {
-  Scheduler_SMP_Node *node;
-  Thread_Control     *needs_help;
-  Priority_Control    new_priority;
-  bool                prepend_it;
+  Thread_Control          *needs_help;
+  Priority_Control         new_priority;
+  bool                     prepend_it;
+  Scheduler_SMP_Node_state node_state;
 
-  node = _Scheduler_SMP_Thread_get_own_node( thread );
-  new_priority = _Scheduler_Node_get_priority( &node->Base, &prepend_it );
+  new_priority = _Scheduler_Node_get_priority( node, &prepend_it );
 
-  if ( new_priority == node->priority ) {
+  if ( new_priority == _Scheduler_SMP_Node_priority( node ) ) {
     /* Nothing to do */
     return NULL;
   }
 
-  if ( node->state == SCHEDULER_SMP_NODE_SCHEDULED ) {
-    _Scheduler_SMP_Extract_from_scheduled( &node->Base );
+  node_state = _Scheduler_SMP_Node_state( node );
+
+  if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) {
+    _Scheduler_SMP_Extract_from_scheduled( node );
 
-    ( *update )( context, &node->Base, new_priority );
+    ( *update )( context, node, new_priority );
 
     if ( prepend_it ) {
-      needs_help = ( *enqueue_scheduled_lifo )( context, &node->Base );
+      needs_help = ( *enqueue_scheduled_lifo )( context, node );
     } else {
-      needs_help = ( *enqueue_scheduled_fifo )( context, &node->Base );
+      needs_help = ( *enqueue_scheduled_fifo )( context, node );
     }
-  } else if ( node->state == SCHEDULER_SMP_NODE_READY ) {
-    ( *extract_from_ready )( context, &node->Base );
+  } else if ( node_state == SCHEDULER_SMP_NODE_READY ) {
+    ( *extract_from_ready )( context, node );
 
-    ( *update )( context, &node->Base, new_priority );
+    ( *update )( context, node, new_priority );
 
     if ( prepend_it ) {
-      needs_help = ( *enqueue_lifo )( context, &node->Base, NULL );
+      needs_help = ( *enqueue_lifo )( context, node, NULL );
     } else {
-      needs_help = ( *enqueue_fifo )( context, &node->Base, NULL );
+      needs_help = ( *enqueue_fifo )( context, node, NULL );
     }
   } else {
-    ( *update )( context, &node->Base, new_priority );
+    ( *update )( context, node, new_priority );
 
     needs_help = NULL;
   }
diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h
index 4dfc2ff..35d3edd 100644
--- a/cpukit/score/include/rtems/score/schedulerstrongapa.h
+++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h
@@ -117,7 +117,8 @@ Thread_Control *_Scheduler_strong_APA_Unblock(
 
 Thread_Control *_Scheduler_strong_APA_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *node
 );
 
 Thread_Control *_Scheduler_strong_APA_Ask_for_help_X(
diff --git a/cpukit/score/src/scheduleredfchangepriority.c b/cpukit/score/src/scheduleredfchangepriority.c
index 8940b1d..8fcc111 100644
--- a/cpukit/score/src/scheduleredfchangepriority.c
+++ b/cpukit/score/src/scheduleredfchangepriority.c
@@ -38,11 +38,12 @@ Priority_Control _Scheduler_EDF_Unmap_priority(
 
 Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
   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;
   Priority_Control       priority;
   bool                   prepend_it;
 
@@ -51,23 +52,23 @@ Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
     SCHEDULER_RETURN_VOID_OR_NULL;
   }
 
-  node = _Scheduler_EDF_Thread_get_node( the_thread );
-  priority = _Scheduler_Node_get_priority( &node->Base, &prepend_it );
+  the_node = _Scheduler_EDF_Node_downcast( node );
+  priority = _Scheduler_Node_get_priority( &the_node->Base, &prepend_it );
 
-  if ( priority == node->priority ) {
+  if ( priority == the_node->priority ) {
     /* Nothing to do */
     SCHEDULER_RETURN_VOID_OR_NULL;
   }
 
-  node->priority = priority;
+  the_node->priority = priority;
   context = _Scheduler_EDF_Get_context( scheduler );
 
-  _Scheduler_EDF_Extract( context, node );
+  _Scheduler_EDF_Extract( context, the_node );
 
   if ( prepend_it ) {
-    _Scheduler_EDF_Enqueue_first( context, node, priority );
+    _Scheduler_EDF_Enqueue_first( context, the_node, priority );
   } else {
-    _Scheduler_EDF_Enqueue( context, node, priority );
+    _Scheduler_EDF_Enqueue( context, the_node, priority );
   }
 
   _Scheduler_EDF_Schedule_body( scheduler, the_thread, false );
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index a15ff0f..9282b1a 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -500,7 +500,8 @@ static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_scheduled_fifo(
  */
 Thread_Control *_Scheduler_priority_affinity_SMP_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *thread
+  Thread_Control          *thread,
+  Scheduler_Node          *node
 )
 {
   Scheduler_Context *context = _Scheduler_Get_context( scheduler );
@@ -509,6 +510,7 @@ Thread_Control *_Scheduler_priority_affinity_SMP_Update_priority(
   displaced = _Scheduler_SMP_Update_priority(
     context,
     thread,
+    node,
     _Scheduler_priority_SMP_Extract_from_ready,
     _Scheduler_priority_SMP_Do_update,
     _Scheduler_priority_affinity_SMP_Enqueue_fifo,
diff --git a/cpukit/score/src/schedulerprioritychangepriority.c b/cpukit/score/src/schedulerprioritychangepriority.c
index 4fc46cf..339168f 100644
--- a/cpukit/score/src/schedulerprioritychangepriority.c
+++ b/cpukit/score/src/schedulerprioritychangepriority.c
@@ -23,11 +23,12 @@
 
 Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *node
 )
 {
   Scheduler_priority_Context *context;
-  Scheduler_priority_Node    *node;
+  Scheduler_priority_Node    *the_node;
   unsigned int                priority;
   bool                        prepend_it;
 
@@ -36,11 +37,11 @@ Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
     SCHEDULER_RETURN_VOID_OR_NULL;
   }
 
-  node = _Scheduler_priority_Thread_get_node( the_thread );
+  the_node = _Scheduler_priority_Node_downcast( node );
   priority = (unsigned int )
-    _Scheduler_Node_get_priority( &node->Base, &prepend_it );
+    _Scheduler_Node_get_priority( &the_node->Base, &prepend_it );
 
-  if ( priority == node->Ready_queue.current_priority ) {
+  if ( priority == the_node->Ready_queue.current_priority ) {
     /* Nothing to do */
     SCHEDULER_RETURN_VOID_OR_NULL;
   }
@@ -49,12 +50,12 @@ Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
 
   _Scheduler_priority_Ready_queue_extract(
     &the_thread->Object.Node,
-    &node->Ready_queue,
+    &the_node->Ready_queue,
     &context->Bit_map
   );
 
   _Scheduler_priority_Ready_queue_update(
-    &node->Ready_queue,
+    &the_node->Ready_queue,
     priority,
     &context->Bit_map,
     &context->Ready[ 0 ]
@@ -63,13 +64,13 @@ Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
   if ( prepend_it ) {
     _Scheduler_priority_Ready_queue_enqueue_first(
       &the_thread->Object.Node,
-      &node->Ready_queue,
+      &the_node->Ready_queue,
       &context->Bit_map
     );
   } else {
     _Scheduler_priority_Ready_queue_enqueue(
       &the_thread->Object.Node,
-      &node->Ready_queue,
+      &the_node->Ready_queue,
       &context->Bit_map
     );
   }
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 2445503..4936b05 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -227,7 +227,8 @@ Thread_Control *_Scheduler_priority_SMP_Unblock(
 
 Thread_Control *_Scheduler_priority_SMP_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *thread
+  Thread_Control          *thread,
+  Scheduler_Node          *node
 )
 {
   Scheduler_Context *context = _Scheduler_Get_context( scheduler );
@@ -235,6 +236,7 @@ Thread_Control *_Scheduler_priority_SMP_Update_priority(
   return _Scheduler_SMP_Update_priority(
     context,
     thread,
+    node,
     _Scheduler_priority_SMP_Extract_from_ready,
     _Scheduler_priority_SMP_Do_update,
     _Scheduler_priority_SMP_Enqueue_fifo,
diff --git a/cpukit/score/src/schedulersimplechangepriority.c b/cpukit/score/src/schedulersimplechangepriority.c
index 9d4a565..e430c75 100644
--- a/cpukit/score/src/schedulersimplechangepriority.c
+++ b/cpukit/score/src/schedulersimplechangepriority.c
@@ -23,11 +23,11 @@
 
 Scheduler_Void_or_thread _Scheduler_simple_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *node
 )
 {
   Scheduler_simple_Context *context;
-  Scheduler_Node           *node;
   bool                      prepend_it;
 
   if ( !_Thread_Is_ready( the_thread ) ) {
@@ -36,7 +36,6 @@ Scheduler_Void_or_thread _Scheduler_simple_Update_priority(
   }
 
   context = _Scheduler_simple_Get_context( scheduler );
-  node = _Scheduler_Thread_get_node( the_thread );
   _Scheduler_Node_get_priority( node, &prepend_it );
 
   _Scheduler_simple_Extract( scheduler, the_thread );
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index f51990e..2d333c9 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -294,7 +294,8 @@ Thread_Control *_Scheduler_simple_SMP_Unblock(
 
 Thread_Control *_Scheduler_simple_SMP_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *thread
+  Thread_Control          *thread,
+  Scheduler_Node          *node
 )
 {
   Scheduler_Context *context = _Scheduler_Get_context( scheduler );
@@ -302,6 +303,7 @@ Thread_Control *_Scheduler_simple_SMP_Update_priority(
   return _Scheduler_SMP_Update_priority(
     context,
     thread,
+    node,
     _Scheduler_simple_SMP_Extract_from_ready,
     _Scheduler_simple_SMP_Do_update,
     _Scheduler_simple_SMP_Enqueue_fifo,
diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c
index 7dfe075..f42f470 100644
--- a/cpukit/score/src/schedulerstrongapa.c
+++ b/cpukit/score/src/schedulerstrongapa.c
@@ -353,7 +353,8 @@ Thread_Control *_Scheduler_strong_APA_Unblock(
 
 Thread_Control *_Scheduler_strong_APA_Update_priority(
   const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread
+  Thread_Control          *the_thread,
+  Scheduler_Node          *node
 )
 {
   Scheduler_Context *context = _Scheduler_Get_context( scheduler );
@@ -361,6 +362,7 @@ Thread_Control *_Scheduler_strong_APA_Update_priority(
   return _Scheduler_SMP_Update_priority(
     context,
     the_thread,
+    node,
     _Scheduler_strong_APA_Extract_from_ready,
     _Scheduler_strong_APA_Do_update,
     _Scheduler_strong_APA_Enqueue_fifo,
diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c
index 50d4894..f450606 100644
--- a/testsuites/smptests/smpscheduler03/init.c
+++ b/testsuites/smptests/smpscheduler03/init.c
@@ -40,6 +40,11 @@ typedef struct {
 
 static test_context test_instance;
 
+static Scheduler_SMP_Node *get_scheduler_node(Thread_Control *thread)
+{
+  return _Scheduler_SMP_Node_downcast(_Thread_Scheduler_get_home_node(thread));
+}
+
 static void apply_priority(
   Thread_Control *thread,
   Priority_Control new_priority,
@@ -119,7 +124,7 @@ static Thread_Control *get_thread_by_id(rtems_id task_id)
 
 static void test_case_change_priority(
   Thread_Control *executing,
-  Scheduler_SMP_Node *node,
+  Scheduler_SMP_Node *executing_node,
   Scheduler_SMP_Node_state start_state,
   Priority_Control prio,
   bool prepend_it,
@@ -141,13 +146,13 @@ static void test_case_change_priority(
       rtems_test_assert(0);
       break;
   }
-  rtems_test_assert(node->state == start_state);
+  rtems_test_assert(executing_node->state == start_state);
 
   change_priority(executing, prio, prepend_it);
-  rtems_test_assert(node->state == new_state);
+  rtems_test_assert(executing_node->state == new_state);
 
   change_priority(executing, 1, true);
-  rtems_test_assert(node->state == SCHEDULER_SMP_NODE_SCHEDULED);
+  rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_SCHEDULED);
 
   _Thread_Dispatch_enable( cpu_self );
 }
@@ -166,21 +171,21 @@ static void test_change_priority(void)
   rtems_status_code sc;
   rtems_id task_id;
   Thread_Control *executing;
-  Scheduler_SMP_Node *node;
+  Scheduler_SMP_Node *executing_node;
   size_t i;
   size_t j;
   size_t k;
 
   task_id = start_task(3);
   executing = _Thread_Get_executing();
-  node = _Scheduler_SMP_Thread_get_node(executing);
+  executing_node = get_scheduler_node(executing);
 
   for (i = 0; i < RTEMS_ARRAY_SIZE(states); ++i) {
     for (j = 0; j < RTEMS_ARRAY_SIZE(priorities); ++j) {
       for (k = 0; k < RTEMS_ARRAY_SIZE(prepend_it); ++k) {
         test_case_change_priority(
           executing,
-          node,
+          executing_node,
           states[i],
           priorities[j],
           prepend_it[k],
@@ -196,6 +201,7 @@ static void test_change_priority(void)
 
 static Thread_Control *update_priority_op(
   Thread_Control *thread,
+  Scheduler_SMP_Node *scheduler_node,
   Priority_Control new_priority,
   bool prepend_it
 )
@@ -212,7 +218,11 @@ static Thread_Control *update_priority_op(
   scheduler = _Scheduler_Get( thread );
   _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context );
 
-  needs_help = (*scheduler->Operations.update_priority)( scheduler, thread);
+  needs_help = (*scheduler->Operations.update_priority)(
+    scheduler,
+    thread,
+    &scheduler_node->Base
+  );
 
   _Scheduler_Release_critical( scheduler, &scheduler_lock_context );
   _Thread_State_release( thread, &state_lock_context );
@@ -248,7 +258,7 @@ static void test_case_update_priority_op(
   }
   rtems_test_assert(executing_node->state == start_state);
 
-  needs_help = update_priority_op(executing, prio, prepend_it);
+  needs_help = update_priority_op(executing, executing_node, prio, prepend_it);
   rtems_test_assert(executing_node->state == new_state);
 
   if (start_state != new_state) {
@@ -286,7 +296,7 @@ static void test_update_priority_op(void)
 
   task_id = start_task(3);
   executing = _Thread_Get_executing();
-  executing_node = _Scheduler_SMP_Thread_get_node(executing);
+  executing_node = get_scheduler_node(executing);
 
   other = get_thread_by_id(task_id);
 
@@ -418,7 +428,7 @@ static void test_yield_op(void)
 
   task_id = start_task(2);
   executing = _Thread_Get_executing();
-  executing_node = _Scheduler_SMP_Thread_get_node(executing);
+  executing_node = get_scheduler_node(executing);
 
   other = get_thread_by_id(task_id);
 
@@ -539,7 +549,7 @@ static void test_unblock_op(void)
 
   task_id = start_task(3);
   executing = _Thread_Get_executing();
-  executing_node = _Scheduler_SMP_Thread_get_node(executing);
+  executing_node = get_scheduler_node(executing);
 
   other = get_thread_by_id(task_id);
 
-- 
1.8.4.5




More information about the devel mailing list