kern/94822: [patch] Fix keyboard hang for IBM / Intel blade servers

Devon H. O'Dell dodell at iXsystems.com
Wed Mar 22 06:50:16 UTC 2006


>Number:         94822
>Category:       kern
>Synopsis:       [patch] Fix keyboard hang for IBM / Intel blade servers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 22 06:50:09 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Devon H. O'Dell
>Release:        6.0-RELEASE-p3
>Organization:
iXsystems
>Environment:
>Description:
On Intel / IBM blade machines, there is no atkbd(4) device. Previously, booting GENERIC on these blades would hang the machine. With this patch, this behavior is no more!

Yes! After many printf()'s, reboots of the blade (and the MM because the new firmware is horribly broken), I've found the hang and fixed it. Simply put, there's a keyboard / auxillary device drain procedure (empty_both_buffers) that expects to drain the buffers, but can't, because the buffers aren't what they think.

This patch fixes the issue by adding a timeout to the empty_both_buffers procedure. After two seconds of not being able to drain the buffer, it will give up and return to the caller.

Full use of the keyboard (via the VNC-based Java KVM on the MM or local USB) is afforded, and the system boots.
>How-To-Repeat:
Obtain relevant machine (SBX82, in this case), chassis, and boot the GENERIC kernel. Order pizza. Play poker. Notice it's still hung. Take shower. Sleep. Wake up. Notice it's still hung. Apply patch and live happily ever after.
>Fix:
This patch is alternatively available at http://www.sitetronics.com/~dodell/atkbdc_fix.patch in case the whitespace is goofed up by the paste into the web form.

-- begin patch --
Index: atkbdc.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/atkbdc/atkbdc.c,v
retrieving revision 1.22
diff -u -r1.22 atkbdc.c
--- atkbdc.c	4 Dec 2005 02:12:40 -0000	1.22
+++ atkbdc.c	22 Mar 2006 06:29:01 -0000
@@ -835,6 +835,7 @@
 {
     int t;
     int f;
+    int waited = 0;
 #if KBDIO_DEBUG >= 2
     int c1 = 0;
     int c2 = 0;
@@ -855,6 +856,16 @@
 	} else {
 	    t -= delta;
 	}
+
+	/*
+	 * Some systems (Intel/IBM blades) do not have keyboard devices and
+	 * will thus hang in this procedure. Time out after delta seconds to
+	 * avoid this hang -- the keyboard attach will fail later on.
+	 */
+        waited += (delta * 1000);
+        if (waited == (delta * 1000000))
+	    return;
+
 	DELAY(delta*1000);
     }
 #if KBDIO_DEBUG >= 2
-- end patch --
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list