summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-12-02 21:34:35 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-12-02 21:34:35 +0000
commitb4f6f8151cc1e732325230049205caf7cdb81ad7 (patch)
tree2ce1af54eb1667e8e7cf9167e1b535e9d4c7bb58 /sys/arch
parent41c5bbf797b3e036cd77f614ea848a2f3d2b3b44 (diff)
Do not take biglock for NOLOCK system calls.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/m88k/m88k/trap.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index edf0ca74bb0..2d1d4d225da 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.54 2007/12/02 21:33:56 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.55 2007/12/02 21:34:34 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -1134,14 +1134,13 @@ m88100_syscall(register_t code, struct trapframe *tf)
{
int i, nsys, nap;
struct sysent *callp;
- struct proc *p;
+ struct proc *p = curproc;
int error;
register_t args[8], rval[2], *ap;
+ int nolock;
uvmexp.syscalls++;
- p = curproc;
-
callp = p->p_emul->e_sysent;
nsys = p->p_emul->e_nsysent;
@@ -1190,13 +1189,22 @@ m88100_syscall(register_t code, struct trapframe *tf)
if (error != 0)
goto bad;
- KERNEL_PROC_LOCK(p);
#ifdef SYSCALL_DEBUG
+ KERNEL_PROC_LOCK(p);
scdebug_call(p, code, args);
+ KERNEL_PROC_UNLOCK(p);
#endif
+ nolock = (callp->sy_flags & SY_NOLOCK);
+ if (!nolock)
+ KERNEL_PROC_LOCK(p);
#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
+ if (KTRPOINT(p, KTR_SYSCALL)) {
+ if (nolock)
+ KERNEL_PROC_LOCK(p);
ktrsyscall(p, code, callp->sy_argsize, args);
+ if (nolock)
+ KERNEL_PROC_UNLOCK(p);
+ }
#endif
rval[0] = 0;
rval[1] = tf->tf_r[3];
@@ -1235,7 +1243,8 @@ m88100_syscall(register_t code, struct trapframe *tf)
* any pointers.
*/
- KERNEL_PROC_UNLOCK(p);
+ if (!nolock)
+ KERNEL_PROC_UNLOCK(p);
switch (error) {
case 0:
tf->tf_r[2] = rval[0];
@@ -1285,14 +1294,13 @@ m88110_syscall(register_t code, struct trapframe *tf)
{
int i, nsys, nap;
struct sysent *callp;
- struct proc *p;
+ struct proc *p = curproc;
int error;
register_t args[8], rval[2], *ap;
+ int nolock;
uvmexp.syscalls++;
- p = curproc;
-
callp = p->p_emul->e_sysent;
nsys = p->p_emul->e_nsysent;
@@ -1341,13 +1349,22 @@ m88110_syscall(register_t code, struct trapframe *tf)
if (error != 0)
goto bad;
- KERNEL_PROC_LOCK(p);
#ifdef SYSCALL_DEBUG
+ KERNEL_PROC_LOCK(p);
scdebug_call(p, code, args);
+ KERNEL_PROC_UNLOCK(p);
#endif
+ nolock = (callp->sy_flags & SY_NOLOCK);
+ if (!nolock)
+ KERNEL_PROC_LOCK(p);
#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
+ if (KTRPOINT(p, KTR_SYSCALL)) {
+ if (nolock)
+ KERNEL_PROC_LOCK(p);
ktrsyscall(p, code, callp->sy_argsize, args);
+ if (nolock)
+ KERNEL_PROC_UNLOCK(p);
+ }
#endif
rval[0] = 0;
rval[1] = tf->tf_r[3];
@@ -1382,7 +1399,8 @@ m88110_syscall(register_t code, struct trapframe *tf)
* exip += 4
*/
- KERNEL_PROC_UNLOCK(p);
+ if (!nolock)
+ KERNEL_PROC_UNLOCK(p);
switch (error) {
case 0:
tf->tf_r[2] = rval[0];
@@ -1787,15 +1805,12 @@ double_reg_fixup(struct trapframe *frame)
void
cache_flush(struct trapframe *tf)
{
- struct proc *p;
+ struct proc *p = curproc;
struct pmap *pmap;
paddr_t pa;
vaddr_t va;
vsize_t len, count;
- if ((p = curproc) == NULL)
- p = &proc0;
-
p->p_md.md_tf = tf;
pmap = vm_map_pmap(&p->p_vmspace->vm_map);