Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Aug 2003 18:03:15 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Ted Unangst <tedu@stanford.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: possible deadlocks?
Message-ID:  <XFMail.20030811180315.jhb@FreeBSD.org>
In-Reply-To: <Pine.GSO.4.44.0308111434150.19330-100000@saga8.Stanford.EDU>

next in thread | previous in thread | raw e-mail | index | archive | help

On 11-Aug-2003 Ted Unangst wrote:
> one more.  This falls into the very improbable category.  Ordinarily, I
> don't think this is possible because FreeBSD doesn't support hotplug PCI,
> so sk attachment can't be raced.
> 
> However, assuming I had some hot plug sk card, it seems like running
> ifconfig sk0 at just the wrong point during sk1 attach will deadlock.  If
> it absolutely can not happen (for a reason other than sk is attached
> before init runs) please explain.
> 
> sk.c:
>   sk_attach_xmac()
>     SK_LOCK(sc); /* grabs */
>     ether_ifattach()
>       ifattach()
>         IFNET_WLOCK() /* waits for 2 */
> 
> in6_ifattach.c:
>   in6_nigroup_attach()
>     IFNET_RLOCK() /* grabs */
>     in6_addmulti()
>       if_addmulti()
>         sk_ioctl()
>         SK_IF_LOCK();  /* waits for 1 */

You can't ifconfig sk0 until after it attaches.  sk0 and sk1 don't
share locks, so you don't have to worry about the interaction there.
Also, SK_LOCK != SK_IF_LOCK, or is that a typo?  If it is a typo,
then the lock order should still be fixed in some fashion.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/



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