summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-02-19 11:21:34 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-06 09:43:58 +0100
commitba25cc208c5c83453a57cc42e402c55ac3ffe019 (patch)
tree65fb290fb28342134eb6ab860cfe4b07fa2261ed /cpukit
parentscore: SMP initialization and shutdown changes (diff)
downloadrtems-ba25cc208c5c83453a57cc42e402c55ac3ffe019.tar.bz2
score: Add and use _Giant_Drop()
New test smptests/smpfatal03.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/score/include/rtems/score/threaddispatch.h12
-rw-r--r--cpukit/score/src/smp.c8
-rw-r--r--cpukit/score/src/threaddispatchdisablelevel.c13
3 files changed, 33 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/threaddispatch.h b/cpukit/score/include/rtems/score/threaddispatch.h
index 2211662696..cf9b801af8 100644
--- a/cpukit/score/include/rtems/score/threaddispatch.h
+++ b/cpukit/score/include/rtems/score/threaddispatch.h
@@ -109,6 +109,18 @@ RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
void _Giant_Release( void );
/**
+ * @brief Releases the giant lock completely if held by the executing processor.
+ *
+ * The thread dispatch disable level is not altered by this function.
+ *
+ * The only use case for this operation is in
+ * _SMP_Request_shutdown().
+ *
+ * @param[in] self_cpu The current processor index.
+ */
+ void _Giant_Drop( uint32_t self_cpu );
+
+ /**
* @brief Sets thread dispatch level to the value passed in.
*
* This routine sets thread dispatch level to the
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 0f632236b7..e56073d281 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -73,6 +73,14 @@ void _SMP_Request_shutdown( void )
Per_CPU_Control *self_cpu = _Per_CPU_Get_by_index( self );
_Per_CPU_State_change( self_cpu, PER_CPU_STATE_SHUTDOWN );
+
+ /*
+ * We have to drop the Giant lock here in order to give other processors the
+ * opportunity to receive the inter-processor interrupts issued previously.
+ * In case the executing thread still holds SMP locks, then other processors
+ * already waiting for this SMP lock will spin forever.
+ */
+ _Giant_Drop( self );
}
void _SMP_Send_message( uint32_t cpu, uint32_t message )
diff --git a/cpukit/score/src/threaddispatchdisablelevel.c b/cpukit/score/src/threaddispatchdisablelevel.c
index a3dec9998c..ec5ac813d5 100644
--- a/cpukit/score/src/threaddispatchdisablelevel.c
+++ b/cpukit/score/src/threaddispatchdisablelevel.c
@@ -57,6 +57,19 @@ static void _Giant_Do_release( void )
}
}
+void _Giant_Drop( uint32_t self_cpu )
+{
+ Giant_Control *giant = &_Giant;
+
+ _Assert( _ISR_Get_level() != 0 );
+
+ if ( giant->owner_cpu == self_cpu ) {
+ giant->nest_level = 0;
+ giant->owner_cpu = NO_OWNER_CPU;
+ _SMP_lock_Release( &giant->lock );
+ }
+}
+
uint32_t _Thread_Dispatch_increment_disable_level( void )
{
ISR_Level isr_level;