Changeset c0bd006 in rtems for testsuites/smptests


Ignore:
Timestamp:
Jun 30, 2016, 12:08:18 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
4cb13c39
Parents:
8d5b0380
git-author:
Sebastian Huber <sebastian.huber@…> (06/30/16 12:08:18)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/01/16 09:51:49)
Message:

rtems: Fix rtems_task_set_scheduler() API

Task priorities are only valid within a scheduler instance. The
rtems_task_set_scheduler() directive moves a task from one scheduler
instance to another using the current priority of the thread. However,
the current task priority of the source scheduler instance is undefined
in the target scheduler instance. Add a third parameter to specify the
priority.

Close #2749.

Location:
testsuites/smptests
Files:
8 edited

Legend:

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

    r8d5b0380 rc0bd006  
    134134  sc = rtems_task_create(
    135135    SCHEDULER_B,
    136     1,
     136    255,
    137137    RTEMS_MINIMUM_STACK_SIZE,
    138138    RTEMS_DEFAULT_MODES,
     
    142142  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    143143
    144   sc = rtems_task_set_scheduler(task_id, scheduler_b_id);
     144  sc = rtems_task_set_scheduler(task_id, scheduler_b_id, 1);
    145145  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    146146
  • testsuites/smptests/smpmigration02/init.c

    r8d5b0380 rc0bd006  
    4747static test_context test_instance;
    4848
     49static rtems_task_priority migration_task_prio(uint32_t task_index)
     50{
     51  return task_index > 0 ? PRIO_LOW : PRIO_HIGH;
     52}
     53
    4954static void migration_task(rtems_task_argument arg)
    5055{
    5156  test_context *ctx = &test_instance;
    52   rtems_status_code sc;
     57  uint32_t task_index = arg;
     58  rtems_task_priority prio = migration_task_prio(task_index);
    5359  uint32_t cpu_count = rtems_get_processor_count();
    5460  uint32_t cpu_index = rtems_get_current_processor();
    5561
    5662  while (true) {
     63    rtems_status_code sc;
     64
    5765    cpu_index = (cpu_index + 1) % cpu_count;
    5866
    59     sc = rtems_task_set_scheduler(RTEMS_SELF, ctx->scheduler_ids[cpu_index]);
    60     rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    61 
    62     ++ctx->counters[arg].value;
     67    sc = rtems_task_set_scheduler(
     68      RTEMS_SELF,
     69      ctx->scheduler_ids[cpu_index],
     70      prio
     71    );
     72    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     73
     74    ++ctx->counters[task_index].value;
    6375
    6476    rtems_test_assert(cpu_index == rtems_get_current_processor());
     
    7890    sc = rtems_task_create(
    7991      rtems_build_name('T', 'A', 'S', 'K'),
    80       task_index > 0 ? PRIO_LOW : PRIO_HIGH,
     92      255,
    8193      RTEMS_MINIMUM_STACK_SIZE,
    8294      RTEMS_DEFAULT_MODES,
     
    8698    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    8799
    88     sc = rtems_task_set_scheduler(task_id, ctx->scheduler_ids[task_index % cpu_count]);
     100    sc = rtems_task_set_scheduler(
     101      task_id,
     102      ctx->scheduler_ids[task_index % cpu_count],
     103      migration_task_prio(task_index)
     104    );
    89105    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    90106
     
    164180    sc = rtems_task_set_scheduler(
    165181      task_id,
    166       ctx->scheduler_ids[cpu_other_index]
     182      ctx->scheduler_ids[cpu_other_index],
     183      2
    167184    );
    168185    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    190207    sc = rtems_task_set_scheduler(
    191208      RTEMS_SELF,
    192       ctx->scheduler_ids[cpu_other_index]
     209      ctx->scheduler_ids[cpu_other_index],
     210      1
    193211    );
    194212    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    208226    sc = rtems_task_set_scheduler(
    209227      RTEMS_SELF,
    210       ctx->scheduler_ids[cpu_self_index]
     228      ctx->scheduler_ids[cpu_self_index],
     229      1
    211230    );
    212231    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
  • testsuites/smptests/smpmrsp01/init.c

    r8d5b0380 rc0bd006  
    419419  sc = rtems_task_create(
    420420    rtems_build_name('W', 'O', 'R', 'K'),
    421     4,
     421    255,
    422422    RTEMS_MINIMUM_STACK_SIZE,
    423423    RTEMS_DEFAULT_MODES,
     
    427427  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    428428
    429   sc = rtems_task_set_scheduler(ctx->worker_ids[0], ctx->scheduler_ids[1]);
     429  sc = rtems_task_set_scheduler(ctx->worker_ids[0], ctx->scheduler_ids[1], 4);
    430430  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    431431
     
    576576  sc = rtems_task_create(
    577577    rtems_build_name('W', 'O', 'R', 'K'),
    578     3,
     578    255,
    579579    RTEMS_MINIMUM_STACK_SIZE,
    580580    RTEMS_DEFAULT_MODES,
     
    584584  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    585585
    586   sc = rtems_task_set_scheduler(ctx->worker_ids[0], ctx->scheduler_ids[1]);
     586  sc = rtems_task_set_scheduler(ctx->worker_ids[0], ctx->scheduler_ids[1], 3);
    587587  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    588588
     
    11531153  sc = rtems_task_create(
    11541154    rtems_build_name('L', 'O', 'W', '0' + i),
    1155     5,
     1155    255,
    11561156    RTEMS_MINIMUM_STACK_SIZE,
    11571157    RTEMS_DEFAULT_MODES,
     
    11611161  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    11621162
    1163   sc = rtems_task_set_scheduler(ctx->low_task_id[i], ctx->scheduler_ids[i]);
     1163  sc = rtems_task_set_scheduler(ctx->low_task_id[i], ctx->scheduler_ids[i], 5);
    11641164  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    11651165
     
    12031203  sc = rtems_task_create(
    12041204    rtems_build_name('H', 'I', 'G', '1'),
    1205     2,
     1205    255,
    12061206    RTEMS_MINIMUM_STACK_SIZE,
    12071207    RTEMS_DEFAULT_MODES,
     
    12111211  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    12121212
    1213   sc = rtems_task_set_scheduler(ctx->high_task_id[1], ctx->scheduler_ids[1]);
     1213  sc = rtems_task_set_scheduler(ctx->high_task_id[1], ctx->scheduler_ids[1], 2);
    12141214  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    12151215
    12161216  sc = rtems_task_create(
    12171217    rtems_build_name('W', 'O', 'R', 'K'),
    1218     4,
     1218    255,
    12191219    RTEMS_MINIMUM_STACK_SIZE,
    12201220    RTEMS_DEFAULT_MODES,
     
    12241224  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    12251225
    1226   sc = rtems_task_set_scheduler(ctx->worker_ids[0], ctx->scheduler_ids[1]);
     1226  sc = rtems_task_set_scheduler(ctx->worker_ids[0], ctx->scheduler_ids[1], 4);
    12271227  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    12281228
     
    13661366  sc = rtems_task_create(
    13671367    rtems_build_name('H', 'E', 'L', 'P'),
    1368     3,
     1368    255,
    13691369    RTEMS_MINIMUM_STACK_SIZE,
    13701370    RTEMS_DEFAULT_MODES,
     
    13761376  sc = rtems_task_set_scheduler(
    13771377    help_task_id,
    1378     ctx->scheduler_ids[1]
     1378    ctx->scheduler_ids[1],
     1379    3
    13791380  );
    13801381  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    15501551    uint32_t cpu_index = (v >> 5) % cpu_count;
    15511552
    1552     sc = rtems_task_set_scheduler(RTEMS_SELF, ctx->scheduler_ids[cpu_index]);
     1553    sc = rtems_task_set_scheduler(RTEMS_SELF, ctx->scheduler_ids[cpu_index], 2);
    15531554    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    15541555
     
    16011602    sc = rtems_task_create(
    16021603      'A' + a,
    1603       3 + MRSP_COUNT + a,
     1604      255,
    16041605      RTEMS_MINIMUM_STACK_SIZE,
    16051606      RTEMS_DEFAULT_MODES,
     
    16111612    sc = rtems_task_set_scheduler(
    16121613      ctx->worker_ids[a],
    1613       ctx->scheduler_ids[index]
     1614      ctx->scheduler_ids[index],
     1615      3 + MRSP_COUNT + a
    16141616    );
    16151617    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    16241626    sc = rtems_task_create(
    16251627      'A' + b,
    1626       3 + MRSP_COUNT + b,
     1628      255,
    16271629      RTEMS_MINIMUM_STACK_SIZE,
    16281630      RTEMS_DEFAULT_MODES,
     
    16341636    sc = rtems_task_set_scheduler(
    16351637      ctx->worker_ids[b],
    1636       ctx->scheduler_ids[index]
     1638      ctx->scheduler_ids[index],
     1639      3 + MRSP_COUNT + b
    16371640    );
    16381641    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
  • testsuites/smptests/smpmutex01/init.c

    r8d5b0380 rc0bd006  
    8282  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    8383
    84   sc = rtems_task_set_scheduler(ctx->tasks[id], scheduler_id);
     84  sc = rtems_task_set_scheduler(ctx->tasks[id], scheduler_id, prio);
    8585  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    8686
  • testsuites/smptests/smppsxmutex01/init.c

    r8d5b0380 rc0bd006  
    4545  rtems_id scheduler_b_id;
    4646  rtems_status_code sc;
     47  rtems_task_priority prio;
    4748  int prio_ceiling;
    4849  int eno;
     
    5556  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    5657
    57   sc = rtems_task_set_scheduler(pthread_self(), scheduler_b_id);
     58  sc = rtems_task_set_priority(pthread_self(), RTEMS_CURRENT_PRIORITY, &prio);
     59  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     60
     61  sc = rtems_task_set_scheduler(pthread_self(), scheduler_b_id, prio);
    5862  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    5963
  • testsuites/smptests/smpscheduler02/init.c

    r8d5b0380 rc0bd006  
    166166
    167167  if (cpu_count > 1) {
    168     sc = rtems_task_set_scheduler(task_id, scheduler_b_id);
    169     rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    170 
    171     sc = rtems_task_set_scheduler(task_id, scheduler_b_id + 1);
     168    sc = rtems_task_set_scheduler(task_id, scheduler_b_id, 1);
     169    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     170
     171    sc = rtems_task_set_scheduler(task_id, scheduler_b_id + 1, 1);
    172172    rtems_test_assert(sc == RTEMS_INVALID_ID);
    173173
     
    201201    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    202202
    203     sc = rtems_task_set_scheduler(task_id, scheduler_b_id);
     203    sc = rtems_task_set_scheduler(task_id, scheduler_b_id, 1);
    204204    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    205205
  • testsuites/smptests/smpscheduler03/init.c

    r8d5b0380 rc0bd006  
    604604    sc = rtems_task_create(
    605605      rtems_build_name('T', 'A', 'S', 'K'),
    606       1,
     606      255,
    607607      RTEMS_MINIMUM_STACK_SIZE,
    608608      RTEMS_DEFAULT_MODES,
     
    615615    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    616616
    617     sc = rtems_task_set_scheduler(ctx->task_id[cpu_index], scheduler_id);
     617    sc = rtems_task_set_scheduler(ctx->task_id[cpu_index], scheduler_id, 1);
    618618    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    619619
  • testsuites/smptests/smpwakeafter01/init.c

    r8d5b0380 rc0bd006  
    9494      sc = rtems_task_create(
    9595        rtems_build_name('T', 'A', 'S', 'K'),
    96         2,
     96        255,
    9797        RTEMS_MINIMUM_STACK_SIZE,
    9898        RTEMS_DEFAULT_MODES,
     
    102102      rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    103103
    104       sc = rtems_task_set_scheduler(task_ids[i][j], scheduler_id);
     104      sc = rtems_task_set_scheduler(task_ids[i][j], scheduler_id, 2);
    105105      rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    106106
Note: See TracChangeset for help on using the changeset viewer.