Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64/sparc64 Call 'proc_trampoline_mp' from 'pro...



details:   https://anonhg.NetBSD.org/src/rev/23e54d7de3c7
branches:  trunk
changeset: 555666:23e54d7de3c7
user:      cdi <cdi%NetBSD.org@localhost>
date:      Mon Nov 24 20:41:15 2003 +0000

description:
Call 'proc_trampoline_mp' from 'proc_trampoline' in a multiprocessor
configuration. Fix process locking. Approved by petrov@.

diffstat:

 sys/arch/sparc64/sparc64/locore.s |   9 ++++++++-
 sys/arch/sparc64/sparc64/trap.c   |  14 ++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diffs (80 lines):

diff -r 58c6396ebe01 -r 23e54d7de3c7 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Mon Nov 24 20:30:19 2003 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Mon Nov 24 20:41:15 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.182 2003/11/20 08:08:52 petrov Exp $      */
+/*     $NetBSD: locore.s,v 1.183 2003/11/24 20:41:15 cdi Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath
@@ -8184,6 +8184,13 @@
        Debugger()
 2:
 #endif
+
+#ifdef MULTIPROCESSOR
+       /* Finish setup in SMP environment: acquire locks etc. */
+       call _C_LABEL(proc_trampoline_mp)
+        nop
+#endif
+
        wrpr    %g0, 0, %pil            ! Reset interrupt level
        call    %l0                     ! re-use current frame
         mov    %l1, %o0
diff -r 58c6396ebe01 -r 23e54d7de3c7 sys/arch/sparc64/sparc64/trap.c
--- a/sys/arch/sparc64/sparc64/trap.c   Mon Nov 24 20:30:19 2003 +0000
+++ b/sys/arch/sparc64/sparc64/trap.c   Mon Nov 24 20:41:15 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.101 2003/11/09 16:41:53 martin Exp $ */
+/*     $NetBSD: trap.c,v 1.102 2003/11/24 20:41:16 cdi Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.101 2003/11/09 16:41:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.102 2003/11/24 20:41:16 cdi Exp $");
 
 #define NEW_FPSTATE
 
@@ -2151,8 +2151,15 @@
                       "unknown syscall");
        }
 #endif
+        /* Lock the kernel if the syscall isn't MP-safe. */
+       if ((callp->sy_flags & SYCALL_MPSAFE) == 0)
+               KERNEL_PROC_LOCK(l);
+
        error = (*callp->sy_call)(l, &args, rval);
 
+       if ((callp->sy_flags & SYCALL_MPSAFE) == 0)
+               KERNEL_PROC_UNLOCK(l);
+
        switch (error) {
        case 0:
                /* Note: fork() does not return here in the child */
@@ -2265,6 +2272,7 @@
        /*
         * Return values in the frame set by cpu_fork().
         */
+       KERNEL_PROC_UNLOCK(l);
        userret(l, l->l_md.md_tf->tf_pc, 0);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
@@ -2294,6 +2302,7 @@
 #endif
        pool_put(&lwp_uc_pool, uc);
 
+       KERNEL_PROC_UNLOCK(l);
        userret(l, 0, 0);
 }
 
@@ -2301,5 +2310,6 @@
 upcallret(struct lwp *l)
 {
 
+       KERNEL_PROC_UNLOCK(l);
        userret(l, 0, 0);
 }



Home | Main Index | Thread Index | Old Index