From a7ce0cec5d3ca0af46d308c14ccd32d81ce11f11 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 13 Jun 2013 10:34:12 +0200 Subject: 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. --- cpukit/score/include/rtems/score/smp.h | 7 ---- cpukit/score/src/smp.c | 60 ++++++++++++++++------------------ 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/cpukit/score/include/rtems/score/smp.h b/cpukit/score/include/rtems/score/smp.h index ea073ac24b..a01515673f 100644 --- a/cpukit/score/include/rtems/score/smp.h +++ b/cpukit/score/include/rtems/score/smp.h @@ -34,13 +34,6 @@ extern "C" { * @{ */ -/** - * This defines the bit which indicates the interprocessor interrupt - * has been requested so that RTEMS will reschedule on this CPU - * because the currently executing thread needs to be switched out. - */ -#define RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY 0x01 - /** * This defines the bit which indicates the interprocessor interrupt * has been requested so that RTEMS will reschedule on this CPU diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index 3081062f87..fce927541b 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -69,43 +69,41 @@ void rtems_smp_process_interrupt( void ) { int self = bsp_smp_processor_id(); Per_CPU_Control *per_cpu = &_Per_CPU_Information[ self ]; - uint32_t message; - ISR_Level level; - _Per_CPU_Lock_acquire( per_cpu, level ); - message = per_cpu->message; - per_cpu->message = 0; - _Per_CPU_Lock_release( per_cpu, level ); - - #if defined(RTEMS_DEBUG) - { - void *sp = __builtin_frame_address(0); - if ( !(message & RTEMS_BSP_SMP_SHUTDOWN) ) { - printk( "ISR on CPU %d -- (0x%02x) (0x%p)\n", self, message, sp ); - if ( message & RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY ) - printk( "context switch necessary\n" ); - if ( message & RTEMS_BSP_SMP_SIGNAL_TO_SELF ) - printk( "signal to self\n" ); - if ( message & RTEMS_BSP_SMP_SHUTDOWN ) - printk( "shutdown\n" ); + if ( per_cpu->message != 0 ) { + uint32_t message; + ISR_Level level; + + _Per_CPU_Lock_acquire( per_cpu, level ); + message = per_cpu->message; + per_cpu->message = 0; + _Per_CPU_Lock_release( per_cpu, level ); + + #if defined(RTEMS_DEBUG) + { + void *sp = __builtin_frame_address(0); + if ( !(message & RTEMS_BSP_SMP_SHUTDOWN) ) { + printk( "ISR on CPU %d -- (0x%02x) (0x%p)\n", self, message, sp ); + if ( message & RTEMS_BSP_SMP_SIGNAL_TO_SELF ) + printk( "signal to self\n" ); + if ( message & RTEMS_BSP_SMP_SHUTDOWN ) + printk( "shutdown\n" ); + } + printk( "Dispatch level %d\n", _Thread_Dispatch_get_disable_level() ); } - - printk( "Dispatch level %d\n", _Thread_Dispatch_get_disable_level() ); - } - #endif + #endif - if ( message & RTEMS_BSP_SMP_SHUTDOWN ) { - _ISR_Disable_on_this_core( level ); + if ( ( message & RTEMS_BSP_SMP_SHUTDOWN ) != 0 ) { + _ISR_Disable_on_this_core( level ); - while ( _Thread_Dispatch_decrement_disable_level() != 0 ) { - /* Release completely */ - } + _Thread_Dispatch_set_disable_level( 0 ); - _Per_CPU_Change_state( per_cpu, PER_CPU_STATE_SHUTDOWN ); + _Per_CPU_Change_state( per_cpu, PER_CPU_STATE_SHUTDOWN ); - _CPU_Fatal_halt( self ); - /* does not continue past here */ + _CPU_Fatal_halt( self ); + /* does not continue past here */ + } } } @@ -179,7 +177,7 @@ void _SMP_Request_other_cores_to_dispatch( void ) && per_cpu->state == PER_CPU_STATE_UP && per_cpu->dispatch_necessary ) { - _SMP_Send_message( cpu, RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY ); + _SMP_Send_message( cpu, 0 ); } } } -- cgit v1.2.3