Changeset 3a5dbdc in rtems


Ignore:
Timestamp:
07/31/95 22:22:38 (28 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
4a6e64d
Parents:
0ea07c0
Message:

Switched to events for mp receive server and eliminated the special
blocking mechanism for it.

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/rtems/src/mp.c

    r0ea07c0 r3a5dbdc  
    5656void rtems_multiprocessing_announce ( void )
    5757{
    58   _Thread_MP_Ready();
     58  _Thread_Disable_dispatch();
     59  _Event_sets_Post(
     60    RTEMS_EVENT_0,
     61    &_Internal_threads_System_initialization_thread->pending_events
     62  );
     63  _Event_Surrender( _Internal_threads_System_initialization_thread );
     64  _Thread_Enable_dispatch();
    5965}
    6066
     
    6571 */
    6672
     73typedef void (*packet_processor)( rtems_packet_prefix * );
     74
     75packet_processor _Multiprocessor_Packet_processors[] = {
     76  _Internal_threads_MP_Process_packet, /* RTEMS_MP_PACKET_INTERNAL_THREADS */
     77  _RTEMS_tasks_MP_Process_packet,      /* RTEMS_MP_PACKET_TASKS */
     78  _Message_queue_MP_Process_packet,    /* RTEMS_MP_PACKET_MESSAGE_QUEUE */
     79  _Semaphore_MP_Process_packet,        /* RTEMS_MP_PACKET_SEMAPHORE */
     80  _Partition_MP_Process_packet,        /* RTEMS_MP_PACKET_PARTITION */
     81  0,                                   /* RTEMS_MP_PACKET_REGION */
     82  _Event_MP_Process_packet,            /* RTEMS_MP_PACKET_EVENT */
     83  _Signal_MP_Process_packet            /* RTEMS_MP_PACKET_SIGNAL */
     84};
     85
    6786Thread _Multiprocessing_Receive_server (
    6887  Thread_Argument ignored
     
    7190
    7291  rtems_packet_prefix *the_packet;
    73 
    74   _Thread_Dispatch_disable_level = 1;
     92  packet_processor     the_function;
    7593
    7694  for ( ; ; ) {
    7795
    78     _Internal_threads_System_initialization_thread->Notepads[ 0 ] = 1;
     96    _Thread_Disable_dispatch();
     97    _Event_Seize( RTEMS_EVENT_0, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT );
     98    _Thread_Enable_dispatch();
    7999
    80     the_packet = _MPCI_Receive_packet();
     100    for ( ; ; ) {
     101      the_packet = _MPCI_Receive_packet();
    81102
    82     if ( ! the_packet ) {
    83       _Thread_MP_Block();
    84       _Thread_Dispatch_disable_level = 1;
    85     }
    86     else {
     103      if ( !the_packet )
     104        break;
    87105
    88106      _Thread_Executing->receive_packet = the_packet;
    89107
     108      if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) )
     109        break;
     110
     111      the_function = _Multiprocessor_Packet_processors[ the_packet->the_class ];
     112   
     113      if ( !the_function )
     114        break;
     115
     116      (*the_function)( the_packet );
     117#if 0
    90118      switch ( the_packet->the_class ) {
    91 
     119 
    92120        case RTEMS_MP_PACKET_INTERNAL_THREADS:
    93121          _Internal_threads_MP_Process_packet( the_packet );
    94122          break;
    95 
     123 
    96124        case RTEMS_MP_PACKET_TASKS:
    97125          _RTEMS_tasks_MP_Process_packet( the_packet );
    98126          break;
    99 
     127 
    100128        case RTEMS_MP_PACKET_MESSAGE_QUEUE:
    101129          _Message_queue_MP_Process_packet( the_packet );
    102130          break;
    103 
     131 
    104132        case RTEMS_MP_PACKET_SEMAPHORE:
    105133          _Semaphore_MP_Process_packet( the_packet );
    106134          break;
    107 
     135 
    108136        case RTEMS_MP_PACKET_PARTITION:
    109137          _Partition_MP_Process_packet( the_packet );
    110138          break;
    111 
     139 
    112140        case RTEMS_MP_PACKET_REGION:
    113141          /* Global regions are unsupported at this time */
    114142          break;
    115 
     143 
    116144        case RTEMS_MP_PACKET_EVENT:
    117145          _Event_MP_Process_packet( the_packet );
    118146          break;
    119 
     147 
    120148        case RTEMS_MP_PACKET_SIGNAL:
    121149          _Signal_MP_Process_packet( the_packet );
    122150          break;
    123151      }
     152#endif
     153
     154
    124155    }
    125156  }
  • c/src/exec/score/headers/mppkt.h

    r0ea07c0 r3a5dbdc  
    3939typedef enum {
    4040  RTEMS_MP_PACKET_INTERNAL_THREADS = 0,
    41   RTEMS_MP_PACKET_TASKS      = 1,
     41  RTEMS_MP_PACKET_TASKS            = 1,
    4242  RTEMS_MP_PACKET_MESSAGE_QUEUE    = 2,
    4343  RTEMS_MP_PACKET_SEMAPHORE        = 3,
  • c/src/exec/score/headers/threadmp.h

    r0ea07c0 r3a5dbdc  
    9191
    9292/*
    93  *  _Thread_MP_Block
    94  *
    95  *  DESCRIPTION:
    96  *
    97  *  This routine blocks the MP Receive server thread.
    98  */
    99 
    100 void _Thread_MP_Block( void );
    101 
    102 /*
    103  *  _Thread_MP_Ready
    104  *
    105  *  DESCRIPTION:
    106  *
    107  *  This routine readies the MP Receive server thread.
    108  */
    109 
    110 void _Thread_MP_Ready( void );
    111 
    112 /*
    11393 *  The following is used to determine when the multiprocessing receive
    11494 *  thread is executing so that a proxy can be allocated instead of
  • c/src/exec/score/include/rtems/score/mppkt.h

    r0ea07c0 r3a5dbdc  
    3939typedef enum {
    4040  RTEMS_MP_PACKET_INTERNAL_THREADS = 0,
    41   RTEMS_MP_PACKET_TASKS      = 1,
     41  RTEMS_MP_PACKET_TASKS            = 1,
    4242  RTEMS_MP_PACKET_MESSAGE_QUEUE    = 2,
    4343  RTEMS_MP_PACKET_SEMAPHORE        = 3,
  • c/src/exec/score/include/rtems/score/threadmp.h

    r0ea07c0 r3a5dbdc  
    9191
    9292/*
    93  *  _Thread_MP_Block
    94  *
    95  *  DESCRIPTION:
    96  *
    97  *  This routine blocks the MP Receive server thread.
    98  */
    99 
    100 void _Thread_MP_Block( void );
    101 
    102 /*
    103  *  _Thread_MP_Ready
    104  *
    105  *  DESCRIPTION:
    106  *
    107  *  This routine readies the MP Receive server thread.
    108  */
    109 
    110 void _Thread_MP_Ready( void );
    111 
    112 /*
    11393 *  The following is used to determine when the multiprocessing receive
    11494 *  thread is executing so that a proxy can be allocated instead of
  • c/src/exec/score/src/thread.c

    r0ea07c0 r3a5dbdc  
    317317      if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
    318318        _Thread_Heir = the_thread;
    319         if ( _Modes_Is_preempt( _Thread_Executing->current_modes ) )
     319        if ( _Modes_Is_preempt( _Thread_Executing->current_modes ) ||
     320             the_thread->current_priority == 0 )
    320321          _Context_Switch_necessary = TRUE;
    321322      }
  • c/src/exec/score/src/threadmp.c

    r0ea07c0 r3a5dbdc  
    158158  return NULL;
    159159}
    160 
    161 /*PAGE
    162  *
    163  *  _Thread_MP_Block
    164  *
    165  */
    166 
    167 void _Thread_MP_Block( void )
    168 {
    169   ISR_Level   level;
    170 
    171   _ISR_Disable( level );
    172 
    173     if ( _Thread_MP_Receive->Notepads[ 0 ] != 0 ) {
    174       _Priority_Remove_from_bit_map( &_Thread_MP_Receive->Priority_map );
    175 
    176       _Thread_MP_Receive->current_state = STATES_SUSPENDED;
    177 
    178       _ISR_Flash( level );
    179 
    180       _Thread_Calculate_heir();
    181 
    182       _Context_Switch_necessary = TRUE;
    183 
    184       _ISR_Enable( level );
    185 
    186       _Thread_Dispatch_disable_level = 0;
    187 
    188       _Thread_Dispatch();
    189 
    190       return;
    191 
    192     }
    193   _ISR_Enable( level );
    194 
    195 }
    196 
    197 /*PAGE
    198  *
    199  *  _Thread_MP_Ready
    200  *
    201  */
    202 
    203 void _Thread_MP_Ready( void )
    204 {
    205   ISR_Level   level;
    206 
    207   _ISR_Disable( level );
    208 
    209     if ( _States_Is_suspended( _Thread_MP_Receive->current_state ) ) {
    210       _Priority_Add_to_bit_map( &_Thread_MP_Receive->Priority_map );
    211 
    212       _Thread_MP_Receive->current_state = STATES_READY;
    213 
    214       _Thread_Heir = _Thread_MP_Receive;
    215 
    216       _Context_Switch_necessary = TRUE;
    217 
    218       _ISR_Enable( level );
    219 
    220       if ( _Thread_Is_dispatching_enabled() )
    221         _Thread_Dispatch();
    222 
    223     } else {
    224 
    225       _Thread_MP_Receive->Notepads[ 0 ] = 0;
    226       _ISR_Enable( level );
    227 
    228     }
    229 }
  • cpukit/rtems/src/mp.c

    r0ea07c0 r3a5dbdc  
    5656void rtems_multiprocessing_announce ( void )
    5757{
    58   _Thread_MP_Ready();
     58  _Thread_Disable_dispatch();
     59  _Event_sets_Post(
     60    RTEMS_EVENT_0,
     61    &_Internal_threads_System_initialization_thread->pending_events
     62  );
     63  _Event_Surrender( _Internal_threads_System_initialization_thread );
     64  _Thread_Enable_dispatch();
    5965}
    6066
     
    6571 */
    6672
     73typedef void (*packet_processor)( rtems_packet_prefix * );
     74
     75packet_processor _Multiprocessor_Packet_processors[] = {
     76  _Internal_threads_MP_Process_packet, /* RTEMS_MP_PACKET_INTERNAL_THREADS */
     77  _RTEMS_tasks_MP_Process_packet,      /* RTEMS_MP_PACKET_TASKS */
     78  _Message_queue_MP_Process_packet,    /* RTEMS_MP_PACKET_MESSAGE_QUEUE */
     79  _Semaphore_MP_Process_packet,        /* RTEMS_MP_PACKET_SEMAPHORE */
     80  _Partition_MP_Process_packet,        /* RTEMS_MP_PACKET_PARTITION */
     81  0,                                   /* RTEMS_MP_PACKET_REGION */
     82  _Event_MP_Process_packet,            /* RTEMS_MP_PACKET_EVENT */
     83  _Signal_MP_Process_packet            /* RTEMS_MP_PACKET_SIGNAL */
     84};
     85
    6786Thread _Multiprocessing_Receive_server (
    6887  Thread_Argument ignored
     
    7190
    7291  rtems_packet_prefix *the_packet;
    73 
    74   _Thread_Dispatch_disable_level = 1;
     92  packet_processor     the_function;
    7593
    7694  for ( ; ; ) {
    7795
    78     _Internal_threads_System_initialization_thread->Notepads[ 0 ] = 1;
     96    _Thread_Disable_dispatch();
     97    _Event_Seize( RTEMS_EVENT_0, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT );
     98    _Thread_Enable_dispatch();
    7999
    80     the_packet = _MPCI_Receive_packet();
     100    for ( ; ; ) {
     101      the_packet = _MPCI_Receive_packet();
    81102
    82     if ( ! the_packet ) {
    83       _Thread_MP_Block();
    84       _Thread_Dispatch_disable_level = 1;
    85     }
    86     else {
     103      if ( !the_packet )
     104        break;
    87105
    88106      _Thread_Executing->receive_packet = the_packet;
    89107
     108      if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) )
     109        break;
     110
     111      the_function = _Multiprocessor_Packet_processors[ the_packet->the_class ];
     112   
     113      if ( !the_function )
     114        break;
     115
     116      (*the_function)( the_packet );
     117#if 0
    90118      switch ( the_packet->the_class ) {
    91 
     119 
    92120        case RTEMS_MP_PACKET_INTERNAL_THREADS:
    93121          _Internal_threads_MP_Process_packet( the_packet );
    94122          break;
    95 
     123 
    96124        case RTEMS_MP_PACKET_TASKS:
    97125          _RTEMS_tasks_MP_Process_packet( the_packet );
    98126          break;
    99 
     127 
    100128        case RTEMS_MP_PACKET_MESSAGE_QUEUE:
    101129          _Message_queue_MP_Process_packet( the_packet );
    102130          break;
    103 
     131 
    104132        case RTEMS_MP_PACKET_SEMAPHORE:
    105133          _Semaphore_MP_Process_packet( the_packet );
    106134          break;
    107 
     135 
    108136        case RTEMS_MP_PACKET_PARTITION:
    109137          _Partition_MP_Process_packet( the_packet );
    110138          break;
    111 
     139 
    112140        case RTEMS_MP_PACKET_REGION:
    113141          /* Global regions are unsupported at this time */
    114142          break;
    115 
     143 
    116144        case RTEMS_MP_PACKET_EVENT:
    117145          _Event_MP_Process_packet( the_packet );
    118146          break;
    119 
     147 
    120148        case RTEMS_MP_PACKET_SIGNAL:
    121149          _Signal_MP_Process_packet( the_packet );
    122150          break;
    123151      }
     152#endif
     153
     154
    124155    }
    125156  }
  • cpukit/score/include/rtems/score/mppkt.h

    r0ea07c0 r3a5dbdc  
    3939typedef enum {
    4040  RTEMS_MP_PACKET_INTERNAL_THREADS = 0,
    41   RTEMS_MP_PACKET_TASKS      = 1,
     41  RTEMS_MP_PACKET_TASKS            = 1,
    4242  RTEMS_MP_PACKET_MESSAGE_QUEUE    = 2,
    4343  RTEMS_MP_PACKET_SEMAPHORE        = 3,
  • cpukit/score/include/rtems/score/threadmp.h

    r0ea07c0 r3a5dbdc  
    9191
    9292/*
    93  *  _Thread_MP_Block
    94  *
    95  *  DESCRIPTION:
    96  *
    97  *  This routine blocks the MP Receive server thread.
    98  */
    99 
    100 void _Thread_MP_Block( void );
    101 
    102 /*
    103  *  _Thread_MP_Ready
    104  *
    105  *  DESCRIPTION:
    106  *
    107  *  This routine readies the MP Receive server thread.
    108  */
    109 
    110 void _Thread_MP_Ready( void );
    111 
    112 /*
    11393 *  The following is used to determine when the multiprocessing receive
    11494 *  thread is executing so that a proxy can be allocated instead of
  • cpukit/score/src/thread.c

    r0ea07c0 r3a5dbdc  
    317317      if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
    318318        _Thread_Heir = the_thread;
    319         if ( _Modes_Is_preempt( _Thread_Executing->current_modes ) )
     319        if ( _Modes_Is_preempt( _Thread_Executing->current_modes ) ||
     320             the_thread->current_priority == 0 )
    320321          _Context_Switch_necessary = TRUE;
    321322      }
  • cpukit/score/src/threadmp.c

    r0ea07c0 r3a5dbdc  
    158158  return NULL;
    159159}
    160 
    161 /*PAGE
    162  *
    163  *  _Thread_MP_Block
    164  *
    165  */
    166 
    167 void _Thread_MP_Block( void )
    168 {
    169   ISR_Level   level;
    170 
    171   _ISR_Disable( level );
    172 
    173     if ( _Thread_MP_Receive->Notepads[ 0 ] != 0 ) {
    174       _Priority_Remove_from_bit_map( &_Thread_MP_Receive->Priority_map );
    175 
    176       _Thread_MP_Receive->current_state = STATES_SUSPENDED;
    177 
    178       _ISR_Flash( level );
    179 
    180       _Thread_Calculate_heir();
    181 
    182       _Context_Switch_necessary = TRUE;
    183 
    184       _ISR_Enable( level );
    185 
    186       _Thread_Dispatch_disable_level = 0;
    187 
    188       _Thread_Dispatch();
    189 
    190       return;
    191 
    192     }
    193   _ISR_Enable( level );
    194 
    195 }
    196 
    197 /*PAGE
    198  *
    199  *  _Thread_MP_Ready
    200  *
    201  */
    202 
    203 void _Thread_MP_Ready( void )
    204 {
    205   ISR_Level   level;
    206 
    207   _ISR_Disable( level );
    208 
    209     if ( _States_Is_suspended( _Thread_MP_Receive->current_state ) ) {
    210       _Priority_Add_to_bit_map( &_Thread_MP_Receive->Priority_map );
    211 
    212       _Thread_MP_Receive->current_state = STATES_READY;
    213 
    214       _Thread_Heir = _Thread_MP_Receive;
    215 
    216       _Context_Switch_necessary = TRUE;
    217 
    218       _ISR_Enable( level );
    219 
    220       if ( _Thread_Is_dispatching_enabled() )
    221         _Thread_Dispatch();
    222 
    223     } else {
    224 
    225       _Thread_MP_Receive->Notepads[ 0 ] = 0;
    226       _ISR_Enable( level );
    227 
    228     }
    229 }
Note: See TracChangeset for help on using the changeset viewer.