Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Feb 2002 18:50:54 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        arch@FreeBSD.ORG
Subject:   Re: timing results for gettimeofday() (without any credential fixes)
Message-ID:  <Pine.BSF.4.21.0202181846070.53728-100000@InterJet.elischer.org>
In-Reply-To: <15473.44699.351070.683358@grasshopper.cs.duke.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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: <DEC RZ1BA-BS (C) DEC 3001> 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 <v0=0x0,a0=0x6>
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0202181846070.53728-100000>