From 131fe4ebed0dfd679c30c7f13a218628f1b97d1f Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Wed, 13 May 2015 14:48:35 -0500 Subject: Avoid deadlock in cross-node IPC messaging Move poll for empty queue out of kernel space to allow for the primary thread to see new interrupts and clear out incoming messages. This will prevent 2 nodes from deadlocking one another while they wait for each other to handle the last message that was sent to them. Change-Id: Icbe4e0f621661a37c704b4ac4cdf111664b2039d CQ: SW298667 Backport: release-fips820 Backport: release-fips830 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17788 Reviewed-by: Brian H. Horton Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/lib/syscall_msg.C | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/lib') 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) -- cgit v1.2.3