summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-23 15:00:20 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-23 15:09:25 +0100
commit4c9788716bfdeddcd881d3c8126c6f10e4b952b6 (patch)
tree0e29c524d991e1780f8f166d5537f672f6005483
parentenv: Add gcovr (diff)
downloadrtems-central-4c9788716bfdeddcd881d3c8126c6f10e4b952b6.tar.bz2
spec: Improve MrsP specification
For uniprocessor configurations, the selection of RTEMS_MULTIPROCESSOR_RESOURCE_SHARING results in a priority ceiling mutex. Build the MrsP validation tests only if RTEMS_SMP is enabled.
-rw-r--r--spec/rtems/sem/req/obtain.yml36
-rw-r--r--spec/rtems/sem/req/timeout.yml27
-rw-r--r--spec/score/mtx/req/seize-wait.yml9
-rw-r--r--spec/score/mtx/req/surrender.yml9
4 files changed, 44 insertions, 37 deletions
diff --git a/spec/rtems/sem/req/obtain.yml b/spec/rtems/sem/req/obtain.yml
index d1951a2b..f697f740 100644
--- a/spec/rtems/sem/req/obtain.yml
+++ b/spec/rtems/sem/req/obtain.yml
@@ -108,22 +108,30 @@ post-conditions:
is allowed, and a priority ceiling is used.
- name: MrsPMtxSeizeTry
test-code: |
+ #if defined(RTEMS_SMP)
ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_STICKY;
ctx->tq_mtx_ctx.protocol = TQ_MTX_MRSP;
ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_DEADLOCK;
ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH;
${/score/mtx/req/seize-try:/test-run}( &ctx->tq_mtx_ctx );
+ #else
+ T_unreachable();
+ #endif
text: |
The calling task shall try to seize the mutex as specified by
${/score/mtx/req/seize-try:/spec} where an enqueue is sticky, a recursive seize
returns an error status, and a priority ceiling is used.
- name: MrsPMtxSeizeWait
test-code: |
+ #if defined(RTEMS_SMP)
ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_STICKY;
ctx->tq_mtx_ctx.protocol = TQ_MTX_MRSP;
ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_DEADLOCK;
ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH;
${/score/mtx/req/seize-wait:/test-run}( &ctx->tq_mtx_ctx );
+ #else
+ T_unreachable();
+ #endif
text: |
The calling task shall wait to seize the mutex as specified by
${/score/mtx/req/seize-wait:/spec} where an enqueue is sticky, a recursive
@@ -232,9 +240,6 @@ skip-reasons:
NeedsPriorityDiscipline: |
Binary semaphores with a locking protocol are required to use the priority
task wait queue discipline.
- NoMrsP: |
- Where the system is build with SMP support disabled, the MrsP locking
- protocol is not available.
test-action: |
rtems_status_code sc;
@@ -247,6 +252,7 @@ test-action: |
);
T_rsc_success( sc );
+ #if defined(RTEMS_SMP)
if ( ( ctx->attribute_set & RTEMS_MULTIPROCESSOR_RESOURCE_SHARING ) != 0 ) {
rtems_task_priority prio;
@@ -258,6 +264,7 @@ test-action: |
);
T_rsc_success( sc );
}
+ #endif
test-brief: null
test-cleanup:
rtems_status_code sc;
@@ -337,6 +344,7 @@ transition-map:
Action: InvId
pre-conditions:
Class:
+ - MrsP
- PrioCeiling
- PrioInherit
Discipline:
@@ -397,6 +405,7 @@ transition-map:
Action: CeilingMtxSeizeTry
pre-conditions:
Class:
+ - MrsP
- PrioCeiling
Discipline:
- Priority
@@ -409,6 +418,7 @@ transition-map:
Action: CeilingMtxSeizeWait
pre-conditions:
Class:
+ - MrsP
- PrioCeiling
Discipline:
- Priority
@@ -443,15 +453,6 @@ transition-map:
- Timeout
- Forever
- enabled-by: true
- post-conditions: NoMrsP
- pre-conditions:
- Class:
- - MrsP
- Discipline:
- - Priority
- Id: all
- Wait: all
-- enabled-by: true
post-conditions: NeedsPriorityDiscipline
pre-conditions:
Class:
@@ -464,17 +465,6 @@ transition-map:
Wait: all
- enabled-by: RTEMS_SMP
post-conditions:
- Action: InvId
- pre-conditions:
- Class:
- - MrsP
- Discipline:
- - Priority
- Id:
- - Invalid
- Wait: all
-- enabled-by: RTEMS_SMP
- post-conditions:
Action: MrsPMtxSeizeTry
pre-conditions:
Class:
diff --git a/spec/rtems/sem/req/timeout.yml b/spec/rtems/sem/req/timeout.yml
index 5f7ca768..9d46c376 100644
--- a/spec/rtems/sem/req/timeout.yml
+++ b/spec/rtems/sem/req/timeout.yml
@@ -24,8 +24,12 @@ post-conditions:
${/score/tq/req/timeout:/spec}.
- name: TimeoutMrsP
test-code: |
+ #if defined(RTEMS_SMP)
ctx->tq_ctx.wait = TQ_WAIT_TIMED;
${/score/tq/req/timeout-mrsp:/test-run}( &ctx->tq_ctx );
+ #else
+ T_unreachable();
+ #endif
text: |
The semaphore obtain timeout actions shall be done as specified by
${/score/tq/req/timeout-mrsp:/spec}.
@@ -75,7 +79,11 @@ pre-conditions:
test-code: |
ctx->attribute_set |= RTEMS_BINARY_SEMAPHORE |
RTEMS_MULTIPROCESSOR_RESOURCE_SHARING;
+ #if defined(RTEMS_SMP)
ctx->tq_ctx.enqueue_variant = TQ_ENQUEUE_STICKY;
+ #else
+ ctx->tq_ctx.enqueue_variant = TQ_ENQUEUE_BLOCKS;
+ #endif
text: |
While the semaphore object is a MrsP semaphore.
test-epilogue: null
@@ -103,9 +111,6 @@ skip-reasons:
NeedsPriorityDiscipline: |
Binary semaphores with a locking protocol are required to use the priority
task wait queue discipline.
- NoMrsP: |
- Where the system is build with SMP support disabled, the MrsP locking
- protocol is not available.
test-action: |
rtems_status_code sc;
@@ -144,7 +149,6 @@ test-includes:
- string.h
test-local-includes:
- tr-tq-timeout.h
-- tr-tq-timeout-mrsp.h
- tr-tq-timeout-priority-inherit.h
- tx-thread-queue.h
- tx-support.h
@@ -163,7 +167,10 @@ test-setup:
TQInitialize( &ctx->tq_ctx );
description: null
test-stop: null
-test-support: null
+test-support: |
+ #if defined(RTEMS_SMP)
+ #include "tr-tq-timeout-mrsp.h"
+ #endif
test-target: testsuites/validation/tc-sem-timeout.c
test-teardown:
brief: null
@@ -178,10 +185,6 @@ transition-map:
Action:
- if:
pre-conditions:
- Class: MrsP
- then: TimeoutMrsP
- - if:
- pre-conditions:
Class: PrioInherit
then: TimeoutPriorityInherit
- else: Timeout
@@ -197,9 +200,9 @@ transition-map:
- MrsP
Discipline:
- FIFO
-- enabled-by:
- not: RTEMS_SMP
- post-conditions: NoMrsP
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Action: TimeoutMrsP
pre-conditions:
Class:
- MrsP
diff --git a/spec/score/mtx/req/seize-wait.yml b/spec/score/mtx/req/seize-wait.yml
index 1fb8020e..fa1ed4b5 100644
--- a/spec/score/mtx/req/seize-wait.yml
+++ b/spec/score/mtx/req/seize-wait.yml
@@ -81,7 +81,11 @@ post-conditions:
priority ceiling locking protocol.
- name: PriorityMrsP
test-code: |
+ #if defined(RTEMS_SMP)
${../../tq/req/enqueue-mrsp:/test-run}( &ctx->tq_ctx->base );
+ #else
+ T_unreachable();
+ #endif
text: |
The calling thread shall be enqueued in priority order according to the
MrsP locking protocol.
@@ -341,7 +345,6 @@ test-local-includes:
- tr-tq-enqueue-ceiling.h
- tr-tq-enqueue-deadlock.h
- tr-tq-enqueue-fifo.h
-- tr-tq-enqueue-mrsp.h
- tr-tq-enqueue-priority.h
- tr-tq-enqueue-priority-inherit.h
test-prepare: |
@@ -352,6 +355,10 @@ test-prepare: |
test-setup: null
test-stop: null
test-support: |
+ #if defined(RTEMS_SMP)
+ #include "tr-tq-enqueue-mrsp.h"
+ #endif
+
typedef ${.:/test-context-type} Context;
static Status_Control Status( const Context *ctx, Status_Control status )
diff --git a/spec/score/mtx/req/surrender.yml b/spec/score/mtx/req/surrender.yml
index ba81710f..e2a5be3e 100644
--- a/spec/score/mtx/req/surrender.yml
+++ b/spec/score/mtx/req/surrender.yml
@@ -90,8 +90,12 @@ post-conditions:
with priority inheritance.
- name: MrsP
test-code: |
+ #if defined(RTEMS_SMP)
T_eq_u32( ctx->counter, 1 );
${../../tq/req/surrender-mrsp:/test-run}( &ctx->tq_ctx->base );
+ #else
+ T_unreachable();
+ #endif
text: |
The thread queue of the mutex shall be surrendered in priority order
with MrsP.
@@ -376,7 +380,6 @@ test-includes: []
test-local-includes:
- tr-mtx-surrender.h
- tr-tq-surrender.h
-- tr-tq-surrender-mrsp.h
- tr-tq-surrender-priority-inherit.h
test-prepare: |
ctx->owner_caller = false;
@@ -392,6 +395,10 @@ test-prepare: |
test-setup: null
test-stop: null
test-support: |
+ #if defined(RTEMS_SMP)
+ #include "tr-tq-surrender-mrsp.h"
+ #endif
+
typedef ${.:/test-context-type} Context;
static Status_Control Status( const Context *ctx, Status_Control status )