From owner-freebsd-smp  Sat Nov 25 12:35:28 2000
Delivered-To: freebsd-smp@freebsd.org
Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222])
	by hub.freebsd.org (Postfix) with ESMTP id 7C03037B4CF
	for <smp@FreeBSD.ORG>; Sat, 25 Nov 2000 12:35:25 -0800 (PST)
Received: from foo.osd.bsdi.com (root@foo.osd.bsdi.com [204.216.28.137])
	by pike.osd.bsdi.com (8.11.1/8.9.3) with ESMTP id eAPKZ8C83726;
	Sat, 25 Nov 2000 12:35:08 -0800 (PST)
	(envelope-from jhb@foo.osd.bsdi.com)
Received: (from jhb@localhost)
	by foo.osd.bsdi.com (8.11.1/8.11.0) id eAPKWGN34219;
	Sat, 25 Nov 2000 12:32:16 -0800 (PST)
	(envelope-from jhb)
Message-ID: <XFMail.001125123216.jhb@FreeBSD.org>
X-Mailer: XFMail 1.4.0 on FreeBSD
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
In-Reply-To: <20001125200754.CC0B8BA7A@io.yi.org>
Date: Sat, 25 Nov 2000 12:32:16 -0800 (PST)
Organization: BSD, Inc.
From: John Baldwin <jhb@FreeBSD.ORG>
To: Jake Burkholder <jburkhol@home.com>
Subject: Re: uidinfo patches, review please.
Cc: smp@FreeBSD.ORG, Alfred Perlstein <bright@wintelcom.net>
Sender: owner-freebsd-smp@FreeBSD.ORG
Precedence: bulk
X-Loop: FreeBSD.org


On 25-Nov-00 Jake Burkholder wrote:
>> 
>> On 25-Nov-00 Alfred Perlstein wrote:
>> > Protect the uidinfo structures.
>> > 
>> > My only concern is that I must now include sys/mutex.h in
>> > sys/resourcevar.h, I didn't notice any userland utils using
>> > this file, I'm going to try to do a buildworld.
>> > 
>> > A kernel with this patch boots and seems to run multiuser
>> > fine.
> 
> Looks ok to me.
> 
>> 
>> I'll try and test this on Monday.  Have you compiled a kernel with WITNESS
>> turned on?  You probably want to add an explicit lock order of:
>> 
>> "uidinfo hash", "uidinfo struct", NULL
>> 
>> to the order_list in the witness code to make sure those locks aren't gotten
>> out of order as well.  Looks ok to me though for the most part (see comments
> 
> Kernel boots with WITNESS enabled, I also added this to the order list;
> make buildworld is chugging away on my SMP box.

Cool.

>> > @@ -735,9 +744,13 @@
>> >                       printf("freeing uidinfo: uid = %d, proccnt = %ld\n",
>> >                           uip->ui_uid, uip->ui_proccnt);
>> >               LIST_REMOVE(uip, ui_hash);
>> > +             mtx_destroy(&uip->ui_mtx);
>> > +             mtx_exit(&uidhash_mtx, MTX_DEF);
>> 
>> You should mtx_exit(&uip->ui_mtx) before destroying it here.
> 
> This isn't strictly necessary, mtx_destroy handles destroying a
> held mutex.  I suppose it saves a locked bus op.

Well, I'd rather have it for correctness' sake.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.Baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


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