summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorbenno <benno@FreeBSD.org>2002-05-12 13:43:21 +0000
committerbenno <benno@FreeBSD.org>2002-05-12 13:43:21 +0000
commit2c8451233af4a256be0440accddf1bce81bf4f10 (patch)
treeeeb9745f58e991a3ccc1cc1ee393187ae60334f3 /sys/powerpc
parent0a358c2aa1e0123e03f8af1d650f306dd71e2807 (diff)
downloadFreeBSD-src-2c8451233af4a256be0440accddf1bce81bf4f10.zip
FreeBSD-src-2c8451233af4a256be0440accddf1bce81bf4f10.tar.gz
More locking fixes.
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/aim/trap.c16
-rw-r--r--sys/powerpc/powerpc/trap.c16
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:
OpenPOWER on IntegriCloud