Changeset 8a6de83 in rtems


Ignore:
Timestamp:
Feb 17, 2014, 9:10:27 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
b39e055
Parents:
38ee758
git-author:
Sebastian Huber <sebastian.huber@…> (02/17/14 09:10:27)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/19/14 08:59:39)
Message:

score: Move _SMP_Request_other_cores_to_shutdown()

Move _SMP_Request_other_cores_to_shutdown() invocation from
rtems_shutdown_executive() to _Internal_error_Occurred() to allow a
proper shutdown on SMP configurations even in the error case.

Location:
cpukit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/src/exshutdown.c

    r38ee758 r8a6de83  
    1818#include <rtems/score/interr.h>
    1919
    20 #if defined(RTEMS_SMP)
    21   #include <rtems/score/smp.h>
    22 #endif
    23 
    2420void rtems_shutdown_executive( uint32_t result )
    2521{
     
    2925
    3026  if ( _System_state_Is_up( _System_state_Get() ) ) {
    31     #if defined(RTEMS_SMP)
    32       _SMP_Request_other_cores_to_shutdown();
    33     #endif
    34 
    3527    source      = RTEMS_FATAL_SOURCE_EXIT;
    3628    is_internal = false;
  • cpukit/score/include/rtems/score/interr.h

    r38ee758 r8a6de83  
    187187 *
    188188 * For the initial extensions the read-write data (including BSS segment) is
    189  * not required.
     189 * not required on single processor configurations.  On SMP configurations
     190 * however the read-write data must be initialized since this function must
     191 * determine the state of the other processors and request them to shut-down if
     192 * necessary.
    190193 *
    191194 * Non-initial extensions require in addition valid read-write data.  The BSP
  • cpukit/score/include/rtems/score/smp.h

    r38ee758 r8a6de83  
    8989void _SMP_Request_other_cores_to_perform_first_context_switch(void);
    9090
     91#endif /* defined( RTEMS_SMP ) */
     92
    9193/**
    9294 *  @brief Request other cores to shutdown.
     
    9496 *  Send message to other cores requesting them to shutdown.
    9597 */
    96 void _SMP_Request_other_cores_to_shutdown(void);
    97 
    98 #endif /* defined( RTEMS_SMP ) */
     98#if defined( RTEMS_SMP )
     99  void _SMP_Request_other_cores_to_shutdown( void );
     100#else
     101  #define _SMP_Request_other_cores_to_shutdown() \
     102    do { } while ( 0 )
     103#endif
    99104
    100105#endif /* !defined( ASM ) */
  • cpukit/score/src/interr.c

    r38ee758 r8a6de83  
    2121#include <rtems/score/interr.h>
    2222#include <rtems/score/isrlevel.h>
     23#include <rtems/score/smp.h>
    2324#include <rtems/score/sysstate.h>
    2425#include <rtems/score/userextimpl.h>
     
    3940  (void) level;
    4041
     42  _SMP_Request_other_cores_to_shutdown();
     43
    4144  _User_extensions_Fatal( the_source, is_internal, the_error );
    4245
  • cpukit/score/src/smp.c

    r38ee758 r8a6de83  
    2323#include <rtems/score/threadimpl.h>
    2424#include <rtems/score/smp.h>
    25 #include <rtems/score/sysstate.h>
     25#include <rtems/config.h>
    2626
    2727#if defined(RTEMS_DEBUG)
     
    138138{
    139139  uint32_t self = _SMP_Get_current_processor();
    140   uint32_t ncpus = _SMP_Get_processor_count();
     140
     141  /*
     142   * Do not use _SMP_Get_processor_count() since this value might be not
     143   * initialized yet.  For example due to a fatal error in the middle of
     144   * bsp_smp_initialize().
     145   */
     146  uint32_t ncpus = rtems_configuration_get_maximum_processors();
     147
    141148  uint32_t cpu;
    142 
    143   _SMP_Broadcast_message( RTEMS_BSP_SMP_SHUTDOWN );
    144149
    145150  for ( cpu = 0 ; cpu < ncpus ; ++cpu ) {
    146151    if ( cpu != self ) {
    147       _Per_CPU_Wait_for_state(
    148         _Per_CPU_Get_by_index( cpu ),
    149         PER_CPU_STATE_SHUTDOWN
    150       );
     152      const Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu );
     153
     154      if ( per_cpu->state != PER_CPU_STATE_BEFORE_INITIALIZATION ) {
     155        _SMP_Send_message( cpu, RTEMS_BSP_SMP_SHUTDOWN );
     156      }
    151157    }
    152158  }
Note: See TracChangeset for help on using the changeset viewer.