Bug 170606

Summary: r239222 kernel panic at boot - usb locking issue
Product: Base System Reporter: Kim Culhan <w8hdkim>
Component: usbAssignee: freebsd-usb (Nobody) <usb>
Status: Closed FIXED    
Severity: Affects Only Me CC: miwi
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Kim Culhan 2012-08-13 15:30:12 UTC
kernel panic at boot:

panic: Lock (sx) USB config SX lock not locked @
/usr/src/sys/dev/usb/usb/usb_device.c:2781

serial console not available atm, screen pics:

http://img827.imageshack.us/img827/3622/img0084vc.jpg

http://img705.imageshack.us/img705/9816/img0086dms.jpg

thanks
-kim

How-To-Repeat: Boot r239222 with usb enabled
Comment 1 dfilter service freebsd_committer freebsd_triage 2012-08-13 19:34:16 UTC
Author: hselasky
Date: Mon Aug 13 18:34:04 2012
New Revision: 239240
URL: http://svn.freebsd.org/changeset/base/239240

Log:
  Fix for missing locks due to recent change.
  
  PR:		usb/170606
  MFC after:	2 weeks

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Mon Aug 13 18:10:52 2012	(r239239)
+++ head/sys/dev/usb/usb_device.c	Mon Aug 13 18:34:04 2012	(r239240)
@@ -2777,8 +2777,15 @@ usbd_set_endpoint_mode(struct usb_device
     uint8_t ep_mode)
 {   
 	usb_error_t error;
+	uint8_t do_unlock;
 
-	sx_assert(&udev->enum_sx, SA_LOCKED);
+	/* automatic locking */
+	if (usbd_enum_is_locked(udev)) {
+		do_unlock = 0;
+	} else {
+		do_unlock = 1;
+		usbd_enum_lock(udev);
+	}
 
 	if (udev->bus->methods->set_endpoint_mode != NULL) {
 		error = (udev->bus->methods->set_endpoint_mode) (
@@ -2792,6 +2799,9 @@ usbd_set_endpoint_mode(struct usb_device
 	/* only set new mode regardless of error */
 	ep->ep_mode = ep_mode;
 
+	if (do_unlock)
+		usbd_enum_unlock(udev);
+
 	return (error);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 2 Martin Wilke freebsd_committer freebsd_triage 2015-12-25 05:06:55 UTC
It was fixed 3 years back.