diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-12 12:12:21 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-12 12:12:21 +0100 |
commit | edf92bc262564c9c3015e11503f6a7beed5e4a29 (patch) | |
tree | d018679862c7c8a3176e04631c252b05c119b3cc | |
parent | 941a69ec3dae167525d8e61c92e1ea5329d52f22 (diff) |
testsuites/validation/tc-sched-smp.c
-rw-r--r-- | testsuites/validation/tc-sched-smp.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/testsuites/validation/tc-sched-smp.c b/testsuites/validation/tc-sched-smp.c index c617c212dc..483a5d475f 100644 --- a/testsuites/validation/tc-sched-smp.c +++ b/testsuites/validation/tc-sched-smp.c @@ -237,6 +237,11 @@ typedef struct { volatile bool busy[ WORKER_COUNT ];; /** + * @brief If this member is true, then the worker shall be in the busy loop. + */ + volatile bool is_busy[ WORKER_COUNT ];; + + /** * @brief This member contains the per-CPU jobs. */ Per_CPU_Job job[ 2 ]; @@ -275,10 +280,18 @@ static void SendAndSync( Context *ctx, WorkerIndex worker, Event event ) static void MakeBusy( Context *ctx, WorkerIndex worker ) { + ctx->is_busy[ worker ] = false; ctx->busy[ worker ] = true; SendEvents( ctx->worker_id[ worker ], EVENT_BUSY ); } +static void WaitForBusy( Context *ctx, WorkerIndex worker ) +{ + while ( !ctx->is_busy[ worker ] ) { + /* Wait */ + } +} + static void StopBusy( Context *ctx, WorkerIndex worker ) { ctx->busy[ worker ] = false; @@ -645,9 +658,13 @@ static void Worker( rtems_task_argument arg, WorkerIndex worker ) } if ( ( events & EVENT_BUSY ) != 0 ) { + ctx->is_busy[ worker ] = true; + while ( ctx->busy[ worker ] ) { /* Wait */ } + + ctx->is_busy[ worker ] = false; } } } @@ -747,8 +764,9 @@ static void ScoreSchedSmpValSmp_Action_0( ScoreSchedSmpValSmp_Context *ctx ) SendAndSync( ctx, WORKER_B, EVENT_OBTAIN ); SetScheduler( ctx->worker_id[ WORKER_C ], SCHEDULER_B_ID, PRIO_HIGH ); SetPriority( ctx->worker_id[ WORKER_A ], PRIO_NORMAL ); - SendAndSync( ctx, WORKER_A, EVENT_STICKY_OBTAIN ); + SendEvents( ctx->worker_id[ WORKER_A ], EVENT_STICKY_OBTAIN ); MakeBusy( ctx, WORKER_A ); + WaitForBusy( ctx, WORKER_A ); /* * Reschedule worker A by the home scheduler while worker A is not scheduled |