summaryrefslogtreecommitdiffstats
path: root/testsuites/validation/tc-sem-performance.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-09-26 08:34:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-09-26 09:40:20 +0200
commit5a21b1d1331c9cfb5ffcb0903ff751981757285e (patch)
tree2bde31e8657184b60deb1577fe28991f50b34281 /testsuites/validation/tc-sem-performance.c
parentvalidation: Simplify partition performance test (diff)
downloadrtems-5a21b1d1331c9cfb5ffcb0903ff751981757285e.tar.bz2
validation: 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. Update #3716.
Diffstat (limited to '')
-rw-r--r--testsuites/validation/tc-sem-performance.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/testsuites/validation/tc-sem-performance.c b/testsuites/validation/tc-sem-performance.c
index 0014306ddb..5861e3ee8e 100644
--- a/testsuites/validation/tc-sem-performance.c
+++ b/testsuites/validation/tc-sem-performance.c
@@ -382,9 +382,10 @@ static void RtemsSemReqPerfMtxPiReleaseOne_Setup(
RtemsSemValPerf_Context *ctx
)
{
+ SetSelfPriority( PRIO_HIGH );
ObtainMutex( ctx->mutex_id );
Send( ctx, EVENT_OBTAIN );
- SetPriority( ctx->worker_id, PRIO_LOW );
+ Yield();
Send( ctx, EVENT_RELEASE );
}
@@ -401,6 +402,11 @@ static void RtemsSemReqPerfMtxPiReleaseOne_Setup_Wrap( void *arg )
*/
static void RtemsSemReqPerfMtxPiReleaseOne_Body( RtemsSemValPerf_Context *ctx )
{
+ /*
+ * 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 );
}
@@ -426,7 +432,7 @@ static bool RtemsSemReqPerfMtxPiReleaseOne_Teardown(
{
T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
- SetPriority( ctx->worker_id, PRIO_HIGH );
+ SetSelfPriority( PRIO_NORMAL );
return tic == toc;
}
@@ -734,7 +740,7 @@ static void RtemsSemReqPerfMtxPiWaitForever_Setup(
)
{
Send( ctx, EVENT_OBTAIN );
- SetPriority( ctx->worker_id, PRIO_LOW );
+ SetSelfPriority( PRIO_VERY_HIGH );
Send( ctx, EVENT_END | EVENT_RELEASE );
}
@@ -784,8 +790,8 @@ static bool RtemsSemReqPerfMtxPiWaitForever_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;
}
@@ -825,7 +831,7 @@ static bool RtemsSemReqPerfMtxPiWaitForever_Teardown_Wrap(
static void RtemsSemReqPerfMtxPiWaitTimed_Setup( RtemsSemValPerf_Context *ctx )
{
Send( ctx, EVENT_OBTAIN );
- SetPriority( ctx->worker_id, PRIO_LOW );
+ SetSelfPriority( PRIO_VERY_HIGH );
Send( ctx, EVENT_END | EVENT_RELEASE );
}
@@ -873,8 +879,8 @@ static bool RtemsSemReqPerfMtxPiWaitTimed_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;
}