[rtems commit] mpci: Avoid Giant lock in _MPCI_Process_response()
Sebastian Huber
sebh at rtems.org
Wed May 4 05:55:32 UTC 2016
Module: rtems
Branch: master
Commit: b30ab250f0967920d6c08eae776fb82e717da182
Changeset: http://git.rtems.org/rtems/commit/?id=b30ab250f0967920d6c08eae776fb82e717da182
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue May 3 16:16:08 2016 +0200
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 20d5084..57eb5f3 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;
}
More information about the vc
mailing list