PERFORCE change 167093 for review

Hans Petter Selasky hselasky at FreeBSD.org
Fri Aug 7 17:52:38 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=167093

Change 167093 by hselasky at hselasky_laptop001 on 2009/08/07 17:52:11

	
	USB CORE:
	  - fix recent newbus deadlock with regard to USB
	  - all parts of the USB stack except the Linux Compat
	    Layer, shall use the shared lock version of the newbus
	    lock!
	  - remove redundant locking in "if_upgt.c"

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/controller/usb_controller.c#29 edit
.. //depot/projects/usb/src/sys/dev/usb/net/usb_ethernet.c#10 edit
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_upgt.c#14 edit
.. //depot/projects/usb/src/sys/kern/subr_bus.c#25 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/controller/usb_controller.c#29 (text+ko) ====

@@ -265,9 +265,9 @@
 	USB_BUS_UNLOCK(bus);
 
 	/* detach children first */
-	newbus_xlock();
+	newbus_slock();
 	bus_generic_detach(dev);
-	newbus_xunlock();
+	newbus_sunlock();
 
 	/*
 	 * Free USB Root device, but not any sub-devices, hence they
@@ -406,10 +406,10 @@
 {
 	const char *pname = device_get_nameunit(dev);
 
-	newbus_xlock();
+	newbus_slock();
 	if (usb_devclass_ptr == NULL)
 		usb_devclass_ptr = devclass_find("usbus");
-	newbus_xunlock();
+	newbus_sunlock();
 
 	/* Initialise USB process messages */
 	bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore;

==== //depot/projects/usb/src/sys/dev/usb/net/usb_ethernet.c#10 (text+ko) ====

@@ -221,10 +221,10 @@
 
 	if (ue->ue_methods->ue_mii_upd != NULL && 
 	    ue->ue_methods->ue_mii_sts != NULL) {
-		newbus_xlock();
+		newbus_slock();
 		error = mii_phy_probe(ue->ue_dev, &ue->ue_miibus,
 		    ue_ifmedia_upd, ue->ue_methods->ue_mii_sts);
-		newbus_xunlock();
+		newbus_sunlock();
 		if (error) {
 			device_printf(ue->ue_dev, "MII without any PHY\n");
 			goto error;

==== //depot/projects/usb/src/sys/dev/usb/wlan/if_upgt.c#14 (text+ko) ====

@@ -465,7 +465,6 @@
 
 	switch (cmd) {
 	case SIOCSIFFLAGS:
-		newbus_xlock();
 		if (ifp->if_flags & IFF_UP) {
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 				if ((ifp->if_flags ^ sc->sc_if_flags) &
@@ -482,7 +481,6 @@
 		sc->sc_if_flags = ifp->if_flags;
 		if (startall)
 			ieee80211_start_all(ic);
-		newbus_xunlock();
 		break;
 	case SIOCGIFMEDIA:
 		error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd);

==== //depot/projects/usb/src/sys/kern/subr_bus.c#25 (text+ko) ====

@@ -1109,7 +1109,7 @@
 	int i;
 	int error;
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 	PDEBUG(("%s from devclass %s", driver->name, DEVCLANAME(busclass)));
 
 	if (!dc)
@@ -1808,7 +1808,7 @@
 	int error;
 	device_t grandchild;
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 	PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev)));
 
 	/* remove children first */
@@ -1907,7 +1907,7 @@
 	int result, pri = 0;
 	int hasclass = (child->devclass != NULL);
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 
 	dc = dev->devclass;
 	if (!dc)
@@ -2558,7 +2558,7 @@
 {
 	int error;
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 
 	if (dev->state >= DS_ALIVE && (dev->flags & DF_REBID) == 0)
 		return (-1);
@@ -2592,7 +2592,7 @@
 {
 	int error;
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 
 	error = device_probe(dev);
 	if (error == -1)
@@ -2626,7 +2626,7 @@
 {
 	int error;
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 
 	device_sysctl_init(dev);
 	if (!device_is_quiet(dev))
@@ -2669,7 +2669,7 @@
 {
 	int error;
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 
 	PDEBUG(("%s", DEVICENAME(dev)));
 	if (dev->state == DS_BUSY)
@@ -2713,7 +2713,7 @@
 device_quiesce(device_t dev)
 {
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 
 	PDEBUG(("%s", DEVICENAME(dev)));
 	if (dev->state == DS_BUSY)
@@ -3151,7 +3151,7 @@
 {
 	device_t child;
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 
 	TAILQ_FOREACH(child, &dev->children, link) {
 		device_probe_and_attach(child);
@@ -3173,7 +3173,7 @@
 	device_t child;
 	int error;
 
-	NBL_ASSERT(SA_XLOCKED);
+	NBL_ASSERT(SA_LOCKED);
 
 	if (dev->state != DS_ATTACHED)
 		return (EBUSY);


More information about the p4-projects mailing list