diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-04-07 16:21:27 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-04-07 16:21:27 +0000 |
commit | d669f660c17e3b1e0bbc59863f00f3edd1e759dd (patch) | |
tree | c2cba2348d099ec48901077e837ec84afae72736 /sys/arch/sparc64 | |
parent | e5a4ed34b18b5fbcdd66badb15e34a94dd84f102 (diff) |
Don't grab the kernel biglock for syscalls marked SY_NOLOCK;
make the amd64 code a bit nicer and make the sparc64 match that.
tested by a few;
OK toby@, dlg@, kettenis@ (for the sparc64 part).
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/sparc64/trap.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c index ff81f1b4535..55fc52eb12b 100644 --- a/sys/arch/sparc64/sparc64/trap.c +++ b/sys/arch/sparc64/sparc64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.61 2008/03/26 22:07:23 kettenis Exp $ */ +/* $OpenBSD: trap.c,v 1.62 2008/04/07 16:21:26 thib Exp $ */ /* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */ /* @@ -1261,7 +1261,7 @@ syscall(tf, code, pc) int64_t *ap; const struct sysent *callp; struct proc *p; - int error = 0, new; + int error = 0, new, lock; register_t args[8]; register_t rval[2]; @@ -1282,6 +1282,8 @@ syscall(tf, code, pc) callp = p->p_emul->e_sysent; nsys = p->p_emul->e_nsysent; + lock = !(callp->sy_flags & SY_NOLOCK); + /* * The first six system call arguments are in the six %o registers. * Any arguments beyond that are in the `argument extension' area @@ -1352,20 +1354,27 @@ syscall(tf, code, pc) goto bad; } - KERNEL_PROC_LOCK(p); #ifdef SYSCALL_DEBUG + KERNEL_PROC_LOCK(p); scdebug_call(p, code, args); + KERNEL_PROC_UNLOCK(p); #endif rval[0] = 0; rval[1] = tf->tf_out[1]; #if NSYSTRACE > 0 - if (ISSET(p->p_flag, P_SYSTRACE)) + if (ISSET(p->p_flag, P_SYSTRACE)) { + KERNEL_PROC_LOCK(p); error = systrace_redirect(code, p, args, rval); - else + KERNEL_PROC_UNLOCK(p); + } else #endif + { + if (lock) + KERNEL_PROC_LOCK(p); error = (*callp->sy_call)(p, args, rval); - KERNEL_PROC_UNLOCK(p); - + if (lock) + KERNEL_PROC_UNLOCK(p); + } switch (error) { vaddr_t dest; case 0: |