Remove unneeded playing about with kernel_lock.

This commit is contained in:
ad 2008-05-21 14:07:29 +00:00
parent 48dad50527
commit 1e62ed170b
8 changed files with 22 additions and 68 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.c,v 1.50 2008/04/24 18:39:20 ad Exp $ */
/* $NetBSD: netbsd32_machdep.c,v 1.51 2008/05/21 14:10:28 ad Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.50 2008/04/24 18:39:20 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.51 2008/05/21 14:10:28 ad Exp $");
#include "opt_compat_netbsd.h"
#include "opt_coredump.h"
@ -922,8 +922,6 @@ startlwp32(void *arg)
err = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
pool_put(&lwp_uc_pool, uc);
KERNEL_UNLOCK_LAST(l);
userret(l);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: undefined.c,v 1.33 2008/04/27 18:58:43 matt Exp $ */
/* $NetBSD: undefined.c,v 1.34 2008/05/21 14:12:06 ad Exp $ */
/*
* Copyright (c) 2001 Ben Harris.
@ -54,7 +54,7 @@
#include <sys/kgdb.h>
#endif
__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.33 2008/04/27 18:58:43 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.34 2008/05/21 14:12:06 ad Exp $");
#include <sys/malloc.h>
#include <sys/queue.h>
@ -150,9 +150,7 @@ gdb_trapper(u_int addr, u_int insn, struct trapframe *frame, int code)
ksi.ksi_code = TRAP_BRKPT;
ksi.ksi_addr = (u_int32_t *)addr;
ksi.ksi_trap = 0;
KERNEL_LOCK(1, l);
trapsignal(l, &ksi);
KERNEL_UNLOCK_LAST(l);
return 0;
}
#ifdef KGDB
@ -258,9 +256,7 @@ undefinedinstruction(trapframe_t *frame)
ksi.ksi_signo = SIGILL;
ksi.ksi_code = ILL_ILLOPC;
ksi.ksi_addr = (u_int32_t *)(intptr_t) fault_pc;
KERNEL_LOCK(1, l);
trapsignal(l, &ksi);
KERNEL_UNLOCK_LAST(l);
userret(l);
return;
}
@ -359,9 +355,7 @@ undefinedinstruction(trapframe_t *frame)
ksi.ksi_code = ILL_ILLOPC;
ksi.ksi_addr = (u_int32_t *)fault_pc;
ksi.ksi_trap = fault_instruction;
KERNEL_LOCK(1, l);
trapsignal(l, &ksi);
KERNEL_UNLOCK_LAST(l);
}
if ((fault_code & FAULT_USER) == 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: fault.c,v 1.67 2008/04/27 18:58:44 matt Exp $ */
/* $NetBSD: fault.c,v 1.68 2008/05/21 14:10:28 ad Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@ -81,7 +81,7 @@
#include "opt_kgdb.h"
#include <sys/types.h>
__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.67 2008/04/27 18:58:44 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.68 2008/05/21 14:10:28 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -174,9 +174,7 @@ static inline void
call_trapsignal(struct lwp *l, ksiginfo_t *ksi)
{
KERNEL_LOCK(1, l);
TRAPSIGNAL(l, ksi);
KERNEL_UNLOCK_LAST(l);
}
static inline int

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.125 2008/02/05 18:52:56 garbled Exp $ */
/* $NetBSD: trap.c,v 1.126 2008/05/21 14:07:29 ad Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.125 2008/02/05 18:52:56 garbled Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.126 2008/05/21 14:07:29 ad Exp $");
#include "opt_altivec.h"
#include "opt_ddb.h"
@ -128,7 +128,6 @@ trap(struct trapframe *frame)
va &= ADDR_PIDX | ADDR_POFF;
va |= pcb->pcb_umapsr << ADDR_SR_SHFT;
map = &p->p_vmspace->vm_map;
/* KERNEL_LOCK(1, l); */
#ifdef PPC_OEA64
if ((frame->dsisr & DSISR_NOTFOUND) &&
vm_map_pmap(map)->pm_ste_evictions > 0 &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: exception.c,v 1.47 2008/05/20 20:43:30 uwe Exp $ */
/* $NetBSD: exception.c,v 1.48 2008/05/21 14:07:29 ad Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.47 2008/05/20 20:43:30 uwe Exp $");
__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.48 2008/05/21 14:07:29 ad Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -218,9 +218,7 @@ general_exception(struct lwp *l, struct trapframe *tf, uint32_t va)
trapsignal:
ksi.ksi_trap = tf->tf_expevt;
KERNEL_LOCK(l, 1);
trapsignal(l, &ksi);
KERNEL_UNLOCK_LAST(l);
userret(l);
return;
@ -404,9 +402,7 @@ tlb_exception(struct lwp *l, struct trapframe *tf, uint32_t va)
user_fault:
ksi.ksi_trap = tf->tf_expevt;
KERNEL_LOCK(l, 1);
trapsignal(l, &ksi);
KERNEL_UNLOCK_LAST(l);
userret(l);
ast(l, tf);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: memreg.c,v 1.40 2007/02/09 21:55:12 ad Exp $ */
/* $NetBSD: memreg.c,v 1.41 2008/05/21 14:10:28 ad Exp $ */
/*
* Copyright (c) 1992, 1993
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: memreg.c,v 1.40 2007/02/09 21:55:12 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: memreg.c,v 1.41 2008/05/21 14:10:28 ad Exp $");
#include "opt_sparc_arch.h"
@ -253,10 +253,7 @@ hypersparc_memerr(unsigned type, u_int sfsr, u_int sfva, struct trapframe *tf)
u_int afsr;
u_int afva;
if ((tf->tf_psr & PSR_PS) == 0)
KERNEL_LOCK(1, curlwp);
else
KERNEL_LOCK(1, NULL);
KERNEL_LOCK(1, NULL);
(*cpuinfo.get_asyncflt)(&afsr, &afva);
if ((afsr & AFSR_AFO) != 0) { /* HS async fault! */
@ -272,10 +269,7 @@ hypersparc_memerr(unsigned type, u_int sfsr, u_int sfva, struct trapframe *tf)
addroldtop = afsr & AFSR_AFA;
}
out:
if ((tf->tf_psr & PSR_PS) == 0)
KERNEL_UNLOCK_LAST(curlwp);
else
KERNEL_UNLOCK_ONE(NULL);
KERNEL_UNLOCK_ONE(NULL);
return;
hard:
@ -289,10 +283,7 @@ viking_memerr(unsigned type, u_int sfsr, u_int sfva, struct trapframe *tf)
u_int afsr=0; /* No Async fault registers on the viking */
u_int afva=0;
if ((tf->tf_psr & PSR_PS) == 0)
KERNEL_LOCK(1, curlwp);
else
KERNEL_LOCK(1, NULL);
KERNEL_LOCK(1, NULL);
if (type == T_STOREBUFFAULT) {
@ -327,10 +318,7 @@ viking_memerr(unsigned type, u_int sfsr, u_int sfva, struct trapframe *tf)
}
out:
if ((tf->tf_psr & PSR_PS) == 0)
KERNEL_UNLOCK_LAST(curlwp);
else
KERNEL_UNLOCK_ONE(NULL);
KERNEL_UNLOCK_ONE(NULL);
return;
hard:
@ -344,10 +332,7 @@ memerr4m(unsigned type, u_int sfsr, u_int sfva, struct trapframe *tf)
u_int afsr;
u_int afva;
if ((tf->tf_psr & PSR_PS) == 0)
KERNEL_LOCK(1, curlwp);
else
KERNEL_LOCK(1, NULL);
KERNEL_LOCK(1, NULL);
/*
* No known special cases.
@ -357,9 +342,6 @@ memerr4m(unsigned type, u_int sfsr, u_int sfva, struct trapframe *tf)
afsr = afva = 0;
hardmemerr4m(type, sfsr, sfva, afsr, afva);
if ((tf->tf_psr & PSR_PS) == 0)
KERNEL_UNLOCK_LAST(curlwp);
else
KERNEL_UNLOCK_ONE(NULL);
KERNEL_UNLOCK_ONE(NULL);
}
#endif /* SUN4M */

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.c,v 1.79 2008/04/24 18:39:21 ad Exp $ */
/* $NetBSD: netbsd32_machdep.c,v 1.80 2008/05/21 14:10:28 ad Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.79 2008/04/24 18:39:21 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.80 2008/05/21 14:10:28 ad Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -1320,7 +1320,6 @@ startlwp32(void *arg)
#endif
pool_put(&lwp_uc_pool, uc);
KERNEL_UNLOCK_LAST(l);
userret(l, 0, 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.113 2008/03/11 05:34:03 matt Exp $ */
/* $NetBSD: trap.c,v 1.114 2008/05/21 14:07:29 ad Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -33,7 +33,7 @@
/* All bugs are subject to removal without further notice */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.113 2008/03/11 05:34:03 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.114 2008/05/21 14:07:29 ad Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -217,15 +217,9 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
else
ftype = VM_PROT_READ;
if (usermode)
KERNEL_LOCK(1, l);
else
KERNEL_LOCK(1, NULL);
rv = uvm_fault(map, addr, ftype);
if (rv != 0) {
if (!usermode) {
KERNEL_UNLOCK_ONE(NULL);
FAULTCHK;
panic("Segv in kernel mode: pc %x addr %x",
(u_int)frame->pc, (u_int)frame->code);
@ -249,10 +243,6 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
&& (void *)addr >= vm->vm_maxsaddr)
uvm_grow(p, addr);
}
if (usermode)
KERNEL_UNLOCK_LAST(l);
else
KERNEL_UNLOCK_ONE(NULL);
break;
case T_BPTFLT|T_USER:
@ -306,14 +296,12 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
printf("pid %d.%d (%s): sig %d: type %lx, code %lx, pc %lx, psl %lx\n",
p->p_pid, l->l_lid, p->p_comm, sig, frame->trap,
frame->code, frame->pc, frame->psl);
KERNEL_LOCK(1, l);
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = sig;
ksi.ksi_trap = frame->trap;
ksi.ksi_addr = (void *)frame->code;
ksi.ksi_code = code;
trapsignal(l, &ksi);
KERNEL_UNLOCK_LAST(l);
}
if (!usermode)