PERFORCE change 102666 for review

John Baldwin jhb at FreeBSD.org
Fri Jul 28 17:17:27 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=102666

Change 102666 by jhb at jhb_mutex on 2006/07/28 17:16:56

	Stop conditionally acquiring Giant based on SYF_MPSAFE, it's
	effectively always true now.

Affected files ...

.. //depot/projects/smpng/sys/amd64/amd64/trap.c#49 edit
.. //depot/projects/smpng/sys/amd64/ia32/ia32_syscall.c#19 edit
.. //depot/projects/smpng/sys/arm/arm/trap.c#22 edit
.. //depot/projects/smpng/sys/i386/i386/trap.c#98 edit
.. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_isc.c#7 edit
.. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_xenix.c#19 edit
.. //depot/projects/smpng/sys/ia64/ia32/ia32_trap.c#15 edit
.. //depot/projects/smpng/sys/ia64/ia64/trap.c#86 edit
.. //depot/projects/smpng/sys/notes#89 edit
.. //depot/projects/smpng/sys/powerpc/powerpc/trap.c#55 edit
.. //depot/projects/smpng/sys/sparc64/sparc64/trap.c#71 edit

Differences ...

==== //depot/projects/smpng/sys/amd64/amd64/trap.c#49 (text+ko) ====

@@ -812,17 +812,9 @@
 
 		PTRACESTOP_SC(p, td, S_PT_SCE);
 
-		if ((callp->sy_narg & SYF_MPSAFE) == 0) {
-			mtx_lock(&Giant);
-			AUDIT_SYSCALL_ENTER(code, td);
-			error = (*callp->sy_call)(td, argp);
-			AUDIT_SYSCALL_EXIT(error, td);
-			mtx_unlock(&Giant);
-		} else {
-			AUDIT_SYSCALL_ENTER(code, td);
-			error = (*callp->sy_call)(td, argp);
-			AUDIT_SYSCALL_EXIT(error, td);
-		}
+		AUDIT_SYSCALL_ENTER(code, td);
+		error = (*callp->sy_call)(td, argp);
+		AUDIT_SYSCALL_EXIT(error, td);
 	}
 
 	switch (error) {

==== //depot/projects/smpng/sys/amd64/ia32/ia32_syscall.c#19 (text+ko) ====

@@ -175,13 +175,6 @@
 	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
 	    td->td_proc->p_pid, td->td_proc->p_comm, code);
 
-	/*
-	 * Try to run the syscall without Giant if the syscall
-	 * is MP safe.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_lock(&Giant);
-
 	if (error == 0) {
 		td->td_retval[0] = 0;
 		td->td_retval[1] = frame.tf_rdx;
@@ -226,12 +219,6 @@
 	}
 
 	/*
-	 * Release Giant if we previously set it.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_unlock(&Giant);
-
-	/*
 	 * Traced syscall.
 	 */
 	if (orig_tf_rflags & PSL_T) {

==== //depot/projects/smpng/sys/arm/arm/trap.c#22 (text+ko) ====

@@ -878,7 +878,6 @@
 	u_int nap, nargs;
 	register_t *ap, *args, copyargs[MAXARGS];
 	struct sysent *callp;
-	int locked = 0;
 
 	PCPU_LAZY_INC(cnt.v_syscall);
 	td->td_pticks = 0;
@@ -928,9 +927,6 @@
 		
 	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
 	    td->td_proc->p_pid, td->td_proc->p_comm, code);
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_lock(&Giant);
-	locked = 1;
 	if (error == 0) {
 		td->td_retval[0] = 0;
 		td->td_retval[1] = 0;
@@ -978,8 +974,6 @@
 		frame->tf_spsr |= PSR_C_bit;    /* carry bit */
 		break;
 	}
-	if (locked && (callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_unlock(&Giant);
 
 	WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
 	    (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???");

==== //depot/projects/smpng/sys/i386/i386/trap.c#98 (text+ko) ====

@@ -994,13 +994,6 @@
 	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
 	    td->td_proc->p_pid, td->td_proc->p_comm, code);
 
-	/*
-	 * Try to run the syscall without Giant if the syscall
-	 * is MP safe.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_lock(&Giant);
-
 	if (error == 0) {
 		td->td_retval[0] = 0;
 		td->td_retval[1] = frame.tf_edx;
@@ -1045,12 +1038,6 @@
 	}
 
 	/*
-	 * Release Giant if we previously set it.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_unlock(&Giant);
-
-	/*
 	 * Traced syscall.
 	 */
 	if ((orig_tf_eflags & PSL_T) && !(orig_tf_eflags & PSL_VM)) {

==== //depot/projects/smpng/sys/i386/ibcs2/ibcs2_isc.c#7 (text+ko) ====

@@ -58,13 +58,9 @@
 	code = (tf->tf_eax & 0xffffff00) >> 8;
 	callp = &isc_sysent[code];
 
-	if (code < IBCS2_ISC_MAXSYSCALL) {
-		if ((callp->sy_narg & SYF_MPSAFE) == 0)
-			mtx_lock(&Giant);
+	if (code < IBCS2_ISC_MAXSYSCALL)
 		error = (*callp->sy_call)(td, (void *)uap);
-		if ((callp->sy_narg & SYF_MPSAFE) == 0)
-			mtx_unlock(&Giant);
-	} else
+	else
 		error = ENOSYS;
 	return (error);
 }

==== //depot/projects/smpng/sys/i386/ibcs2/ibcs2_xenix.c#19 (text+ko) ====

@@ -69,13 +69,9 @@
 	code = (tf->tf_eax & 0xff00) >> 8;
 	callp = &xenix_sysent[code];
 
-	if (code < IBCS2_XENIX_MAXSYSCALL) {
-		if ((callp->sy_narg & SYF_MPSAFE) == 0)
-			mtx_lock(&Giant);
+	if (code < IBCS2_XENIX_MAXSYSCALL)
 		error = ((*callp->sy_call)(td, (void *)uap));
-		if ((callp->sy_narg & SYF_MPSAFE) == 0)
-			mtx_unlock(&Giant);
-	} else
+	else
 		error = ENOSYS;
 	return (error);
 }

==== //depot/projects/smpng/sys/ia64/ia32/ia32_trap.c#15 (text+ko) ====

@@ -114,13 +114,6 @@
 	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
 	    td->td_proc->p_pid, td->td_proc->p_comm, code);
 
-	/*
-	 * Try to run the syscall without Giant if the syscall
-	 * is MP safe.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_lock(&Giant);
-
 	if (error == 0) {
 		td->td_retval[0] = 0;
 		td->td_retval[1] = tf->tf_scratch.gr10;	/* edx */
@@ -163,12 +156,6 @@
 	}
 
 	/*
-	 * Release Giant if we previously set it.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_unlock(&Giant);
-
-	/*
 	 * Traced syscall.
 	 */
 	if ((eflags & PSL_T) && !(eflags & PSL_VM)) {

==== //depot/projects/smpng/sys/ia64/ia64/trap.c#86 (text+ko) ====

@@ -1016,15 +1016,7 @@
 
 	PTRACESTOP_SC(p, td, S_PT_SCE);
 
-	/*
-	 * Grab Giant if the syscall is not flagged as MP safe.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0) {
-		mtx_lock(&Giant);
-		error = (*callp->sy_call)(td, args);
-		mtx_unlock(&Giant);
-	} else
-		error = (*callp->sy_call)(td, args);
+	error = (*callp->sy_call)(td, args);
 
 	if (error != EJUSTRETURN) {
 		/*

==== //depot/projects/smpng/sys/notes#89 (text+ko) ====

@@ -76,7 +76,7 @@
 - compat ABI cleanups
   + push Giant down and mark all remaining syscalls MPSAFE
   - remove SYF_MPSAFE
-    - stop conditionally acquiring Giant in syscall() functions
+    + stop conditionally acquiring Giant in syscall() functions
     - remove all the 'M's from the syscall files
     - remove support for the 'M' prefix from the syscall scripts
     - retire SYF_ARGMASK, sy_narg is now back to just being an argument count

==== //depot/projects/smpng/sys/powerpc/powerpc/trap.c#55 (text+ko) ====

@@ -409,11 +409,6 @@
 	if (KTRPOINT(td, KTR_SYSCALL))
 		ktrsyscall(code, narg, (register_t *)params);
 #endif
-	/*
-	 * Try to run the syscall without Giant if the syscall is MP safe.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_lock(&Giant);
 
 	if (error == 0) {
 		td->td_retval[0] = 0;
@@ -466,10 +461,6 @@
 		break;
 	}
 
-
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_unlock(&Giant);
-
 	/*
 	 * Check for misbehavior.
 	 */

==== //depot/projects/smpng/sys/sparc64/sparc64/trap.c#71 (text+ko) ====

@@ -578,13 +578,6 @@
 	CTR5(KTR_SYSC, "syscall: td=%p %s(%#lx, %#lx, %#lx)", td,
 	    syscallnames[code], argp[0], argp[1], argp[2]);
 
-	/*
-	 * Try to run the syscall without the MP lock if the syscall
-	 * is MP safe.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_lock(&Giant);
-
 #ifdef KTRACE
 	if (KTRPOINT(td, KTR_SYSCALL))
 		ktrsyscall(code, narg, argp);
@@ -641,13 +634,6 @@
 	}
 
 	/*
-	 * 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);
-
-	/*
 	 * Check for misbehavior.
 	 */
 	WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",


More information about the p4-projects mailing list