Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Jan 2003 00:19:24 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        nate@root.org
Cc:        current@FreeBSD.ORG, net@FreeBSD.ORG
Subject:   Re: Proper -current if_attach locking?
Message-ID:  <20030107.001924.02080410.imp@bsdimp.com>
In-Reply-To: <Pine.BSF.4.21.0301031458210.99923-100000@root.org>
References:  <Pine.BSF.4.21.0301031458210.99923-100000@root.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <Pine.BSF.4.21.0301031458210.99923-100000@root.org>
            Nate Lawson <nate@root.org> writes:
: I was looking into some "could sleep messages" and found some bogus
: locking in the attach routine of many drivers.  Several init a mtx in
: their softc and then lock/unlock it in their attach routine.  This, of
: course, does nothing to provide exclusive access to a device.  I assume
: there is going to be a global IF_LOCK or something to be used in attach
: routines.  Can someone fill me in on the intended design?

The locking in the attach routines is generally bogus.  Locking is
only needed when you have more than one thread of execution.  You
don't have more than one thread of execution until after you establish
the ISR and turn on interrupts.  We should likely not be enabling
interrupts until very late in the attach routine so that we don't need
any locking in them.

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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