From b30ab250f0967920d6c08eae776fb82e717da182 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 3 May 2016 16:16:08 +0200 Subject: mpci: Avoid Giant lock in _MPCI_Process_response() Update #2555. Update #2703. --- cpukit/score/src/mpci.c | 32 +++++++++++++++----------------- 1 file 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; } -- cgit v1.2.3