summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-05 10:09:21 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-07 08:53:53 +0200
commit78344da6057fb6ac0b8bb904c18b5675ad197317 (patch)
tree0c3f1acc3c36cb713658f950669617b2773fe9bb
parentspec: Specify scheduler detail (diff)
downloadrtems-central-78344da6057fb6ac0b8bb904c18b5675ad197317.tar.bz2
spec: Specify thread free of FPU owner
-rw-r--r--spec/score/thread/req/free-fpu-owner.yml17
-rw-r--r--spec/score/thread/val/thread.yml66
2 files changed, 83 insertions, 0 deletions
diff --git a/spec/score/thread/req/free-fpu-owner.yml b/spec/score/thread/req/free-fpu-owner.yml
new file mode 100644
index 00000000..6b818177
--- /dev/null
+++ b/spec/score/thread/req/free-fpu-owner.yml
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/group
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+ While a thread least recently used the
+ ${/glossary/floatingpointcoprocessor:/term}, when the thread resources are
+ freed, the thread-specific resources used by the
+ ${/glossary/floatingpointcoprocessor:/term} shall be freed.
+type: requirement
diff --git a/spec/score/thread/val/thread.yml b/spec/score/thread/val/thread.yml
index 48d4311a..ca735df8 100644
--- a/spec/score/thread/val/thread.yml
+++ b/spec/score/thread/val/thread.yml
@@ -78,6 +78,43 @@ test-actions:
links:
- role: validation
uid: ../req/cancel-killer
+- action-brief: |
+ Delete a thread which least recently used the
+ ${/glossary/floatingpointcoprocessor:/term}.
+ action-code: |
+ rtems_status_code sc;
+
+ SetSelfPriority( PRIO_NORMAL );
+ sc = rtems_task_create(
+ rtems_build_name( 'W', 'O', 'R', 'K'),
+ PRIO_HIGH,
+ TEST_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_FLOATING_POINT,
+ &ctx->worker_id
+ );
+ T_rsc_success( sc );
+ checks:
+ - brief: |
+ Start the worker thread. Let it use the
+ ${/glossary/floatingpointcoprocessor:/term}.
+ code: |
+ StartTask( ctx->worker_id, FloatingPointTask, ctx );
+ links: []
+ - brief: |
+ Delete the worker thread and free the thread resources.
+ code: |
+ DeleteTask( ctx->worker_id );
+ KillZombies();
+ links:
+ - role: validation
+ uid: ../req/free-fpu-owner
+ - brief: |
+ Clean up all used resources.
+ code: |
+ RestoreRunnerPriority();
+ links: []
+ links: []
test-brief: |
Tests general thread behaviour.
test-context:
@@ -91,6 +128,11 @@ test-context:
description: null
member: |
rtems_id killer_id
+- brief: |
+ This member contains a floating-point object.
+ description: null
+ member: |
+ volatile double fp_obj
test-context-support: null
test-description: null
test-header: null
@@ -99,6 +141,7 @@ test-includes:
- rtems/score/statesimpl.h
- rtems/score/threadimpl.h
test-local-includes:
+- ts-config.h
- tx-support.h
test-setup: null
test-stop: null
@@ -122,6 +165,29 @@ test-support: |
SuspendSelf();
}
+ static void GoBackToRunner( void *arg )
+ {
+ Context *ctx;
+
+ ctx = arg;
+ SetPriority( ctx->worker_id, PRIO_LOW );
+ }
+
+ static void FloatingPointTask( rtems_task_argument arg )
+ {
+ Context *ctx;
+
+ ctx = (Context *) arg;
+ ctx->fp_obj *= 1.23;
+
+ /*
+ * We use an interrupt to go back to the runner since on some
+ * architectures, the floating-point context is only saved during interrupt
+ * processing and not for synchronous thread switches.
+ */
+ CallWithinISR( GoBackToRunner, ctx );
+ }
+
static void KillerTask( rtems_task_argument arg )
{
Context *ctx;