Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Aug 2005 22:03:03 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        rwatson@FreeBSD.org
Cc:        bzeeb-lists@lists.zabbadoz.net, freebsd-current@FreeBSD.org, dandee@volny.cz
Subject:   Re: LOR route vr0
Message-ID:  <20050827.220303.130848154.imp@bsdimp.com>
In-Reply-To: <20050828025721.X43518@fledge.watson.org>
References:  <20050827184153.A24510@fledge.watson.org> <20050827.124941.14976142.imp@bsdimp.com> <20050828025721.X43518@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20050828025721.X43518@fledge.watson.org>
            Robert Watson <rwatson@FreeBSD.org> writes:
: 
: On Sat, 27 Aug 2005, M. Warner Losh wrote:
: 
: > : You need to add an entry to subr_witness.c creating a graph edge between
: > : the softc lock and the routing lock.  An example of an entry in
: > : subr_witness.c:
: > :
: > :          /*
: > :           * TCP/IP
: > :           */
: > :          { "tcp", &lock_class_mtx_sleep },
: > :          { "tcpinp", &lock_class_mtx_sleep },
: > :          { "so_snd", &lock_class_mtx_sleep },
: > :          { NULL, NULL },
: > :
: > : Note that sets of ordered entries are terminated with a double-null.  This
: > : declares that locks of type "tcp" preceed "tcpinp" which preceed
: > : "so_snd".
: >
: > So you have to have locks of type tcp BEFORE you take out tcpinp type 
: > locks?
: 
: Correct.  'tcp' reflects the global TCP state tables (pcbinfo) locks, and 
: 'tcpinp' is for individual PCBs.  If you acquire first a tcpinp and then 
: tcp, the above settings should cause WITNESS to generate a lock order 
: warning.  Likewise, both tcp and tcpinp preceed so_snd, so if you acquire 
: a protocol lock after a socket lock, it will get unhappy.  WITNESS handles 
: transitive relationships, so it gets connected up to the rest of the lock 
: graph, explicit and implicit, so indirect violations of orders are fully 
: handled.

OK.  I've been seeing similar LORs in ed, sn, iwi (ed is my locked
version of ed, not in tree GIANT locked ed).

I've made the following changes, and the LORs go away (except for
one, which was unrelated).  I further don't get the first place where
they locks happen that caused the original LORs, so I'm mightly
confused.

==== //depot/user/imp/newcard/kern/subr_witness.c#62 - /dell/imp/p4/newcard/src/sys/kern/subr_witness.c ====
@@ -273,6 +273,13 @@
 	{ "allprison", &lock_class_mtx_sleep },
 	{ NULL, NULL },
 	/*
+	 * Network driver locking order
+	 */
+	{ "rawinp", &lock_class_mtx_sleep },
+	{ MTX_NETWORK_LOCK, &lock_class_mtx_sleep },
+	{ "if_addr_mtx", &lock_class_mtx_sleep },
+	{ NULL, NULL },
+	/*
 	 * Sockets
 	 */
 	{ "filedesc structure", &lock_class_mtx_sleep },
@@ -309,6 +316,7 @@
 	{ "udp", &lock_class_mtx_sleep },
 	{ "udpinp", &lock_class_mtx_sleep },
 	{ "so_snd", &lock_class_mtx_sleep },
+	{ MTX_NETWORK_LOCK, &lock_class_mtx_sleep },
 	{ NULL, NULL },
 	/*
 	 * TCP/IP
@@ -316,6 +324,7 @@
 	{ "tcp", &lock_class_mtx_sleep },
 	{ "tcpinp", &lock_class_mtx_sleep },
 	{ "so_snd", &lock_class_mtx_sleep },
+	{ MTX_NETWORK_LOCK, &lock_class_mtx_sleep },
 	{ NULL, NULL },
 	/*
 	 * SLIP

I'm not sure if I need to add the if_addr_mtx after each thing or
not.

Clearly I've done something wrong :-(.  I just don't see what.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050827.220303.130848154.imp>