diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2011-07-07 18:11:25 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2011-07-07 18:11:25 +0000 |
commit | f0dbc508cb2d1060a83c43da71f60ac4bab02188 (patch) | |
tree | 260e73ca64d22b10f4541858e6ee7fea0b7c1bff /sys/arch/powerpc | |
parent | 291e013ccd4b9989e6d79d1ae219784a4a37894e (diff) |
There is a bunch of places in the kernel entry points where we don't
hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into
the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret,
systrace_redirect and ADDUPROF. In the cases we already hold the biglock
we'll just recurse.
kettenis@, beck@ ok
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r-- | sys/arch/powerpc/powerpc/trap.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index 7153267bbe3..a37d7452668 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.85 2011/07/06 21:41:37 art Exp $ */ +/* $OpenBSD: trap.c,v 1.86 2011/07/07 18:11:24 art Exp $ */ /* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */ /* @@ -275,9 +275,7 @@ trap(struct trapframe *frame) case EXC_TRC|EXC_USER: { sv.sival_int = frame->srr0; - KERNEL_LOCK(); trapsignal(p, SIGTRAP, type, TRAP_TRACE, sv); - KERNEL_UNLOCK(); } break; @@ -402,9 +400,7 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr); /* XXX Likely that returning from this trap is bogus... */ /* XXX Have to make sure that sigreturn does the right thing. */ sv.sival_int = frame->srr0; - KERNEL_LOCK(); trapsignal(p, SIGSEGV, VM_PROT_EXECUTE, SEGV_MAPERR, sv); - KERNEL_UNLOCK(); break; case EXC_SC|EXC_USER: { @@ -470,27 +466,21 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_LOCK(); ktrsyscall(p, code, argsize, params); - KERNEL_UNLOCK(); } #endif rval[0] = 0; rval[1] = frame->fixreg[FIRSTARG + 1]; #ifdef SYSCALL_DEBUG - KERNEL_LOCK(); scdebug_call(p, code, params); - KERNEL_UNLOCK(); #endif #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_LOCK(); error = systrace_redirect(code, p, params, rval); - KERNEL_UNLOCK(); } else #endif { @@ -528,15 +518,11 @@ syscall_bad: break; } #ifdef SYSCALL_DEBUG - KERNEL_LOCK(); scdebug_ret(p, code, error, rval); - KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_LOCK(); ktrsysret(p, code, error, rval[0]); - KERNEL_UNLOCK(); } #endif } @@ -559,10 +545,8 @@ syscall_bad: frame->srr0 += 4; else { sv.sival_int = frame->srr0; - KERNEL_LOCK(); trapsignal(p, SIGSEGV, VM_PROT_EXECUTE, SEGV_MAPERR, sv); - KERNEL_UNLOCK(); } break; @@ -616,9 +600,7 @@ mpc_print_pci_stat(); errnum++; #endif sv.sival_int = frame->srr0; - KERNEL_LOCK(); trapsignal(p, SIGTRAP, type, TRAP_BRKPT, sv); - KERNEL_UNLOCK(); break; } #if 0 @@ -637,9 +619,7 @@ for (i = 0; i < errnum; i++) { } #endif sv.sival_int = frame->srr0; - KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - KERNEL_UNLOCK(); break; } case EXC_PGM: @@ -667,25 +647,19 @@ for (i = 0; i < errnum; i++) { break; #else /* ALTIVEC */ sv.sival_int = frame->srr0; - KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - KERNEL_UNLOCK(); break; #endif case EXC_VECAST|EXC_USER: - KERNEL_LOCK(); trapsignal(p, SIGFPE, 0, FPE_FLTRES, sv); - KERNEL_UNLOCK(); break; case EXC_AST|EXC_USER: uvmexp.softs++; p->p_md.md_astpending = 0; /* we are about to do it */ if (p->p_flag & P_OWEUPC) { - KERNEL_LOCK(); ADDUPROF(p); - KERNEL_UNLOCK(); } if (ci->ci_want_resched) preempt(NULL); @@ -732,12 +706,10 @@ child_return(void *arg) #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); - KERNEL_UNLOCK(); } #endif } |