diff options
author | benno <benno@FreeBSD.org> | 2002-05-12 13:43:21 +0000 |
---|---|---|
committer | benno <benno@FreeBSD.org> | 2002-05-12 13:43:21 +0000 |
commit | 2c8451233af4a256be0440accddf1bce81bf4f10 (patch) | |
tree | eeb9745f58e991a3ccc1cc1ee393187ae60334f3 /sys | |
parent | 0a358c2aa1e0123e03f8af1d650f306dd71e2807 (diff) | |
download | FreeBSD-src-2c8451233af4a256be0440accddf1bce81bf4f10.zip FreeBSD-src-2c8451233af4a256be0440accddf1bce81bf4f10.tar.gz |
More locking fixes.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/powerpc/aim/trap.c | 16 | ||||
-rw-r--r-- | sys/powerpc/powerpc/trap.c | 16 |
2 files changed, 26 insertions, 6 deletions
diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c index 1aa2272..13f8646 100644 --- a/sys/powerpc/aim/trap.c +++ b/sys/powerpc/aim/trap.c @@ -265,8 +265,6 @@ trap(frame) int n; register_t args[10]; - PROC_LOCK(p); - #if 0 uvmexp.syscalls++; #endif @@ -309,6 +307,13 @@ trap(frame) params = args; } + /* + * Try to run the syscall without Giant if the syscall + * is MP safe. + */ + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_lock(&Giant); + #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) ktrsyscall(p, code, argsize, params); @@ -344,12 +349,17 @@ syscall_bad: break; } + /* + * Release Giant if we had to get it. Don't use + * mtx_owned(), we want to catch broken syscalls. + */ + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_unlock(&Giant); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) ktrsysret(p, code, error, rval[0]); #endif } - PROC_UNLOCK(p); break; case EXC_FPU|EXC_USER: diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 1aa2272..13f8646 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -265,8 +265,6 @@ trap(frame) int n; register_t args[10]; - PROC_LOCK(p); - #if 0 uvmexp.syscalls++; #endif @@ -309,6 +307,13 @@ trap(frame) params = args; } + /* + * Try to run the syscall without Giant if the syscall + * is MP safe. + */ + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_lock(&Giant); + #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) ktrsyscall(p, code, argsize, params); @@ -344,12 +349,17 @@ syscall_bad: break; } + /* + * Release Giant if we had to get it. Don't use + * mtx_owned(), we want to catch broken syscalls. + */ + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_unlock(&Giant); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) ktrsysret(p, code, error, rval[0]); #endif } - PROC_UNLOCK(p); break; case EXC_FPU|EXC_USER: |