Changeset 4d906bda in rtems


Ignore:
Timestamp:
May 2, 2014, 1:47:57 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
7d1436e
Parents:
145becf
git-author:
Sebastian Huber <sebastian.huber@…> (05/02/14 13:47:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/05/14 06:32:58)
Message:

score: Use atomic operations for SMP messages

Location:
cpukit/score
Files:
3 edited

Legend:

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

    r145becf r4d906bda  
    303303
    304304    /**
    305      *  This is the request for the interrupt.
     305     * @brief Bit field for SMP messages.
    306306     *
    307      *  @note This may become a chain protected by atomic instructions.
    308      */
    309     uint32_t message;
     307     * This bit field is not protected locks.  Atomic operations are used to
     308     * set and get the message bits.
     309     */
     310    Atomic_Ulong message;
    310311
    311312    /**
  • cpukit/score/include/rtems/score/smpimpl.h

    r145becf r4d906bda  
    4242 * @see _SMP_Send_message().
    4343 */
    44 #define SMP_MESSAGE_SHUTDOWN UINT32_C(0x1)
     44#define SMP_MESSAGE_SHUTDOWN 0x1UL
    4545
    4646/**
     
    4949 * @see _SMP_Send_message().
    5050 */
    51 #define SMP_MESSAGE_TEST UINT32_C(0x2)
     51#define SMP_MESSAGE_TEST 0x2UL
    5252
    5353/**
     
    133133  Per_CPU_Control *cpu_self = _Per_CPU_Get();
    134134
    135   if ( cpu_self->message != 0 ) {
    136     uint32_t  message;
    137     ISR_Level level;
    138 
    139     _Per_CPU_ISR_disable_and_acquire( cpu_self, level );
    140     message = cpu_self->message;
    141     cpu_self->message = 0;
    142     _Per_CPU_Release_and_ISR_enable( cpu_self, level );
     135  if ( _Atomic_Load_ulong( &cpu_self->message, ATOMIC_ORDER_RELAXED ) != 0 ) {
     136    unsigned long message = _Atomic_Exchange_ulong(
     137      &cpu_self->message,
     138      0UL,
     139      ATOMIC_ORDER_RELAXED
     140    );
    143141
    144142    if ( ( message & SMP_MESSAGE_SHUTDOWN ) != 0 ) {
     
    161159 *  @param[in] message The message.
    162160 */
    163 void _SMP_Send_message( uint32_t cpu_index, uint32_t message );
     161void _SMP_Send_message( uint32_t cpu_index, unsigned long message );
    164162
    165163/**
  • cpukit/score/src/smp.c

    r145becf r4d906bda  
    141141}
    142142
    143 void _SMP_Send_message( uint32_t cpu_index, uint32_t message )
     143void _SMP_Send_message( uint32_t cpu_index, unsigned long message )
    144144{
    145145  Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
    146   ISR_Level level;
    147146
    148   _Per_CPU_ISR_disable_and_acquire( cpu, level );
    149   cpu->message |= message;
    150   _Per_CPU_Release_and_ISR_enable( cpu, level );
     147  _Atomic_Fetch_or_ulong( &cpu->message, message, ATOMIC_ORDER_RELAXED );
    151148
    152149  _CPU_SMP_Send_interrupt( cpu_index );
Note: See TracChangeset for help on using the changeset viewer.