Changeset 6b1d8c7 in rtems


Ignore:
Timestamp:
Jul 4, 2017, 5:28:44 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1ec9c86
Parents:
7851555
git-author:
Sebastian Huber <sebastian.huber@…> (07/04/17 05:28:44)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/07/17 05:28:35)
Message:

score: Add processor set to scheduler context

Replace the simple processor count with the processor set owned by the
scheduler instance.

Update #3059.

Location:
cpukit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/src/scheduleraddprocessor.c

    r7851555 r6b1d8c7  
    9696    _ISR_lock_ISR_disable( &lock_context );
    9797    _Scheduler_Acquire_critical( scheduler, &lock_context );
    98     ++scheduler_context->processor_count;
     98    _Processor_mask_Set( &scheduler_context->Processors, cpu_index );
    9999    cpu->Scheduler.control = scheduler;
    100100    cpu->Scheduler.context = scheduler_context;
  • cpukit/rtems/src/schedulergetprocessorset.c

    r7851555 r6b1d8c7  
    11/*
    2  * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2014, 2017 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
     
    2727)
    2828{
    29   const Scheduler_Control *scheduler;
     29  const Scheduler_Control    *scheduler;
     30  const Processor_mask       *processor_set;
     31  Processor_mask_Copy_status  status;
    3032
    3133  if ( cpuset == NULL ) {
     
    3840  }
    3941
    40   if ( !_CPU_set_Is_large_enough( cpusetsize ) ) {
     42  processor_set = _Scheduler_Get_processors( scheduler );
     43  status = _Processor_mask_To_cpu_set_t( processor_set, cpusetsize, cpuset );
     44  if ( status != PROCESSOR_MASK_COPY_LOSSLESS ) {
    4145    return RTEMS_INVALID_NUMBER;
    4246  }
    4347
    44   _Scheduler_Get_processor_set( scheduler, cpusetsize, cpuset );
    45 
    4648  return RTEMS_SUCCESSFUL;
    4749}
  • cpukit/rtems/src/schedulerremoveprocessor.c

    r7851555 r6b1d8c7  
    9999  _ISR_lock_ISR_disable( &lock_context );
    100100  _Scheduler_Acquire_critical( scheduler, &lock_context );
    101   processor_count = scheduler_context->processor_count - 1;
    102   scheduler_context->processor_count = processor_count;
     101  _Processor_mask_Clear( &scheduler_context->Processors, cpu_index );
     102  processor_count = _Processor_mask_Count( &scheduler_context->Processors );
    103103  _Scheduler_Release_critical( scheduler, &lock_context );
    104104  _ISR_lock_ISR_enable( &lock_context );
     
    131131    _Assert( _Chain_Is_empty( &idle->Scheduler.Scheduler_nodes ) );
    132132  } else {
    133     ++scheduler_context->processor_count;
     133    _Processor_mask_Set( &scheduler_context->Processors, cpu_index );
    134134  }
    135135
  • cpukit/score/include/rtems/score/scheduler.h

    r7851555 r6b1d8c7  
    228228#if defined(RTEMS_SMP)
    229229  /**
    230    * @brief Count of processors owned by this scheduler instance.
    231    */
    232   uint32_t processor_count;
     230   * @brief The set of processors owned by this scheduler instance.
     231   */
     232  Processor_mask Processors;
    233233#endif
    234234} Scheduler_Context;
  • cpukit/score/include/rtems/score/schedulerimpl.h

    r7851555 r6b1d8c7  
    590590}
    591591
    592 RTEMS_INLINE_ROUTINE void _Scheduler_Get_processor_set(
    593   const Scheduler_Control *scheduler,
    594   size_t                   cpusetsize,
    595   cpu_set_t               *cpuset
    596 )
    597 {
    598   uint32_t cpu_count = _SMP_Get_processor_count();
    599   uint32_t cpu_index;
    600 
    601   CPU_ZERO_S( cpusetsize, cpuset );
    602 
    603   for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
    604 #if defined(RTEMS_SMP)
    605     if ( _Scheduler_Has_processor_ownership( scheduler, cpu_index ) ) {
    606       CPU_SET_S( (int) cpu_index, cpusetsize, cpuset );
    607     }
     592RTEMS_INLINE_ROUTINE const Processor_mask *_Scheduler_Get_processors(
     593  const Scheduler_Control *scheduler
     594)
     595{
     596#if defined(RTEMS_SMP)
     597  return &_Scheduler_Get_context( scheduler )->Processors;
    608598#else
    609     (void) scheduler;
    610 
    611     CPU_SET_S( (int) cpu_index, cpusetsize, cpuset );
    612 #endif
    613   }
     599  return &_Processor_mask_The_one_and_only;
     600#endif
    614601}
    615602
     
    689676{
    690677#if defined(RTEMS_SMP)
    691   return _Scheduler_Get_context( scheduler )->processor_count;
     678  const Scheduler_Context *context = _Scheduler_Get_context( scheduler );
     679
     680  return _Processor_mask_Count( &context->Processors );
    692681#else
    693682  (void) scheduler;
  • cpukit/score/src/smp.c

    r7851555 r6b1d8c7  
    9898      context = _Scheduler_Get_context( scheduler );
    9999
    100       ++context->processor_count;
     100      _Processor_mask_Set( &_SMP_Online_processors, cpu_index );
     101      _Processor_mask_Set( &context->Processors, cpu_index );
    101102      cpu->Scheduler.control = scheduler;
    102103      cpu->Scheduler.context = context;
    103 
    104       _Processor_mask_Set( &_SMP_Online_processors, cpu_index );
    105104    }
    106105  }
Note: See TracChangeset for help on using the changeset viewer.