Changeset a7ce0ce in rtems


Ignore:
Timestamp:
Jun 13, 2013, 8:34:12 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
39e51758
Parents:
9c9b62d8
git-author:
Sebastian Huber <sebastian.huber@…> (06/13/13 08:34:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/17/13 11:09:49)
Message:

smp: Delete RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY

The thread dispatch is a side-effect of interrupt processing, thus there
is no need to send an explicit message.

Location:
cpukit/score
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/smp.h

    r9c9b62d8 ra7ce0ce  
    3434 * @{
    3535 */
    36 
    37 /**
    38  *  This defines the bit which indicates the interprocessor interrupt
    39  *  has been requested so that RTEMS will reschedule on this CPU
    40  *  because the currently executing thread needs to be switched out.
    41  */
    42 #define RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY  0x01
    4336
    4437/**
  • cpukit/score/src/smp.c

    r9c9b62d8 ra7ce0ce  
    7070  int              self = bsp_smp_processor_id();
    7171  Per_CPU_Control *per_cpu = &_Per_CPU_Information[ self ];
    72   uint32_t         message;
    73   ISR_Level        level;
    74 
    75 
    76   _Per_CPU_Lock_acquire( per_cpu, level );
    77   message = per_cpu->message;
    78   per_cpu->message = 0;
    79   _Per_CPU_Lock_release( per_cpu, level );
    80 
    81   #if defined(RTEMS_DEBUG)
    82     {
    83       void *sp = __builtin_frame_address(0);
    84       if ( !(message & RTEMS_BSP_SMP_SHUTDOWN) ) {
    85         printk( "ISR on CPU %d -- (0x%02x) (0x%p)\n", self, message, sp );
    86         if ( message & RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY )
    87           printk( "context switch necessary\n" );
    88         if ( message & RTEMS_BSP_SMP_SIGNAL_TO_SELF )
    89           printk( "signal to self\n" );
    90         if ( message & RTEMS_BSP_SMP_SHUTDOWN )
    91           printk( "shutdown\n" );
     72
     73
     74  if ( per_cpu->message != 0 ) {
     75    uint32_t  message;
     76    ISR_Level level;
     77
     78    _Per_CPU_Lock_acquire( per_cpu, level );
     79    message = per_cpu->message;
     80    per_cpu->message = 0;
     81    _Per_CPU_Lock_release( per_cpu, level );
     82
     83    #if defined(RTEMS_DEBUG)
     84      {
     85        void *sp = __builtin_frame_address(0);
     86        if ( !(message & RTEMS_BSP_SMP_SHUTDOWN) ) {
     87          printk( "ISR on CPU %d -- (0x%02x) (0x%p)\n", self, message, sp );
     88          if ( message & RTEMS_BSP_SMP_SIGNAL_TO_SELF )
     89            printk( "signal to self\n" );
     90          if ( message & RTEMS_BSP_SMP_SHUTDOWN )
     91            printk( "shutdown\n" );
     92        }
     93        printk( "Dispatch level %d\n", _Thread_Dispatch_get_disable_level() );
    9294      }
    93  
    94       printk( "Dispatch level %d\n", _Thread_Dispatch_get_disable_level() );
    95     }
    96   #endif
    97 
    98   if ( message & RTEMS_BSP_SMP_SHUTDOWN ) {
    99     _ISR_Disable_on_this_core( level );
    100 
    101     while ( _Thread_Dispatch_decrement_disable_level() != 0 ) {
    102       /* Release completely */
    103     }
    104 
    105     _Per_CPU_Change_state( per_cpu, PER_CPU_STATE_SHUTDOWN );
    106 
    107     _CPU_Fatal_halt( self );
    108     /* does not continue past here */
     95    #endif
     96
     97    if ( ( message & RTEMS_BSP_SMP_SHUTDOWN ) != 0 ) {
     98      _ISR_Disable_on_this_core( level );
     99
     100      _Thread_Dispatch_set_disable_level( 0 );
     101
     102      _Per_CPU_Change_state( per_cpu, PER_CPU_STATE_SHUTDOWN );
     103
     104      _CPU_Fatal_halt( self );
     105      /* does not continue past here */
     106    }
    109107  }
    110108}
     
    180178          && per_cpu->dispatch_necessary
    181179      ) {
    182         _SMP_Send_message( cpu, RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY );
     180        _SMP_Send_message( cpu, 0 );
    183181      }
    184182    }
Note: See TracChangeset for help on using the changeset viewer.