summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-03-15 19:34:53 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-03-16 07:40:09 +0100
commit8878fa03232532d0d4512bcb3142aca3e3e060fa (patch)
treee42065c5f0241d53b98a9b1b882b5aa03c85e3b8
parentinterface: Limit integer type to 64 bits maximum (diff)
downloadrtems-central-8878fa03232532d0d4512bcb3142aca3e3e060fa.tar.bz2
spec: Improve interrupt set affinity handling
-rw-r--r--spec/rtems/intr/if/set-affinity.yml7
-rw-r--r--spec/rtems/intr/req/set-affinity.yml181
2 files changed, 142 insertions, 46 deletions
diff --git a/spec/rtems/intr/if/set-affinity.yml b/spec/rtems/intr/if/set-affinity.yml
index 9d9909ee..648dcb3d 100644
--- a/spec/rtems/intr/if/set-affinity.yml
+++ b/spec/rtems/intr/if/set-affinity.yml
@@ -2,7 +2,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
brief: |
Sets the processor affinity set of the interrupt vector.
copyrights:
-- Copyright (C) 2017, 2021 embedded brains GmbH (http://www.embedded-brains.de)
+- Copyright (C) 2017, 2022 embedded brains GmbH (http://www.embedded-brains.de)
definition:
default:
attributes: null
@@ -34,6 +34,11 @@ name: rtems_interrupt_set_affinity
notes: |
The ${get-attributes:/name} directive may be used to check if the processor
affinity of an interrupt vector can be set.
+
+ Only online processors of the affinity set specified by ${.:/params[1]/name}
+ and ${.:/params[2]/name} are considered by the directive. Other processors
+ of the set are ignored. If the set contains no online processor, then the
+ set is invalid and an error status is returned.
params:
- description: |
is the interrupt vector number.
diff --git a/spec/rtems/intr/req/set-affinity.yml b/spec/rtems/intr/req/set-affinity.yml
index 926fb9b6..ecd6de51 100644
--- a/spec/rtems/intr/req/set-affinity.yml
+++ b/spec/rtems/intr/req/set-affinity.yml
@@ -1,6 +1,6 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
-- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+- Copyright (C) 2021, 2022 embedded brains GmbH (http://www.embedded-brains.de)
enabled-by: true
functional-type: action
links:
@@ -43,7 +43,7 @@ post-conditions:
test-prologue: null
- name: SetAffinity
states:
- - name: 'Yes'
+ - name: Set
test-code: |
/* Validation done by CheckSetAffinity() for each interrupt vector */
text: |
@@ -81,33 +81,75 @@ pre-conditions:
associated with an interrupt vector.
test-epilogue: null
test-prologue: null
-- name: CPUSetKind
+- name: CPUSetSize
states:
- - name: Valid
+ - name: Askew
+ test-code: |
+ ctx->cpusetsize = SIZE_MAX;
+ text: |
+ While the ${../if/set-affinity:/params[1]/name} parameter is not an
+ integral multiple of the size of long.
+ - name: Normal
test-code: |
ctx->cpusetsize = sizeof( ctx->cpuset_obj[ 0 ] );
text: |
While the ${../if/set-affinity:/params[1]/name} parameter is an integral
multiple of the size of long,
- while the ${../if/set-affinity:/params[1]/name} and
- ${../if/set-affinity:/params[2]/name} parameter specify a processor set
- which is within the implementation limits.
+ while the ${../if/set-affinity:/params[1]/name} parameter is less than or
+ equal to the maximum processor set size storable in the system.
- name: Huge
test-code: |
ctx->cpusetsize = sizeof( ctx->cpuset_obj );
- CPU_ZERO( &ctx->cpuset_obj[ 0 ] );
text: |
While the ${../if/set-affinity:/params[1]/name} parameter is an integral
multiple of the size of long,
- while the ${../if/set-affinity:/params[1]/name} and
- ${../if/set-affinity:/params[2]/name} parameter specify a processor set
- which exceeds the implementation limits.
- - name: Askew
+ while the ${../if/set-affinity:/params[1]/name} parameter is greater than
+ the maximum processor set size storable in the system.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUSetOnline
+ states:
+ - name: Valid
test-code: |
- ctx->cpusetsize = SIZE_MAX;
+ /* Already prepared */
text: |
- While the ${../if/set-affinity:/params[1]/name} parameter is not an
- integral multiple of the size of long.
+ While the intersection of the processor set specified by the
+ ${../if/set-affinity:/params[1]/name} and
+ ${../if/set-affinity:/params[2]/name} parameters and the set of online
+ processors is not empty,
+ while the intersection of the processor set specified by the
+ ${../if/set-affinity:/params[1]/name} and
+ ${../if/set-affinity:/params[2]/name} parameters and the set of online
+ processors is a processor affinity set supported by the interrupt vector.
+ - name: Empty
+ test-code: |
+ CPU_ZERO( &ctx->cpuset_obj[ 0 ] );
+ text: |
+ While the intersection of the processor set specified by the
+ ${../if/set-affinity:/params[1]/name} and
+ ${../if/set-affinity:/params[2]/name} parameters and the set of online
+ processors is empty.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUSetHuge
+ states:
+ - name: NotZero
+ test-code: |
+ /* Already prepared */
+ text: |
+ While the processor set specified by the
+ ${../if/set-affinity:/params[1]/name} and
+ ${../if/set-affinity:/params[2]/name} parameters contains at least one
+ processor which is not storable in a processor set supported by the
+ system.
+ - name: Zero
+ test-code: |
+ CPU_ZERO( &ctx->cpuset_obj[ 1 ] );
+ text: |
+ While the processor set specified by the
+ ${../if/set-affinity:/params[1]/name} and
+ ${../if/set-affinity:/params[2]/name} parameters contains no processor
+ which is not storable in a processor set supported by the system.
test-epilogue: null
test-prologue: null
- name: CPUSet
@@ -151,7 +193,7 @@ test-action: |
if (
ctx->valid_vector && ctx->cpusetsize == sizeof( ctx->cpuset_obj[ 0 ] ) &&
- ctx->cpuset == &ctx->cpuset_obj[ 0 ]
+ ctx->cpuset == &ctx->cpuset_obj[ 0 ] && !CPU_EMPTY( &ctx->cpuset_obj[ 0 ] )
) {
for (
ctx->vector = 0;
@@ -170,6 +212,7 @@ test-action: |
T_rsc_success( sc );
CheckSetAffinity( ctx, &attr );
+ ctx->status = RTEMS_SUCCESSFUL;
}
} else {
cpu_set_t set;
@@ -177,6 +220,8 @@ test-action: |
CPU_ZERO( &set );
CPU_ZERO( &set2 );
+ CPU_SET( 0, &set );
+ CPU_SET( 0, &set2 );
if ( ctx->valid_vector ) {
ctx->vector = ctx->some_vector;
@@ -187,7 +232,9 @@ test-action: |
ctx->vector = BSP_INTERRUPT_VECTOR_COUNT;
}
- CPU_ZERO( &ctx->cpuset_obj[ 0 ] );
+ if ( !CPU_EMPTY( &ctx->cpuset_obj[ 0 ] ) ) {
+ CPU_COPY( &set, &ctx->cpuset_obj[ 0 ] );
+ }
ctx->status = rtems_interrupt_set_affinity(
ctx->vector,
@@ -308,74 +355,118 @@ text: ${.:text-template}
transition-map:
- enabled-by: true
post-conditions:
- Status: Ok
- SetAffinity: 'Yes'
+ Status:
+ - if:
+ pre-conditions:
+ CPUSetSize: Askew
+ then: InvNum
+ - if:
+ pre-conditions:
+ CPUSetOnline: Empty
+ then: InvNum
+ - if:
+ pre-conditions:
+ CanSetAffinity: 'No'
+ then: Unsat
+ - else: Ok
+ SetAffinity:
+ - if:
+ post-conditions:
+ Status: Ok
+ then: Set
+ - else: Nop
pre-conditions:
Vector:
- Valid
- CPUSetKind:
- - Valid
+ CPUSetSize:
+ - Askew
+ - Normal
+ CPUSetOnline: all
+ CPUSetHuge: N/A
CPUSet:
- Valid
- CanSetAffinity:
- - 'Yes'
+ CanSetAffinity: all
- enabled-by: true
post-conditions:
- Status: InvAddr
- SetAffinity: Nop
+ Status:
+ - if:
+ pre-conditions:
+ CPUSetOnline: Empty
+ then: InvNum
+ - if:
+ pre-conditions:
+ CanSetAffinity: 'No'
+ then: Unsat
+ - else: Ok
+ SetAffinity:
+ - if:
+ post-conditions:
+ Status: Ok
+ then: Set
+ - else: Nop
pre-conditions:
Vector:
- Valid
- CPUSetKind: all
+ CPUSetSize:
+ - Huge
+ CPUSetOnline: all
+ CPUSetHuge: all
CPUSet:
- - 'Null'
+ - Valid
CanSetAffinity: all
- enabled-by: true
post-conditions:
Status: InvAddr
- SetAffinity: N/A
+ SetAffinity: Nop
pre-conditions:
Vector:
- - Invalid
- CPUSetKind: all
+ - Valid
+ CPUSetSize: all
+ CPUSetOnline: N/A
+ CPUSetHuge: N/A
CPUSet:
- 'Null'
- CanSetAffinity: N/A
+ CanSetAffinity: all
- enabled-by: true
post-conditions:
Status: InvId
- SetAffinity: N/A
+ SetAffinity: Nop
pre-conditions:
Vector:
- Invalid
- CPUSetKind: all
+ CPUSetSize:
+ - Askew
+ - Normal
+ CPUSetOnline: N/A
+ CPUSetHuge: N/A
CPUSet:
- Valid
CanSetAffinity: N/A
- enabled-by: true
post-conditions:
- Status: InvNum
+ Status: InvId
SetAffinity: Nop
pre-conditions:
Vector:
- - Valid
- CPUSetKind:
+ - Invalid
+ CPUSetSize:
- Huge
- - Askew
+ CPUSetOnline: N/A
+ CPUSetHuge: all
CPUSet:
- Valid
- CanSetAffinity: all
+ CanSetAffinity: N/A
- enabled-by: true
post-conditions:
- Status: Unsat
+ Status: InvAddr
SetAffinity: Nop
pre-conditions:
Vector:
- - Valid
- CPUSetKind:
- - Valid
+ - Invalid
+ CPUSetSize: all
+ CPUSetOnline: N/A
+ CPUSetHuge: N/A
CPUSet:
- - Valid
- CanSetAffinity:
- - 'No'
+ - 'Null'
+ CanSetAffinity: N/A
type: requirement