Changeset ec771f2 in rtems for testsuites/smptests


Ignore:
Timestamp:
Nov 16, 2017, 2:04:21 PM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
e24d64b
Parents:
9c30c31e
git-author:
Sebastian Huber <sebastian.huber@…> (11/16/17 14:04:21)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/16/17 14:25:45)
Message:

score: Fix priority ceiling updates

We must not clear the priority updates in _Thread_queue_Extract_locked()
since this function is used by the priority ceiling surrender operations
after the ceiling priority handover from the previous owner to the new
owner. This is especially important in SMP configurations.

Move the _Thread_queue_Context_clear_priority_updates() invocation to
the callers.

Close #3237.

File:
1 edited

Legend:

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

    r9c30c31e rec771f2  
    4848  REQ_WAIT_FOR_DONE = RTEMS_EVENT_11,
    4949  REQ_SEND_EVENT_2 = RTEMS_EVENT_12,
    50   REQ_SEND_EVENT_3 = RTEMS_EVENT_13
     50  REQ_SEND_EVENT_3 = RTEMS_EVENT_13,
     51  REQ_CEIL_OBTAIN = RTEMS_EVENT_14,
     52  REQ_CEIL_RELEASE = RTEMS_EVENT_15
    5153} request_id;
    5254
     
    6870  rtems_id mtx_2;
    6971  rtems_id sem;
     72  rtems_id ceil;
    7073  rtems_id tasks[TASK_COUNT];
    7174  Atomic_Uint done;
     
    306309}
    307310
     311static void ceil_obtain(test_context *ctx)
     312{
     313  rtems_status_code sc;
     314
     315  sc = rtems_semaphore_obtain(ctx->ceil, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     316  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     317}
     318
     319static void ceil_release(test_context *ctx)
     320{
     321  rtems_status_code sc;
     322
     323  sc = rtems_semaphore_release(ctx->ceil);
     324  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     325}
     326
    308327static void wait(void)
    309328{
     
    466485    if ((events & REQ_SEND_EVENT_3) != 0) {
    467486      send_event(ctx, ctx->id_3, ctx->events_3);
     487    }
     488
     489    if ((events & REQ_CEIL_OBTAIN) != 0) {
     490      ceil_obtain(ctx);
     491      ++ctx->generation[id];
     492    }
     493
     494    if ((events & REQ_CEIL_RELEASE) != 0) {
     495      ceil_release(ctx);
     496      ++ctx->generation[id];
    468497    }
    469498
     
    521550  );
    522551  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     552
     553  sc = rtems_semaphore_create(
     554    rtems_build_name('C', 'E', 'I', 'L'),
     555    1,
     556    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
     557    1,
     558    &ctx->ceil
     559  );
     560  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    523561}
    524562
     
    547585  assert_prio(ctx, M, 3);
    548586  release(ctx);
     587}
     588
     589static void test_ceiling_mutex(test_context *ctx)
     590{
     591  assert_prio(ctx, M, 3);
     592  ceil_obtain(ctx);
     593  assert_prio(ctx, M, 1);
     594  send_event(ctx, A_1, REQ_CEIL_OBTAIN);
     595  yield();
     596  check_generations(ctx, NONE, NONE);
     597  ceil_release(ctx);
     598  check_generations(ctx, A_1, NONE);
     599  assert_prio(ctx, M, 3);
     600  send_event(ctx, A_1, REQ_CEIL_RELEASE);
     601  check_generations(ctx, A_1, NONE);
    549602}
    550603
     
    9681021
    9691022  test_flush_inheritance(ctx);
     1023  test_ceiling_mutex(ctx);
    9701024}
    9711025
     
    10011055#define CONFIGURE_MAXIMUM_TASKS TASK_COUNT
    10021056
    1003 #define CONFIGURE_MAXIMUM_SEMAPHORES 3
     1057#define CONFIGURE_MAXIMUM_SEMAPHORES 4
    10041058
    10051059#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.