[rtems-central commit] spec: Specify SMP scheduler detail

Sebastian Huber sebh at rtems.org
Wed Nov 24 09:17:34 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Nov 24 09:57:14 2021 +0100

spec: Specify SMP scheduler detail

---

 spec/score/sched/smp/req/block-reuse-idle.yml | 17 +++++++++++
 spec/score/sched/smp/val/smp.yml              | 44 +++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

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 0000000..175db44
--- /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 28963f0..5588e73 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;



More information about the vc mailing list