Changeset e239760 in rtems


Ignore:
Timestamp:
Apr 29, 2014, 2:09:35 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
145becf
Parents:
d20b029
git-author:
Sebastian Huber <sebastian.huber@…> (04/29/14 14:09:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/05/14 06:26:27)
Message:

score: SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS

Avoid the SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS fatal error and make it
a run-time error in rtems_scheduler_ident() and _Scheduler_Get_by_id().

Files:
4 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems/rtems/tasks.h

    rd20b029 re239760  
    598598 * @retval RTEMS_INVALID_ADDRESS The @a id parameter is @c NULL.
    599599 * @retval RTEMS_INVALID_NAME Invalid scheduler name.
     600 * @retval RTEMS_UNSATISFIED A scheduler with this name exists, but the
     601 * processor set of this scheduler is empty.
    600602 */
    601603rtems_status_code rtems_scheduler_ident(
  • cpukit/rtems/src/schedulerident.c

    rd20b029 re239760  
    3434
    3535    for ( i = 0 ; i < n && sc == RTEMS_INVALID_NAME ; ++i ) {
    36       if ( _Scheduler_Table[ i ].name == name ) {
    37         *id = _Scheduler_Build_id( i );
    38         sc = RTEMS_SUCCESSFUL;
     36      const Scheduler_Control *scheduler = &_Scheduler_Table[ i ];
     37
     38      if ( scheduler->name == name ) {
     39        if ( _Scheduler_Get_processor_count( scheduler ) > 0 ) {
     40          *id = _Scheduler_Build_id( i );
     41          sc = RTEMS_SUCCESSFUL;
     42        } else {
     43          sc = RTEMS_UNSATISFIED;
     44        }
    3945      }
    4046    }
  • cpukit/score/include/rtems/score/schedulerimpl.h

    rd20b029 re239760  
    572572}
    573573
     574RTEMS_INLINE_ROUTINE uint32_t _Scheduler_Get_processor_count(
     575  const Scheduler_Control *scheduler
     576)
     577{
     578#if defined(RTEMS_SMP)
     579  return scheduler->context->processor_count;
     580#else
     581  (void) scheduler;
     582
     583  return 1;
     584#endif
     585}
     586
    574587RTEMS_INLINE_ROUTINE Objects_Id _Scheduler_Build_id( uint32_t scheduler_index )
    575588{
     
    584597RTEMS_INLINE_ROUTINE bool _Scheduler_Get_by_id(
    585598  Objects_Id                id,
    586   const Scheduler_Control **scheduler
     599  const Scheduler_Control **scheduler_p
    587600)
    588601{
    589602  uint32_t minimum_id = _Scheduler_Build_id( 0 );
    590603  uint32_t index = id - minimum_id;
    591 
    592   *scheduler = &_Scheduler_Table[ index ];
    593 
    594   return index < _Scheduler_Count;
     604  const Scheduler_Control *scheduler = &_Scheduler_Table[ index ];
     605
     606  *scheduler_p = scheduler;
     607
     608  return index < _Scheduler_Count
     609    && _Scheduler_Get_processor_count( scheduler ) > 0;
    595610}
    596611
  • cpukit/score/include/rtems/score/smpimpl.h

    rd20b029 re239760  
    5353  SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT,
    5454  SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR,
    55   SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS,
    5655  SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED
    5756} SMP_Fatal_code;
  • cpukit/score/src/smp.c

    rd20b029 re239760  
    2525#include <rtems/score/threadimpl.h>
    2626#include <rtems/config.h>
    27 
    28 static void _SMP_Check_scheduler_configuration( void )
    29 {
    30   size_t n = _Scheduler_Count;
    31   size_t i;
    32 
    33   for ( i = 0 ; i < n ; ++i ) {
    34     const Scheduler_Control *scheduler = &_Scheduler_Table[ i ];
    35 
    36     if ( scheduler->context->processor_count == 0 ) {
    37       _SMP_Fatal( SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS );
    38     }
    39   }
    40 }
    4127
    4228static void _SMP_Start_processors( uint32_t cpu_count )
     
    7662    }
    7763  }
    78 
    79   _SMP_Check_scheduler_configuration();
    8064}
    8165
  • doc/user/conf.t

    rd20b029 re239760  
    39323932have this processor at all or it could be a problem with a boot loader for
    39333933example.  Check the @code{CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS} definition.
    3934 @item @code{SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS} - it is prohibited to have
    3935 a scheduler managing the empty processor set.
    39363934@item @code{SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR} - it is not
    39373935allowed to start multitasking on a processor with no scheduler assigned.
  • doc/user/smp.t

    rd20b029 re239760  
    447447@code{@value{RPREFIX}SUCCESSFUL} - successful operation@*
    448448@code{@value{RPREFIX}INVALID_ADDRESS} - @code{id} is NULL@*
    449 @code{@value{RPREFIX}INVALID_NAME} - invalid scheduler name
     449@code{@value{RPREFIX}INVALID_NAME} - invalid scheduler name@*
     450@code{@value{RPREFIX}UNSATISFIED} - - a scheduler with this name exists, but
     451the processor set of this scheduler is empty
    450452
    451453@subheading DESCRIPTION:
  • testsuites/smptests/Makefile.am

    rd20b029 re239760  
    1717SUBDIRS += smpfatal04
    1818SUBDIRS += smpfatal05
    19 SUBDIRS += smpfatal06
    2019SUBDIRS += smpfatal07
    2120SUBDIRS += smpfatal08
  • testsuites/smptests/configure.ac

    rd20b029 re239760  
    7272smpfatal04/Makefile
    7373smpfatal05/Makefile
    74 smpfatal06/Makefile
    7574smpfatal07/Makefile
    7675smpfatal08/Makefile
  • testsuites/smptests/smpscheduler02/init.c

    rd20b029 re239760  
    2626#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
    2727
    28 #define CPU_COUNT 2
    29 
    3028#define SCHED_A rtems_build_name(' ', ' ', ' ', 'A')
    3129
    3230#define SCHED_B rtems_build_name(' ', ' ', ' ', 'B')
     31
     32#define SCHED_C rtems_build_name(' ', ' ', ' ', 'C')
    3333
    3434static rtems_id main_task_id;
     
    5757  rtems_id scheduler_a_id;
    5858  rtems_id scheduler_b_id;
     59  rtems_id scheduler_c_id;
    5960  cpu_set_t cpuset;
    6061  cpu_set_t first_cpu;
     
    8283  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    8384  rtems_test_assert(scheduler_a_id != scheduler_b_id);
     85
     86  sc = rtems_scheduler_ident(SCHED_C, &scheduler_c_id);
     87  rtems_test_assert(sc == RTEMS_UNSATISFIED);
    8488
    8589  CPU_ZERO(&cpuset);
     
    123127  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    124128
     129  sc = rtems_task_set_scheduler(task_id, scheduler_b_id + 1);
     130  rtems_test_assert(sc == RTEMS_INVALID_ID);
     131
    125132  sc = rtems_task_get_scheduler(task_id, &scheduler_id);
    126133  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    192199#define CONFIGURE_SMP_APPLICATION
    193200
    194 #define CONFIGURE_SMP_MAXIMUM_PROCESSORS CPU_COUNT
     201/* Lets see when the first RTEMS system hits this limit */
     202#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 64
    195203
    196204#define CONFIGURE_MAXIMUM_PRIORITY 255
    197205
    198206#define CONFIGURE_SCHEDULER_PRIORITY_SMP
     207#define CONFIGURE_SCHEDULER_SIMPLE_SMP
    199208
    200209#include <rtems/scheduler.h>
     
    203212
    204213RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(b, CONFIGURE_MAXIMUM_PRIORITY + 1);
     214
     215RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(c);
    205216
    206217#define CONFIGURE_SCHEDULER_CONTROLS \
    207218  RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(a, SCHED_A), \
    208   RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(b, SCHED_B)
     219  RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(b, SCHED_B), \
     220  RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(c, SCHED_C)
    209221
    210222#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \
    211223  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
    212   RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY)
    213 
    214 #define CONFIGURE_MAXIMUM_TASKS CPU_COUNT
     224  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
     225  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     226  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     227  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     228  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     229  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     230  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     231  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     232  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     233  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     234  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     235  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     236  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     237  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     238  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     239  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     240  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     241  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     242  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     243  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     244  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     245  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     246  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     247  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     248  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     249  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     250  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     251  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     252  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     253  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     254  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     255  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     256  RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL)
     257
     258#define CONFIGURE_MAXIMUM_TASKS 2
    215259
    216260#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.