Changeset 33e30f39 in rtems


Ignore:
Timestamp:
May 12, 2015, 8:15:21 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
4117cd1
Parents:
9eb056f
git-author:
Sebastian Huber <sebastian.huber@…> (05/12/15 08:15:21)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/19/15 13:14:34)
Message:

smptests/smpscheduler03: Restructure

Restructure to avoid large maximum thread dispatch disabled times.

File:
1 edited

Legend:

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

    r9eb056f r33e30f39  
    11/*
    2  * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2014-2015 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
     
    120120)
    121121{
     122  Per_CPU_Control *cpu_self;
     123
     124  cpu_self = _Thread_Dispatch_disable();
     125
    122126  switch (start_state) {
    123127    case SCHEDULER_SMP_NODE_SCHEDULED:
     
    135139  change_priority(executing, prio, prepend_it);
    136140  rtems_test_assert(node->state == new_state);
     141
     142  change_priority(executing, 1, true);
     143  rtems_test_assert(node->state == SCHEDULER_SMP_NODE_SCHEDULED);
     144
     145  _Thread_Dispatch_enable( cpu_self );
    137146}
    138147
     
    157166
    158167  task_id = start_task(3);
    159 
    160   _Thread_Disable_dispatch();
    161 
    162   executing = _Thread_Executing;
    163   node = _Scheduler_SMP_Thread_get_node( executing );
     168  executing = _Thread_Get_executing();
     169  node = _Scheduler_SMP_Thread_get_node(executing);
    164170
    165171  for (i = 0; i < RTEMS_ARRAY_SIZE(states); ++i) {
     
    178184  }
    179185
    180   change_priority(executing, 1, true);
    181   rtems_test_assert(node->state == SCHEDULER_SMP_NODE_SCHEDULED);
    182 
    183   _Thread_Enable_dispatch();
    184 
    185186  sc = rtems_task_delete(task_id);
    186187  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    221222{
    222223  Thread_Control *needs_help;
     224  Per_CPU_Control *cpu_self;
     225
     226  cpu_self = _Thread_Dispatch_disable();
    223227
    224228  switch (start_state) {
     
    253257    rtems_test_assert(needs_help == NULL);
    254258  }
     259
     260  change_priority(executing, 1, true);
     261  rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_SCHEDULED);
     262
     263  _Thread_Dispatch_enable( cpu_self );
    255264}
    256265
     
    267276
    268277  task_id = start_task(3);
    269 
    270   _Thread_Disable_dispatch();
    271 
    272   executing = _Thread_Executing;
     278  executing = _Thread_Get_executing();
    273279  executing_node = _Scheduler_SMP_Thread_get_node(executing);
    274280
     
    291297  }
    292298
    293   change_priority(executing, 1, true);
    294   rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_SCHEDULED);
    295 
    296   _Thread_Enable_dispatch();
    297 
    298299  sc = rtems_task_delete(task_id);
    299300  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    304305  const Scheduler_Control *scheduler = _Scheduler_Get(thread);
    305306  Thread_Control *needs_help;
    306   ISR_Level level;
    307 
    308   _ISR_Disable( level );
     307  ISR_lock_Context lock_context;
     308
     309  _Scheduler_Acquire(thread, &lock_context);
    309310  needs_help = (*scheduler->Operations.yield)(scheduler, thread);
    310   _ISR_Enable( level );
     311  _Scheduler_Release(thread, &lock_context);
    311312
    312313  return needs_help;
     
    322323{
    323324  Thread_Control *needs_help;
     325  Per_CPU_Control *cpu_self;
     326
     327  cpu_self = _Thread_Dispatch_disable();
    324328
    325329  change_priority(executing, 4, false);
     
    380384    rtems_test_assert(needs_help == NULL);
    381385  }
     386
     387  change_priority(executing, 1, true);
     388  rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_SCHEDULED);
     389
     390  _Thread_Dispatch_enable( cpu_self );
    382391}
    383392
     
    393402
    394403  task_id = start_task(2);
    395 
    396   _Thread_Disable_dispatch();
    397 
    398   executing = _Thread_Executing;
     404  executing = _Thread_Get_executing();
    399405  executing_node = _Scheduler_SMP_Thread_get_node(executing);
    400406
     
    418424  }
    419425
    420   change_priority(executing, 1, true);
    421   rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_SCHEDULED);
    422 
    423   _Thread_Enable_dispatch();
    424 
    425426  sc = rtems_task_delete(task_id);
    426427  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    458459{
    459460  Thread_Control *needs_help;
     461  Per_CPU_Control *cpu_self;
     462
     463  cpu_self = _Thread_Dispatch_disable();
    460464
    461465  switch (new_state) {
     
    490494      break;
    491495  }
     496
     497  change_priority(executing, 1, true);
     498  rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_SCHEDULED);
     499
     500  _Thread_Dispatch_enable( cpu_self );
    492501}
    493502
     
    502511
    503512  task_id = start_task(3);
    504 
    505   _Thread_Disable_dispatch();
    506 
    507   executing = _Thread_Executing;
     513  executing = _Thread_Get_executing();
    508514  executing_node = _Scheduler_SMP_Thread_get_node(executing);
    509515
     
    518524    );
    519525  }
    520 
    521   change_priority(executing, 1, true);
    522   rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_SCHEDULED);
    523 
    524   _Thread_Enable_dispatch();
    525526
    526527  sc = rtems_task_delete(task_id);
Note: See TracChangeset for help on using the changeset viewer.