summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_ktrace.c
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-08-30 18:50:57 +0000
committerdillon <dillon@FreeBSD.org>2001-08-30 18:50:57 +0000
commit08e732a88ba0d12d11fa8b38d5932c6579273aca (patch)
tree03a377cd1fcd2a2db481117b689dc177dcae6dd1 /sys/kern/kern_ktrace.c
parent2b1fd9ab5e429c28b36e02f8dab6b71ca84c695c (diff)
downloadFreeBSD-src-08e732a88ba0d12d11fa8b38d5932c6579273aca.zip
FreeBSD-src-08e732a88ba0d12d11fa8b38d5932c6579273aca.tar.gz
Remove the MPSAFE keyword from the parser for syscalls.master.
Instead introduce the [M] prefix to existing keywords. e.g. MSTD is the MP SAFE version of STD. This is prepatory for a massive Giant lock pushdown. The old MPSAFE keyword made syscalls.master too messy. Begin comments MP-Safe procedures with the comment: /* * MPSAFE */ This comments means that the procedure may be called without Giant held (The procedure itself may still need to obtain Giant temporarily to do its thing). sv_prepsyscall() is now MP SAFE and assumed to be MP SAFE sv_transtrap() is now MP SAFE and assumed to be MP SAFE ktrsyscall() and ktrsysret() are now MP SAFE (Giant Pushdown) trapsignal() is now MP SAFE (Giant Pushdown) Places which used to do the if (mtx_owned(&Giant)) mtx_unlock(&Giant) test in syscall[2]() in */*/trap.c now do not. Instead they explicitly unlock Giant if they previously obtained it, and then assert that it is no longer held to catch broken system calls. Rebuild syscall tables.
Diffstat (limited to 'sys/kern/kern_ktrace.c')
-rw-r--r--sys/kern/kern_ktrace.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index a37ad22..9b97944 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -78,6 +78,9 @@ ktrgetheader(type)
return (kth);
}
+/*
+ * MPSAFE
+ */
void
ktrsyscall(vp, code, narg, args)
struct vnode *vp;
@@ -92,6 +95,7 @@ ktrsyscall(vp, code, narg, args)
register_t *argp;
int i;
+ mtx_lock(&Giant);
p->p_traceflag |= KTRFAC_ACTIVE;
kth = ktrgetheader(KTR_SYSCALL);
MALLOC(ktp, struct ktr_syscall *, len, M_KTRACE, M_WAITOK);
@@ -106,8 +110,12 @@ ktrsyscall(vp, code, narg, args)
FREE(ktp, M_KTRACE);
FREE(kth, M_KTRACE);
p->p_traceflag &= ~KTRFAC_ACTIVE;
+ mtx_unlock(&Giant);
}
+/*
+ * MPSAFE
+ */
void
ktrsysret(vp, code, error, retval)
struct vnode *vp;
@@ -118,6 +126,7 @@ ktrsysret(vp, code, error, retval)
struct ktr_sysret ktp;
struct proc *p = curproc; /* XXX */
+ mtx_lock(&Giant);
p->p_traceflag |= KTRFAC_ACTIVE;
kth = ktrgetheader(KTR_SYSRET);
ktp.ktr_code = code;
@@ -130,6 +139,7 @@ ktrsysret(vp, code, error, retval)
ktrwrite(vp, kth, NULL);
FREE(kth, M_KTRACE);
p->p_traceflag &= ~KTRFAC_ACTIVE;
+ mtx_unlock(&Giant);
}
void
OpenPOWER on IntegriCloud