diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-03 16:16:08 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-04 07:55:26 +0200 |
commit | b30ab250f0967920d6c08eae776fb82e717da182 (patch) | |
tree | 9c89065c20a18f553192254e1c5d510246f5751f | |
parent | score: Simplify _Thread_Get_interrupt_disable() (diff) | |
download | rtems-b30ab250f0967920d6c08eae776fb82e717da182.tar.bz2 |
mpci: Avoid Giant lock in _MPCI_Process_response()
Update #2555.
Update #2703.
-rw-r--r-- | cpukit/score/src/mpci.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c index 20d5084cc5..57eb5f3991 100644 --- a/cpukit/score/src/mpci.c +++ b/cpukit/score/src/mpci.c @@ -290,24 +290,22 @@ Thread_Control *_MPCI_Process_response ( MP_packet_Prefix *the_packet ) { - Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _Thread_Get( the_packet->id, &location ); - switch ( location ) { - case OBJECTS_ERROR: -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: -#endif - the_thread = NULL; /* IMPOSSIBLE */ - break; - case OBJECTS_LOCAL: - _Thread_queue_Extract( the_thread ); - the_thread->Wait.return_code = the_packet->return_code; - _Objects_Put_without_thread_dispatch( &the_thread->Object ); - break; - } + ISR_lock_Context lock_context; + Thread_Control *the_thread; + the_thread = _Thread_Get_interrupt_disable( the_packet->id, &lock_context ); + _Assert( the_thread != NULL ); + + /* + * FIXME: This is broken on SMP, see https://devel.rtems.org/ticket/2703. + * + * Should use _Thread_queue_Extract_critical() instead with a handler + * function provided by the caller of _MPCI_Process_response(). Similar to + * the filter function in _Thread_queue_Flush_critical(). + */ + _ISR_lock_ISR_enable( &lock_context ); + _Thread_queue_Extract( the_thread ); + the_thread->Wait.return_code = the_packet->return_code; return the_thread; } |