[Skiboot] [PATCH 2/2] ipmi: Fix locking for synchronous message sending

Alistair Popple alistair at popple.id.au
Thu Feb 19 15:37:37 AEDT 2015


Skiboot now doesn't run the running pollers while holding a lock to
avoid dead-locks. The current implementation of ipmi_queue_msg_sync()
does exactly that while it waits for the pollers to be called.

This patch fixes the problem by releasing the lock prior to calling
the pollers.

Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
 core/ipmi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/core/ipmi.c b/core/ipmi.c
index 39997f6..6c1179f 100644
--- a/core/ipmi.c
+++ b/core/ipmi.c
@@ -126,15 +126,13 @@ void ipmi_cmd_done(uint8_t cmd, uint8_t netfn, uint8_t cc, struct ipmi_msg *msg)
 void ipmi_queue_msg_sync(struct ipmi_msg *msg)
 {
 	lock(&sync_lock);
-
-	assert(!sync_msg);
+	while (sync_msg);
 	sync_msg = msg;
 	ipmi_queue_msg(msg);
+	unlock(&sync_lock);
 
-	while (sync_msg)
+	while (sync_msg == msg)
 		time_wait_ms(100);
-
-	unlock(&sync_lock);
 }
 
 static void ipmi_read_event_complete(struct ipmi_msg *msg)
-- 
1.8.3.2



More information about the Skiboot mailing list