diff options
-rw-r--r-- | src/kernel/ipc.C | 16 | ||||
-rw-r--r-- | src/kernel/syscall.C | 9 | ||||
-rw-r--r-- | src/lib/syscall_msg.C | 11 | ||||
-rw-r--r-- | src/usr/mbox/mailboxsp.C | 24 | ||||
-rw-r--r-- | src/usr/mbox/test/mboxsptest.H | 6 |
5 files changed, 44 insertions, 22 deletions
diff --git a/src/kernel/ipc.C b/src/kernel/ipc.C index 07f1f72f3..9f0eaa908 100644 --- a/src/kernel/ipc.C +++ b/src/kernel/ipc.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -25,12 +27,13 @@ #include <kernel/cpu.H> #include <kernel/intmsghandler.H> #include <kernel/console.H> +#include <errno.h> using namespace KernelIpc; namespace KernelIpc { - void send(uint64_t i_q, msg_t * i_msg); + int send(uint64_t i_q, msg_t * i_msg); }; /** @@ -43,7 +46,7 @@ KernelIpc::ipc_data_area_t KernelIpc::ipc_data_area; // Two potential issues: // 1. The destination node is not there - memory location is nonexistant. // 2. The destination node never responds, potentially hanging this thread. -void KernelIpc::send(uint64_t i_q, msg_t * i_msg) +int KernelIpc::send(uint64_t i_q, msg_t * i_msg) { // @note // Point to memory in the destination image. @@ -69,13 +72,12 @@ void KernelIpc::send(uint64_t i_q, msg_t * i_msg) reinterpret_cast<ipc_data_area_t*>(dest_addr); // get lock on IPC data area in other node - while(false == __sync_bool_compare_and_swap(&(p_dest->msg_queue_id), + if(false == __sync_bool_compare_and_swap(&(p_dest->msg_queue_id), IPC_DATA_AREA_CLEAR, IPC_DATA_AREA_LOCKED)) { - setThreadPriorityLow(); + return -EAGAIN; } - setThreadPriorityHigh(); p_dest->msg_payload = *i_msg; // copy in message lwsync(); @@ -94,6 +96,6 @@ void KernelIpc::send(uint64_t i_q, msg_t * i_msg) // code and freed here in kernel space. The assumption is that this is OK. msg_free(i_msg); - return; + return 0; } diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C index d54d85ae7..1b1bd7f57 100644 --- a/src/kernel/syscall.C +++ b/src/kernel/syscall.C @@ -43,10 +43,11 @@ #include <kernel/heapmgr.H> #include <kernel/intmsghandler.H> #include <sys/sync.h> +#include <errno.h> namespace KernelIpc { - void send(uint64_t i_q, msg_t * i_msg); + int send(uint64_t i_q, msg_t * i_msg); }; extern "C" @@ -315,11 +316,11 @@ namespace Systemcalls { uint64_t q_handle = TASK_GETARG0(t); msg_t* m = (msg_t*) TASK_GETARG1(t); + int rc = 0; if(((q_handle >> 32) & MSGQ_TYPE_IPC) != 0) { - // IPC message - KernelIpc::send(q_handle, m); + rc = KernelIpc::send(q_handle, m); } else { @@ -362,7 +363,7 @@ namespace Systemcalls mq->lock.unlock(); } - TASK_SETRTN(t, 0); + TASK_SETRTN(t, rc); } void MsgSendRecv(task_t* t) diff --git a/src/lib/syscall_msg.C b/src/lib/syscall_msg.C index 1f9478cc4..e5a63920f 100644 --- a/src/lib/syscall_msg.C +++ b/src/lib/syscall_msg.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2014 */ +/* Contributors Listed Below - COPYRIGHT 2010,2015 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -121,7 +123,12 @@ msg_t* msg_allocate() int msg_send(msg_q_t q, msg_t* msg) { - return (int64_t)_syscall2(MSG_SEND, q, msg); + int64_t rc = 0; + do + { + rc = (int64_t)_syscall2(MSG_SEND, q, msg); + } while( rc == -EAGAIN ); + return rc; } int msg_sendrecv(msg_q_t q, msg_t* msg) diff --git a/src/usr/mbox/mailboxsp.C b/src/usr/mbox/mailboxsp.C index ff3241d7d..3f01cfd65 100644 --- a/src/usr/mbox/mailboxsp.C +++ b/src/usr/mbox/mailboxsp.C @@ -44,6 +44,8 @@ #include <arch/ppc.H> #include <errl/errlmanager.H> #include <sys/misc.h> +#include <errl/errludprintk.H> +#include <errno.h> // Local functions namespace MBOX @@ -1893,7 +1895,8 @@ errlHndl_t MBOX::send(queue_id_t i_q_id, msg_t * i_msg,int i_node) // node means Hb instance number in this context INTR::PIR_t my_pir (KernelIpc::ipc_data_area.pir); - if(my_pir.nodeId == i_node) + if( (my_pir.nodeId == i_node) + && (MBOX::HB_TEST_MSGQ != i_q_id) ) //use IPC for tests { // Message is to this node - don't use IPC path // MBOX sp can look up msgQ @@ -1904,8 +1907,8 @@ errlHndl_t MBOX::send(queue_id_t i_q_id, msg_t * i_msg,int i_node) int rc = msg_send(reinterpret_cast<msg_q_t>(q_handle), i_msg); TRACFCOMP(g_trac_mboxmsg,INFO_MRK - "MBOXSP IPC SENT. This PIR 0x%x", - KernelIpc::ipc_data_area.pir); + "MBOXSP IPC SENT. This PIR 0x%x, rc=%d", + KernelIpc::ipc_data_area.pir, rc); if(rc) @@ -1915,22 +1918,27 @@ errlHndl_t MBOX::send(queue_id_t i_q_id, msg_t * i_msg,int i_node) * @moduleid MBOX::MOD_MBOX_SEND * @reasoncode MBOX::RC_INVALID_QUEUE * @userdata1 returncode from msg_send() + * @userdata2 q_handle * - * @devdesc Invalid message or message queue + * @devdesc Error sending IPC message + * @custdesc A problem occurred during the IPL + * of the system * */ err = new ERRORLOG::ErrlEntry ( ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity - MBOX::MOD_MBOX_SEND, // moduleid - MBOX::RC_INVALID_QUEUE, // reason Code - rc, // msg_send errno - q_handle, // msg queue id + MBOX::MOD_MBOX_SEND, // moduleid + MBOX::RC_INVALID_QUEUE, // reason Code + rc, // rc from msg_send + q_handle, // msg queue id true //Add HB Software Callout ); // This Trace has the msg err->collectTrace(MBOXMSG_TRACE_NAME); + + ERRORLOG::ErrlUserDetailsPrintk().addToLog(err); } } } diff --git a/src/usr/mbox/test/mboxsptest.H b/src/usr/mbox/test/mboxsptest.H index 765031f5c..e0058d8e6 100644 --- a/src/usr/mbox/test/mboxsptest.H +++ b/src/usr/mbox/test/mboxsptest.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -334,6 +336,7 @@ class MboxSPTest : public CxxTest::TestSuite */ void testIPC(void) { + TRACFCOMP(g_trac_mbox,"testIPC>"); errlHndl_t err = NULL; msg_t * msg = msg_allocate(); msg_t * tmsg = msg_allocate(); @@ -384,6 +387,7 @@ class MboxSPTest : public CxxTest::TestSuite msg_q_destroy(msgQ); msg_free(rmsg); msg_free(tmsg); + TRACFCOMP(g_trac_mbox,"<testIPC"); } }; |