summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/signalmp.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-04 10:09:45 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-06 08:17:04 +0200
commitbb2ad039a7246eecde65592a5116c86d3dede34b (patch)
treeaee3f4b3200d35f7dfc4968bc4a04c5fcac5b262 /cpukit/rtems/src/signalmp.c
parentmpci: Avoid Giant lock in _MPCI_Process_response() (diff)
downloadrtems-bb2ad039a7246eecde65592a5116c86d3dede34b.tar.bz2
rtems: Avoid Giant lock for signals
Update #2555.
Diffstat (limited to 'cpukit/rtems/src/signalmp.c')
-rw-r--r--cpukit/rtems/src/signalmp.c79
1 files changed, 45 insertions, 34 deletions
diff --git a/cpukit/rtems/src/signalmp.c b/cpukit/rtems/src/signalmp.c
index 8c63c2f790..cd89e9f0dd 100644
--- a/cpukit/rtems/src/signalmp.c
+++ b/cpukit/rtems/src/signalmp.c
@@ -24,13 +24,36 @@
#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
+/**
+ * The following enumerated type defines the list of
+ * remote signal operations.
+ */
+typedef enum {
+ SIGNAL_MP_SEND_REQUEST = 0,
+ SIGNAL_MP_SEND_RESPONSE = 1
+} Signal_MP_Remote_operations;
+
+/**
+ * The following data structure defines the packet used to perform
+ * remote signal operations.
+ */
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Signal_MP_Remote_operations operation;
+ rtems_signal_set signal_set;
+} Signal_MP_Packet;
+
RTEMS_STATIC_ASSERT(
sizeof(Signal_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
Signal_MP_Packet
);
-static Signal_MP_Packet *_Signal_MP_Get_packet( void )
+static Signal_MP_Packet *_Signal_MP_Get_packet( Objects_Id id )
{
+ if ( !_Thread_MP_Is_remote( id ) ) {
+ return NULL;
+ }
+
return (Signal_MP_Packet *) _MPCI_Get_packet();
}
@@ -42,43 +65,31 @@ static Signal_MP_Packet *_Signal_MP_Get_packet( void )
*
*/
-rtems_status_code _Signal_MP_Send_request_packet (
- Signal_MP_Remote_operations operation,
- Objects_Id task_id,
- rtems_signal_set signal_in
+rtems_status_code _Signal_MP_Send(
+ rtems_id id,
+ rtems_signal_set signal_set
)
{
Signal_MP_Packet *the_packet;
- switch ( operation ) {
-
- case SIGNAL_MP_SEND_REQUEST:
-
- the_packet = _Signal_MP_Get_packet();
- the_packet->Prefix.the_class = MP_PACKET_SIGNAL;
- the_packet->Prefix.length = sizeof ( Signal_MP_Packet );
- the_packet->Prefix.to_convert = sizeof ( Signal_MP_Packet );
- the_packet->operation = operation;
- the_packet->Prefix.id = task_id;
- the_packet->signal_in = signal_in;
-
- return _MPCI_Send_request_packet(
- _Objects_Get_node( task_id ),
- &the_packet->Prefix,
- STATES_READY, /* Not used */
- RTEMS_TIMEOUT
- );
- break;
-
- case SIGNAL_MP_SEND_RESPONSE:
- break;
-
+ the_packet = _Signal_MP_Get_packet( id );
+ if ( the_packet == NULL ) {
+ return RTEMS_INVALID_ID;
}
- /*
- * The following line is included to satisfy compilers which
- * produce warnings when a function does not end with a return.
- */
- return RTEMS_INTERNAL_ERROR;
+
+ the_packet->Prefix.the_class = MP_PACKET_SIGNAL;
+ the_packet->Prefix.length = sizeof( *the_packet );
+ the_packet->Prefix.to_convert = sizeof( *the_packet );
+ the_packet->operation = SIGNAL_MP_SEND_REQUEST;
+ the_packet->Prefix.id = id;
+ the_packet->signal_set = signal_set;
+
+ return (rtems_status_code) _MPCI_Send_request_packet(
+ _Objects_Get_node( id ),
+ &the_packet->Prefix,
+ STATES_READY,
+ RTEMS_TIMEOUT
+ );
}
static void _Signal_MP_Send_response_packet (
@@ -127,7 +138,7 @@ void _Signal_MP_Process_packet (
the_packet->Prefix.return_code = rtems_signal_send(
the_packet->Prefix.id,
- the_packet->signal_in
+ the_packet->signal_set
);
_Signal_MP_Send_response_packet(