rtems: Fix rtems_scheduler_remove_processor()

Account for the thread processor affinity and make sure that it is
possible to allocate a processor to each thread dedicated to a scheduler
instance.

Update #3059.
This commit is contained in:
Sebastian Huber
2017-07-03 10:38:31 +02:00
parent 6b1d8c7865
commit 1ec9c86fb6

View File

@@ -45,7 +45,13 @@ static bool _Scheduler_Check_processor_removal(
_Thread_Wait_acquire( the_thread, &queue_context );
_Thread_State_acquire_critical( the_thread, &state_context );
if ( _Thread_Scheduler_get_home( the_thread ) == iter_context->scheduler ) {
if (
_Thread_Scheduler_get_home( the_thread ) == iter_context->scheduler
&& !_Processor_mask_Has_overlap(
&the_thread->Scheduler.Affinity,
_Scheduler_Get_processors( iter_context->scheduler )
)
) {
iter_context->status = RTEMS_RESOURCE_IN_USE;
}
@@ -103,9 +109,7 @@ rtems_status_code rtems_scheduler_remove_processor(
_Scheduler_Release_critical( scheduler, &lock_context );
_ISR_lock_ISR_enable( &lock_context );
if ( processor_count == 0 ) {
_Thread_Iterate( _Scheduler_Check_processor_removal, &iter_context );
}
_Thread_Iterate( _Scheduler_Check_processor_removal, &iter_context );
_ISR_lock_ISR_disable( &lock_context );
_Scheduler_Acquire_critical( scheduler, &lock_context );