Subject: Re: Is there any way to tell if the current thread has a user context?
To: Matthew Orgass <darkstar@city-net.com>
From: Alan Ritter <ritter.alan@gmail.com>
List: tech-kern
Date: 09/06/2005 09:57:49
--nextPart2105075.QQjgO4mIcE
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hello,
> On 2005-08-31 rittera@cc.wwu.edu wrote:
> > if(curlwp !=3D NULL) {
> > lockmgr(&lock, LK_EXCLUSIVE, NULL);
> > }
>
> This is wrong. Locks need to be used everywhere you access the data
> structure being protected. Any data that will be accessed from an
> interrupt must be protected by a simple_lock. You also need to use
> splfoo() and a simple lock to avoid your wake before sleep problem (see
> the slock argument to ltsleep; the context switch will change the IPL
> then restore it for you so you can use the PNORELOCK flag and splx after
> the resume if you don't want the lock for anything else).
Right now I'm just focusing on getting a driver that is stable on a single=
=20
processor system (I want to get it tested and working on a multiprocessor=20
system eventually). Anyway I may be wrong, but I was thinking that=20
simplelock's only make a difference when there's more than one processor=20
that can run at a time.
Thanks :-)
--nextPart2105075.QQjgO4mIcE
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (NetBSD)
iD8DBQBDHWggdrBy3JhXjT8RAluZAJ9xxwXDfvIaEPaFnGyNGDG9ht+64gCeP5mL
RuKTafBHPGiHU42pljXw8iI=
=tYpJ
-----END PGP SIGNATURE-----
--nextPart2105075.QQjgO4mIcE--