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
[-- Attachment #1 --]
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
[-- Attachment #2 --]
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?514E6ED8.9040305>
