diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-08 11:08:24 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-23 11:00:28 +0100 |
commit | c69a70a597ec5df75a51bfa39c14198a5c5fb22e (patch) | |
tree | 345bef38c0158a520c437d363e6b52ad276e03f0 /cpukit/include/rtems/score/schedulersmpimpl.h | |
parent | score: Fix assertion in SMP scheduler framework (diff) | |
download | rtems-c69a70a597ec5df75a51bfa39c14198a5c5fb22e.tar.bz2 |
rtems: Fix rtems_scheduler_remove_processor()
Return an error status for the following error condition in
rtems_scheduler_remove_processor():
While an attempt is made to remove a processor from a scheduler, while
the processor is the only processor owned by the scheduler, if a thread
exists which uses the scheduler as a helping scheduler, then the
processor shall not be removed.
The reason is that ask for help requests and withdraw node requests are
processed asynchronously in any order. An ask for help request carried
out on a scheduler without a processor is undefined behaviour.
Update error status description.
Update #4544.
Diffstat (limited to '')
-rw-r--r-- | cpukit/include/rtems/score/schedulersmpimpl.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/cpukit/include/rtems/score/schedulersmpimpl.h b/cpukit/include/rtems/score/schedulersmpimpl.h index 97a77121ed..c37f53c8c0 100644 --- a/cpukit/include/rtems/score/schedulersmpimpl.h +++ b/cpukit/include/rtems/score/schedulersmpimpl.h @@ -1978,8 +1978,9 @@ static inline Thread_Control *_Scheduler_SMP_Remove_processor( victim_owner = _Scheduler_Node_get_owner( victim_node ); if ( !victim_owner->is_idle ) { - Thread_Control *victim_idle; - Scheduler_Node *idle_node; + Thread_Control *victim_idle; + Scheduler_Node *idle_node; + Priority_Control insert_priority; victim_idle = _Scheduler_Release_idle_thread_if_necessary( victim_node, @@ -1996,13 +1997,10 @@ static inline Thread_Control *_Scheduler_SMP_Remove_processor( _Scheduler_SMP_Allocate_processor_exact ); - if ( !_Chain_Is_empty( &self->Scheduled ) ) { - Priority_Control insert_priority; - - insert_priority = _Scheduler_SMP_Node_priority( victim_node ); - insert_priority = SCHEDULER_PRIORITY_APPEND( insert_priority ); - ( *enqueue )( &self->Base, victim_node, insert_priority ); - } + _Assert( !_Chain_Is_empty( &self->Scheduled ) ); + insert_priority = _Scheduler_SMP_Node_priority( victim_node ); + insert_priority = SCHEDULER_PRIORITY_APPEND( insert_priority ); + ( *enqueue )( &self->Base, victim_node, insert_priority ); } else { _Assert( victim_owner == victim_user ); _Assert( _Scheduler_Node_get_idle( victim_node ) == NULL ); |