diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-24 09:57:14 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-24 09:58:44 +0100 |
commit | 5b1d4e728de21c5370fbe0d12a7cac21fe33e587 (patch) | |
tree | e78ef5dc4ed6d0397848392c2302946415817c23 | |
parent | spec: Specify SMP scheduler detail (diff) | |
download | rtems-central-5b1d4e728de21c5370fbe0d12a7cac21fe33e587.tar.bz2 |
spec: Specify SMP scheduler detail
-rw-r--r-- | spec/score/sched/smp/req/block-reuse-idle.yml | 17 | ||||
-rw-r--r-- | spec/score/sched/smp/val/smp.yml | 44 |
2 files changed, 61 insertions, 0 deletions
diff --git a/spec/score/sched/smp/req/block-reuse-idle.yml b/spec/score/sched/smp/req/block-reuse-idle.yml new file mode 100644 index 00000000..175db441 --- /dev/null +++ b/spec/score/sched/smp/req/block-reuse-idle.yml @@ -0,0 +1,17 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: RTEMS_SMP +links: +- role: requirement-refinement + uid: group +functional-type: function +rationale: null +references: [] +requirement-type: functional +text: | + While a thread is scheduled by the ${/glossary/scheduler-home:/term}, while + an idle thread executes on behalf of the thread in the home scheduler, when + the thread is blocked, the idle thread executing on behalf of the thread + shall continue to execute on behalf of the thread. +type: requirement diff --git a/spec/score/sched/smp/val/smp.yml b/spec/score/sched/smp/val/smp.yml index 28963f0d..5588e739 100644 --- a/spec/score/sched/smp/val/smp.yml +++ b/spec/score/sched/smp/val/smp.yml @@ -5,6 +5,38 @@ enabled-by: RTEMS_SMP links: [] test-actions: - action-brief: | + Construct a system state in which a sticky thread is blocked while an idle + thread executes on behalf of the thread. + action-code: | + SetScheduler( ctx->worker_id[ WORKER_B ], SCHEDULER_B_ID, PRIO_NORMAL ); + SendEvents( ctx->worker_id[ WORKER_A ], EVENT_OBTAIN ); + SendAndSync( ctx, WORKER_B, EVENT_OBTAIN ); + SetPriority( ctx->worker_id[ WORKER_A ], PRIO_NORMAL ); + SendEvents( ctx->worker_id[ WORKER_A ], EVENT_STICKY_OBTAIN ); + MakeBusy( ctx, WORKER_A ); + WaitForBusy( ctx, WORKER_A ); + checks: + - brief: | + Block the sticky worker A while it uses an idle thread in the home + scheduler. + code: | + CallWithinISR( BlockAndReuseIdle, ctx ); + links: + - role: validation + uid: ../req/block-reuse-idle + - brief: | + Clean up all used resources. + code: | + StopBusy( ctx, WORKER_A ); + SendAndSync( ctx, WORKER_A, EVENT_STICKY_RELEASE ); + SetPriority( ctx->worker_id[ WORKER_A ], PRIO_HIGH ); + SetSelfPriority( PRIO_NORMAL ); + SendEvents( ctx->worker_id[ WORKER_A ], EVENT_RELEASE ); + SendAndSync( ctx, WORKER_B, EVENT_RELEASE ); + SetScheduler( ctx->worker_id[ WORKER_B ], SCHEDULER_A_ID, PRIO_HIGH ); + links: [] + links: [] +- action-brief: | Construct a system state in which a thread is preempted while it is blocked. action-code: | @@ -811,6 +843,18 @@ test-support: | ResumeTask( ctx->runner_id ); } + static void BlockAndReuseIdle( void *arg ) + { + Context *ctx; + + ctx = arg; + SuspendTask( ctx->runner_id ); + SuspendTask( ctx->worker_id[ WORKER_A ] ); + ResumeTask( ctx->worker_id[ WORKER_A ] ); + SetPriority( ctx->runner_id, PRIO_HIGH ); + ResumeTask( ctx->runner_id ); + } + static void Preempt( void *arg ) { Context *ctx; |