Changeset 9bfad8c in rtems for testsuites/smptests


Ignore:
Timestamp:
Jun 8, 2016, 8:22:46 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
006af6ac
Parents:
69a6802b
git-author:
Sebastian Huber <sebastian.huber@…> (06/08/16 20:22:46)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/22/16 12:44:56)
Message:

score: Add thread priority to scheduler nodes

The thread priority is manifest in two independent areas. One area is
the user visible thread priority along with a potential thread queue.
The other is the scheduler. Currently, a thread priority update via
_Thread_Change_priority() first updates the user visble thread priority
and the thread queue, then the scheduler is notified if necessary. The
priority is passed to the scheduler via a local variable. A generation
counter ensures that the scheduler discards out-of-date priorities.

This use of a local variable ties the update in these two areas close
together. For later enhancements and the OMIP locking protocol
implementation we need more flexibility. Add a thread priority
information block to Scheduler_Node and synchronize priority value
updates via a sequence lock on SMP configurations.

Update #2556.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/smptests/smpscheduler03/init.c

    r69a6802b r9bfad8c  
    188188}
    189189
    190 static Thread_Control *change_priority_op(
     190static Thread_Control *update_priority_op(
    191191  Thread_Control *thread,
    192192  Priority_Control new_priority,
     
    198198  ISR_lock_Context scheduler_lock_context;
    199199  Thread_Control *needs_help;
     200  Scheduler_Node *node;
     201
     202  thread->current_priority = new_priority;
     203  node = _Scheduler_Thread_get_node(thread);
     204  _Scheduler_Node_set_priority(node, new_priority, prepend_it);
    200205
    201206  _Thread_State_acquire( thread, &state_lock_context );
     
    203208  _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context );
    204209
    205   thread->current_priority = new_priority;
    206   needs_help = (*scheduler->Operations.change_priority)(
    207     scheduler,
    208     thread,
    209     new_priority,
    210     prepend_it
    211   );
     210  needs_help = (*scheduler->Operations.update_priority)( scheduler, thread);
    212211
    213212  _Scheduler_Release_critical( scheduler, &scheduler_lock_context );
     
    217216}
    218217
    219 static void test_case_change_priority_op(
     218static void test_case_update_priority_op(
    220219  Thread_Control *executing,
    221220  Scheduler_SMP_Node *executing_node,
     
    245244  rtems_test_assert(executing_node->state == start_state);
    246245
    247   needs_help = change_priority_op(executing, prio, prepend_it);
     246  needs_help = update_priority_op(executing, prio, prepend_it);
    248247  rtems_test_assert(executing_node->state == new_state);
    249248
     
    270269}
    271270
    272 static void test_change_priority_op(void)
     271static void test_update_priority_op(void)
    273272{
    274273  rtems_status_code sc;
     
    290289    for (j = 0; j < RTEMS_ARRAY_SIZE(priorities); ++j) {
    291290      for (k = 0; k < RTEMS_ARRAY_SIZE(prepend_it); ++k) {
    292         test_case_change_priority_op(
     291        test_case_update_priority_op(
    293292          executing,
    294293          executing_node,
     
    556555{
    557556  test_change_priority();
    558   test_change_priority_op();
     557  test_update_priority_op();
    559558  test_yield_op();
    560559  test_unblock_op();
Note: See TracChangeset for help on using the changeset viewer.