summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-26 14:33:12 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-28 09:19:40 +0200
commite0980dfb2a09b599dda28aff2f790d3ca6e1f9ad (patch)
tree5146186955d4c650dfcad268c447fb2f11fac405
parentspec: Document new task delete behaviour (diff)
downloadrtems-central-e0980dfb2a09b599dda28aff2f790d3ca6e1f9ad.tar.bz2
spec: Use priority inheritance for thread join
-rw-r--r--spec/rtems/task/req/delete.yml67
-rw-r--r--spec/rtems/task/req/exit.yml24
-rw-r--r--spec/rtems/task/req/restart.yml6
3 files changed, 47 insertions, 50 deletions
diff --git a/spec/rtems/task/req/delete.yml b/spec/rtems/task/req/delete.yml
index 76d60ff6..10500521 100644
--- a/spec/rtems/task/req/delete.yml
+++ b/spec/rtems/task/req/delete.yml
@@ -67,21 +67,20 @@ post-conditions:
not be in the zombie state after the ${../if/delete:/name} call.
test-epilogue: null
test-prologue: null
-- name: RealPriority
+- name: TaskPriority
states:
- - name: Raised
+ - name: Raise
test-code: |
T_eq_u32( ctx->worker_priority, PRIO_ULTRA_HIGH );
text: |
- The ${/glossary/priority-real:/term} of the task specified by the
- ${../if/delete:/params[0]/name} parameter shall be raised to the
- ${/glossary/priority-current:/term} of the caller of
- ${../if/delete:/name}.
+ Each priority of the calling task which is higher than the highest
+ priority of the task specified by the ${../if/delete:/params[0]/name}
+ parameter shall be made the highest priority of the task.
- name: Nop
test-code: |
T_eq_u32( ctx->worker_priority, PRIO_NORMAL );
text: |
- The ${/glossary/priority-real:/term} of the task specified by the
+ The priorities of the task specified by the
${../if/delete:/params[0]/name} parameter shall not be changed by the
${../if/delete:/name} call.
test-epilogue: null
@@ -290,20 +289,19 @@ pre-conditions:
test-prologue: null
- name: CallerPriority
states:
- - name: Higher
+ - name: Vital
test-code: |
- ctx->deleter_has_higher_priority = true;
+ ctx->vital_deleter_priority = true;
text: |
- While the ${/glossary/priority-current:/term} of the task calling
- ${../if/delete:/name} is higher than the ${/glossary/priority-real:/term}
- of the task specified by the ${../if/delete:/params[0]/name} parameter.
- - name: LowerEqual
+ While at least one priority of the calling task is higher than the
+ highest priority of the task specified by the
+ ${../if/delete:/params[0]/name} parameter.
+ - name: Dispensable
test-code: |
- ctx->deleter_has_higher_priority = false;
+ ctx->vital_deleter_priority = false;
text: |
- While the ${/glossary/priority-current:/term} of the task calling
- ${../if/delete:/name} is lower than or equal to the
- ${/glossary/priority-real:/term} of the task specified by the
+ While all priorities of the calling task are lower than or equal to the
+ highest priority of the task specified by the
${../if/delete:/params[0]/name} parameter.
test-epilogue: null
test-prologue: null
@@ -657,11 +655,11 @@ test-context:
member: |
bool timer_active
- brief: |
- If this member is true, then the deleter shall have a higher current
- priority than the real priority of the worker.
+ If this member is true, then the deleter shall have a vital priority for
+ the worker.
description: null
member: |
- bool deleter_has_higher_priority
+ bool vital_deleter_priority
- brief: |
If this member is true, then thread dispatching is disabled by the worker
task before the ${../if/delete:/name} call.
@@ -759,7 +757,7 @@ test-support: |
ctx->worker_state = ctx->worker_tcb->current_state;
ctx->worker_life_state = ctx->worker_tcb->Life.state;
ctx->worker_priority =
- SCHEDULER_PRIORITY_UNMAP( ctx->worker_tcb->Real_priority.priority );
+ SCHEDULER_PRIORITY_UNMAP( _Thread_Get_priority( ctx->worker_tcb ) );
CopyExtensionCalls( &ctx->calls, &ctx->calls_after_restart );
GetTaskTimerInfoByThread( ctx->worker_tcb, &ctx->worker_timer_info );
}
@@ -998,7 +996,7 @@ test-support: |
ctx = (Context *) arg;
if ( ctx != NULL ) {
- if ( !ctx->deleter_has_higher_priority ) {
+ if ( !ctx->vital_deleter_priority ) {
SetPriority( ctx->runner_id, PRIO_LOW );
SetSelfPriorityNoYield( PRIO_NORMAL );
}
@@ -1156,7 +1154,7 @@ transition-map:
Suspended: 'Yes'
then: 'No'
- else: 'Yes'
- RealPriority: Nop
+ TaskPriority: Nop
State:
- specified-by: State
Timer:
@@ -1231,12 +1229,12 @@ transition-map:
then-specified-by: Suspended
- else: 'No'
Zombie: 'No'
- RealPriority:
+ TaskPriority:
- if:
pre-conditions:
Context: Task
- CallerPriority: Higher
- then: Raised
+ CallerPriority: Vital
+ then: Raise
- else: Nop
State:
- if:
@@ -1292,7 +1290,7 @@ transition-map:
Dormant: N/A
Suspended: N/A
Zombie: N/A
- RealPriority: N/A
+ TaskPriority: N/A
State: N/A
Timer: N/A
Restarting: N/A
@@ -1320,19 +1318,8 @@ transition-map:
pre-conditions:
Context: Interrupt
then: CalledFromISR
- - if:
- pre-conditions:
- Context: Task
- ThreadDispatch: Disabled
- then: NoReturn
- else: Ok
- FatalError:
- - if:
- pre-conditions:
- Context: Task
- ThreadDispatch: Disabled
- then: 'Yes'
- - else: Nop
+ FatalError: Nop
Dormant: 'Yes'
Suspended:
- specified-by: Suspended
@@ -1342,7 +1329,7 @@ transition-map:
Context: Interrupt
then: 'No'
- else: 'Yes'
- RealPriority: Nop
+ TaskPriority: Nop
State: Ready
Timer: Inactive
Restarting: 'No'
diff --git a/spec/rtems/task/req/exit.yml b/spec/rtems/task/req/exit.yml
index 521b136e..1704b5ce 100644
--- a/spec/rtems/task/req/exit.yml
+++ b/spec/rtems/task/req/exit.yml
@@ -64,19 +64,27 @@ post-conditions:
${../if/exit:/name} call.
test-epilogue: null
test-prologue: null
-- name: Block
+- name: Zombie
states:
- name: 'Yes'
test-code: |
event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
T_eq_int( event->operation, T_SCHEDULER_BLOCK );
T_eq_u32( event->thread->Object.id, ctx->worker_id );
+ T_eq_u32( event->thread->current_state, STATES_ZOMBIE );
if ( ctx->terminating ) {
+ /* The thread waiting for the worker exit was unblocked */
event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
T_eq_u32( event->thread->Object.id, ctx->deleter_id );
+ /* Inherited priority was removed */
+ event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
+ T_eq_int( event->operation, T_SCHEDULER_UPDATE_PRIORITY );
+ T_eq_u32( event->thread->Object.id, ctx->worker_id );
+
+ /* The deleter task suspended itself */
event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
T_eq_int( event->operation, T_SCHEDULER_BLOCK );
T_eq_u32( event->thread->Object.id, ctx->deleter_id );
@@ -85,13 +93,14 @@ post-conditions:
event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
T_eq_int( event->operation, T_SCHEDULER_NOP );
text: |
- The calling task shall be blocked exactly once by the ${../if/exit:/name}
- call.
- - name: Nop
+ The thread state of the calling task shall be set to the zombie state by
+ the ${../if/exit:/name} call.
+ - name: 'No'
test-code: |
T_eq_sz( ctx->scheduler_log.header.recorded, 0 );
text: |
- No task shall be blocked by the ${../if/exit:/name} call.
+ The thread state of the calling task shall be not modified by the
+ ${../if/exit:/name} call.
test-epilogue: null
test-prologue: |
const T_scheduler_event *event;
@@ -322,6 +331,7 @@ test-includes:
- rtems.h
- rtems/test-scheduler.h
- rtems/score/apimutex.h
+- rtems/score/statesimpl.h
- rtems/score/threaddispatch.h
test-local-includes:
- tx-support.h
@@ -508,7 +518,7 @@ transition-map:
DeleteExtensions: Nop
RestartExtensions: Nop
TerminateExtensions: 'Yes'
- Block: 'Yes'
+ Zombie: 'Yes'
ID: Invalid
Delete: NextAllocate
pre-conditions:
@@ -523,7 +533,7 @@ transition-map:
DeleteExtensions: Nop
RestartExtensions: Nop
TerminateExtensions: Nop
- Block: Nop
+ Zombie: 'No'
ID: Valid
Delete: Nop
pre-conditions:
diff --git a/spec/rtems/task/req/restart.yml b/spec/rtems/task/req/restart.yml
index 1318aaa5..523f5dc0 100644
--- a/spec/rtems/task/req/restart.yml
+++ b/spec/rtems/task/req/restart.yml
@@ -124,7 +124,7 @@ post-conditions:
T_eq_ptr( event->thread, ctx->worker_tcb );
}
- if ( !ctx->real_priority_is_initial ) {
+ if ( !ctx->real_priority_is_initial && !ctx->terminating ) {
event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
T_eq_int( event->operation, T_SCHEDULER_UPDATE_PRIORITY );
T_eq_ptr( event->thread, ctx->worker_tcb );
@@ -161,7 +161,7 @@ post-conditions:
}
}
- if ( !ctx->real_priority_is_initial ) {
+ if ( !ctx->real_priority_is_initial && !ctx->terminating ) {
event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
T_eq_int( event->operation, T_SCHEDULER_UPDATE_PRIORITY );
T_eq_ptr( event->thread, ctx->worker_tcb );
@@ -198,7 +198,7 @@ post-conditions:
}
}
- if ( !ctx->real_priority_is_initial ) {
+ if ( !ctx->real_priority_is_initial && !ctx->terminating ) {
event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
T_eq_int( event->operation, T_SCHEDULER_UPDATE_PRIORITY );
T_eq_ptr( event->thread, ctx->worker_tcb );