[rtems-central commit] spec: Compatibility for other RTEMS versions

Sebastian Huber sebh at rtems.org
Tue Sep 26 07:31:13 UTC 2023


Module:    rtems-central
Branch:    master
Commit:    4b305dda360189f2f6d070f93cea4296762c6aab
Changeset: http://git.rtems.org/rtems-central/commit/?id=4b305dda360189f2f6d070f93cea4296762c6aab

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Sep 26 09:28:57 2023 +0200

spec: Compatibility for other RTEMS versions

Make some performance tests compatible to other RTEMS versions which do
not allow changing the priority of a task which owns a priority
inheritance mutex.

---

 spec/rtems/sem/req/perf-mtx-pi-release-one.yml  | 10 ++++++++--
 spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml |  4 ++--
 spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml   |  4 ++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/spec/rtems/sem/req/perf-mtx-pi-release-one.yml b/spec/rtems/sem/req/perf-mtx-pi-release-one.yml
index c1adce97..947178ff 100644
--- a/spec/rtems/sem/req/perf-mtx-pi-release-one.yml
+++ b/spec/rtems/sem/req/perf-mtx-pi-release-one.yml
@@ -16,6 +16,11 @@ test-body:
   brief: |
     Release the mutex.
   code: |
+    /*
+     * The release will unblock the worker task which has our priority.  The
+     * scheduler ensures FIFO ordering for ready threads of the same priority, so
+     * the release will not preempt us.
+     */
     ctx->status = rtems_semaphore_release( ctx->mutex_id );
   description: null
 test-cleanup: null
@@ -24,9 +29,10 @@ test-setup:
   brief: |
     Let one task wait on the mutex.
   code: |
+    SetSelfPriority( PRIO_HIGH );
     ObtainMutex( ctx->mutex_id );
     Send( ctx, EVENT_OBTAIN );
-    SetPriority( ctx->worker_id, PRIO_LOW );
+    Yield();
     Send( ctx, EVENT_RELEASE );
   description: null
 test-teardown:
@@ -35,7 +41,7 @@ test-teardown:
   code: |
     T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
 
-    SetPriority( ctx->worker_id, PRIO_HIGH );
+    SetSelfPriority( PRIO_NORMAL );
 
     return tic == toc;
   description: null
diff --git a/spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml b/spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml
index c0f2a472..92d591ee 100644
--- a/spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml
+++ b/spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml
@@ -30,7 +30,7 @@ test-setup:
     Make the mutex unavailable.
   code: |
     Send( ctx, EVENT_OBTAIN );
-    SetPriority( ctx->worker_id, PRIO_LOW );
+    SetSelfPriority( PRIO_VERY_HIGH );
     Send( ctx, EVENT_END | EVENT_RELEASE );
   description: null
 test-teardown:
@@ -41,8 +41,8 @@ test-teardown:
     T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
 
     *delta = ctx->end - ctx->begin;
-    SetPriority( ctx->worker_id, PRIO_HIGH );
     ReleaseMutex( ctx->mutex_id );
+    SetSelfPriority( PRIO_NORMAL );
 
     return tic == toc;
   description: null
diff --git a/spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml b/spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml
index 0886bb3a..cd53d0d6 100644
--- a/spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml
+++ b/spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml
@@ -30,7 +30,7 @@ test-setup:
     Make the mutex unavailable.
   code: |
     Send( ctx, EVENT_OBTAIN );
-    SetPriority( ctx->worker_id, PRIO_LOW );
+    SetSelfPriority( PRIO_VERY_HIGH );
     Send( ctx, EVENT_END | EVENT_RELEASE );
   description: null
 test-teardown:
@@ -41,8 +41,8 @@ test-teardown:
     T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
 
     *delta = ctx->end - ctx->begin;
-    SetPriority( ctx->worker_id, PRIO_HIGH );
     ReleaseMutex( ctx->mutex_id );
+    SetSelfPriority( PRIO_NORMAL );
 
     return tic == toc;
   description: null



More information about the vc mailing list