From owner-freebsd-arch Mon Feb 18 19: 0:39 2002 Delivered-To: freebsd-arch@freebsd.org Received: from rwcrmhc54.attbi.com (rwcrmhc54.attbi.com [216.148.227.87]) by hub.freebsd.org (Postfix) with ESMTP id E178A37B402 for ; Mon, 18 Feb 2002 19:00:22 -0800 (PST) Received: from InterJet.elischer.org ([12.232.206.8]) by rwcrmhc54.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020219030022.SBIE1214.rwcrmhc54.attbi.com@InterJet.elischer.org>; Tue, 19 Feb 2002 03:00:22 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id SAA54513; Mon, 18 Feb 2002 18:50:55 -0800 (PST) Date: Mon, 18 Feb 2002 18:50:54 -0800 (PST) From: Julian Elischer To: Andrew Gallatin Cc: arch@FreeBSD.ORG Subject: Re: timing results for gettimeofday() (without any credential fixes) In-Reply-To: <15473.44699.351070.683358@grasshopper.cs.duke.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Oh Sh*t I just realised that the changes that we made to i386/i386/trap.c need to be duplicated into the other architectures. (DOH!) Here is the diff we made for i386: =================================================================== RCS file: /c/ncvs/src/sys/i386/i386/trap.c,v retrieving revision 1.211 retrieving revision 1.212 diff -u -p -r1.211 -r1.212 --- src/sys/i386/i386/trap.c 2002/01/10 11:49:54 1.211 +++ src/sys/i386/i386/trap.c 2002/02/17 01:09:54 1.212 @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $FreeBSD: /c/ncvs/src/sys/i386/i386/trap.c,v 1.211 2002/01/10 11:49:54 bde Exp $ + * $FreeBSD: /c/ncvs/src/sys/i386/i386/trap.c,v 1.212 2002/02/17 01:09:54 julian Exp $ */ /* @@ -256,9 +256,8 @@ trap(frame) sticks = td->td_kse->ke_sticks; td->td_frame = &frame; KASSERT(td->td_ucred == NULL, ("already have a ucred")); - PROC_LOCK(p); - td->td_ucred = crhold(p->p_ucred); - PROC_UNLOCK(p); + if (td->td_ucred != p->p_ucred) + cred_update_thread(td); switch (type) { case T_PRIVINFLT: /* privileged instruction fault */ @@ -644,10 +643,12 @@ user: userret(td, &frame, sticks); mtx_assert(&Giant, MA_NOTOWNED); userout: +#ifdef INVARIANTS mtx_lock(&Giant); crfree(td->td_ucred); mtx_unlock(&Giant); td->td_ucred = NULL; +#endif out: return; } @@ -954,9 +955,8 @@ syscall(frame) sticks = td->td_kse->ke_sticks; td->td_frame = &frame; KASSERT(td->td_ucred == NULL, ("already have a ucred")); - PROC_LOCK(p); - td->td_ucred = crhold(p->p_ucred); - PROC_UNLOCK(p); + if (td->td_ucred != p->p_ucred) + cred_update_thread(td); params = (caddr_t)frame.tf_esp + sizeof(int); code = frame.tf_eax; orig_tf_eflags = frame.tf_eflags; @@ -1099,10 +1099,12 @@ bad: */ STOPEVENT(p, S_SCX, code); +#ifdef INVARIANTS mtx_lock(&Giant); crfree(td->td_ucred); mtx_unlock(&Giant); td->td_ucred = NULL; +#endif #ifdef WITNESS if (witness_list(td)) { panic("system call %s returning with mutex(s) held\n", On Mon, 18 Feb 2002, Andrew Gallatin wrote: > > Julian Elischer writes: > > turn off invariants to get the fast path on syscalls > > Not on alpha. There's no #ifdef INVARIANTS around the crfree stuff > there. There probably should be. > > Anyway, on alpha a kernel w/INVARIANTS_SUPPORT but w/o INVARIANTS > crashes on boot in the first trap: > > <..> > Mounting root from ufs:/dev/da0a > da0 at isp0 bus 0 target 1 lun 0 > da0: Fixed Direct Access SCSI-2 device > da0: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged > Queueing Enabled > da0: 2007MB (4110480 512 byte sectors: 255H 63S/T 255C) > panic: already have a ucred > panic > Stopped at Debugger+0x34: zapnot v0,#0xf,a0 > db> tr > Debugger() at Debugger+0x34 > panic() at panic+0x100 > trap() at trap+0xa0 > XentMM() at XentMM+0x2c > --- memory management fault (from ipl 0) --- > --- user mode --- > db> show pcpu > cpuid = 0 > curthread = 0xfffffe0009a69820: pid 1 "init" > curpcb = 0x829e58 > fpcurthread = none > idlethread = 0xfffffe0009a692c0: pid 10 "idle" > ipis = 0x0 > next ASN = 3 > db> > > This may very well be the first trap the process takes. > > Drew > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message