diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-08-11 14:50:06 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-08-11 14:51:23 +0200 |
commit | 5bf5cc67b599f1fc1bd0ce4ae150a654b3fde575 (patch) | |
tree | 5b76d999a9828abb130329b2fe21e54e5ffed811 | |
parent | spec: Specify rtems_status_text() (diff) | |
download | rtems-central-5bf5cc67b599f1fc1bd0ce4ae150a654b3fde575.tar.bz2 |
spec: Specify per-processor jobs order
-rw-r--r-- | spec/score/smp/req/per-cpu-jobs-order.yml | 14 | ||||
-rw-r--r-- | spec/score/smp/val/per-cpu-jobs.yml | 85 |
2 files changed, 99 insertions, 0 deletions
diff --git a/spec/score/smp/req/per-cpu-jobs-order.yml b/spec/score/smp/req/per-cpu-jobs-order.yml new file mode 100644 index 00000000..30527bf9 --- /dev/null +++ b/spec/score/smp/req/per-cpu-jobs-order.yml @@ -0,0 +1,14 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: RTEMS_SMP +links: +- role: requirement-refinement + uid: ../if/group +functional-type: function +rationale: null +references: [] +requirement-type: functional +text: | + Per-processor jobs shall be processed in ${/glossary/fifo:/term} order. +type: requirement diff --git a/spec/score/smp/val/per-cpu-jobs.yml b/spec/score/smp/val/per-cpu-jobs.yml new file mode 100644 index 00000000..11686152 --- /dev/null +++ b/spec/score/smp/val/per-cpu-jobs.yml @@ -0,0 +1,85 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: RTEMS_SMP +links: [] +test-actions: +- action-brief: | + Issue two jobs on the current processor with interrupts disabled. Wait for + completion of the second job. + action-code: | + rtems_interrupt_level level; + Per_CPU_Control *cpu; + + rtems_interrupt_local_disable(level); + cpu = _Per_CPU_Get(); + _Per_CPU_Add_job( cpu, &job_0 ); + _Per_CPU_Submit_job( cpu, &job_1 ); + rtems_interrupt_local_enable(level); + + _Per_CPU_Wait_for_job( cpu, &job_1 ); + checks: + - brief: | + Check that the first job was processed firstly. + code: | + T_step_eq_int( ${step}, counter_0, 1 ); + links: + - role: validation + uid: ../req/per-cpu-jobs-order + - brief: | + Check that the second job was processed secondly. + code: | + T_step_eq_int( ${step}, counter_1, 2 ); + links: + - role: validation + uid: ../req/per-cpu-jobs-order + links: [] +test-brief: | + Tests the processing order of per-processor jobs. +test-context: [] +test-context-support: null +test-description: null +test-header: [] +test-includes: +- rtems.h +- rtems/score/atomic.h +- rtems/score/percpu.h +test-local-includes: [] +test-setup: null +test-stop: null +test-support: | + static Atomic_Uint job_counter; + + static void Increment( void *arg ) + { + unsigned int *value; + + value = (unsigned int *) arg; + *value = + _Atomic_Fetch_add_uint( &job_counter, 1, ATOMIC_ORDER_RELAXED ) + 1; + } + + static unsigned int counter_0; + + static const Per_CPU_Job_context job_context_0 = { + .handler = Increment, + .arg = &counter_0 + }; + + Per_CPU_Job job_0 = { + .context = &job_context_0 + }; + + static unsigned int counter_1; + + static const Per_CPU_Job_context job_context_1 = { + .handler = Increment, + .arg = &counter_1 + }; + + Per_CPU_Job job_1 = { + .context = &job_context_1, + }; +test-target: testsuites/validation/tc-score-smp-per-cpu-jobs.c +test-teardown: null +type: test-case |