Subject: Re: locking out device attach/detach?
To: Iain Hibbert <firstname.lastname@example.org>
From: Bill Studenmund <email@example.com>
Date: 12/06/2005 12:17:15
Content-Type: text/plain; charset=us-ascii
On Mon, Dec 05, 2005 at 10:06:10PM +0000, Iain Hibbert wrote:
> How should I lock out device attach/detach routines while for example
> walking a device list that I've added to in said routines in order to
> protect against the list being modified while I use it? (only short scans)
Today, you don't have to. We still have one kernel biglock, so your access=
will be single-threaded.
The right way will be some form of spinlock.
> looking at the master ifnet list in net/if.c for instance:
> ifunit() uses TAILQ_FIRST/TAILQ_NEXT with no protection (?)
> if_attach() uses TAILQ_INSERT_LAST with no protection
> if_detach() uses TAILQ_REMOVE inside splnet()
> when device attach/detach functions are called, how are they triggered and
> at what priority is the call? (is pcmcia different to usb?)
> I'm not using the ifnet code any more (I think bluetooth device is not
> exactly an interface), but am doing much the same thing with another list
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----