Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Mar 2013 22:11:20 -0500
From:      Eric van Gyzen <eric@vangyzen.net>
To:        stable@FreeBSD.org
Subject:   [patch] IPMI KCS can drop the lock while servicing a request
Message-ID:  <514E6ED8.9040305@vangyzen.net>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090905000705080902010300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

At work, we discovered that our application's IPMI thread would often 
use a lot of CPU time.  The KCS thread uses DELAY to wait for the BMC, 
so it can run without sleeping for a "long" time with a slow BMC.  It 
also holds the ipmi_softc.ipmi_lock during this time.  When using 
adaptive mutexes, an application thread that wants to operate on the 
ipmi_pending_requests list will also spin during this same time.

We see no reason that the KCS thread needs to hold the lock while 
servicing a request.  We've been running with the attached patch for a 
few months, with no ill effects.

Eric

--------------090905000705080902010300
Content-Type: text/x-patch;
 name="ipmi_kcs.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ipmi_kcs.c.patch"

diff --git a/sys/dev/ipmi/ipmi_kcs.c b/sys/dev/ipmi/ipmi_kcs.c
index 1ca3298..868570d 100644
--- a/sys/dev/ipmi/ipmi_kcs.c
+++ b/sys/dev/ipmi/ipmi_kcs.c
@@ -456,9 +456,11 @@ kcs_loop(void *arg)
 
 	IPMI_LOCK(sc);
 	while ((req = ipmi_dequeue_request(sc)) != NULL) {
+		IPMI_UNLOCK(sc);
 		ok = 0;
 		for (i = 0; i < 3 && !ok; i++)
 			ok = kcs_polled_request(sc, req);
+		IPMI_LOCK(sc);
 		if (ok)
 			req->ir_error = 0;
 		else

--------------090905000705080902010300--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?514E6ED8.9040305>