kern/85648: [patch] provide more specific default network driver queue mutex name

Ben Thomas bthomas at virtualiron.com
Fri Sep 2 18:00:34 GMT 2005


>Number:         85648
>Category:       kern
>Synopsis:       [patch] provide more specific default network driver queue mutex name
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 02 18:00:33 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Ben Thomas
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
Virtual Iron Software
>Environment:
System: FreeBSD bthomas4.katana-technology.com 5.4-RELEASE FreeBSD 5.4-RELEASE #10: Sun Aug 28 13:48:00 EDT 2005 ben at bthomas4.katana-technology.com:/usr/obj/usr/home/ben/BSD/RELENG_5_4_0_RELEASE/src/sys/BEN i386


>Description:

This change modifies the default name given to a network driver queue mutex.
The new name contains the device name, which makes for easier debugging
and tracking.  While tracking down mutexes and debugging, it made
work a little easier to have more specific names on mutexes.

This patch is against the 5_4_0_RELEASE code


>How-To-Repeat:
>Fix:

--- if.c-DIFF begins here ---
--- /usr/src.original/sys/net/if.c	Thu Apr 14 21:52:03 2005
+++ /usr/src/sys/net/if.c	Fri Aug  5 17:31:35 2005
@@ -291,6 +291,7 @@
 {
 	struct ifnet *ifp;
 	int s;
+	char	name[IFNAMSIZ + sizeof(" ifq_mtx") + 1];
 
 	s = splimp();
 	IFNET_RLOCK();	/* could sleep on rare error; mostly okay XXX */
@@ -300,9 +301,10 @@
 			ifp->if_snd.ifq_maxlen = ifqmaxlen;
 		}
 		if (!mtx_initialized(&ifp->if_snd.ifq_mtx)) {
+			snprintf(name, sizeof(name), "%s ifq_mtx", ifp->if_xname);
 			if_printf(ifp,
-			    "XXX: driver didn't initialize queue mtx\n");
-			mtx_init(&ifp->if_snd.ifq_mtx, "unknown",
+			    "XXX: Initializing driver queue mtx to '%s'\n", name);
+			mtx_init(&ifp->if_snd.ifq_mtx, name,
 			    MTX_NETWORK_LOCK, MTX_DEF);
 		}
 	}
--- if.c-DIFF ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list