PERFORCE change 132586 for review

John Birrell jb at FreeBSD.org
Sat Jan 5 13:58:25 PST 2008


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

Change 132586 by jb at jb_freebsd1 on 2008/01/05 21:57:24

	Update to match the amd64 version.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_subr.c#6 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_subr.c#6 (text+ko) ====

@@ -163,52 +163,42 @@
 	(*func)(0, kernelbase);
 }
 
-#ifdef DOODAD
-static int
-dtrace_xcall_func(dtrace_xcall_t func, void *arg)
-{
-	(*func)(arg);
-
-	return (0);
-}
-#endif
 void
 dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, void *arg)
 {
-#ifdef DOODAD
-	cpuset_t set;
+	cpumask_t cpus;
+
+	critical_enter();
+
+	if (cpu == DTRACE_CPUALL)
+		cpus = all_cpus;
+	else
+		cpus = (cpumask_t) (1 << cpu);
 
-	CPUSET_ZERO(set);
+	/* If the current CPU is in the set, call the function directly: */
+	if ((cpus & (1 << curcpu)) != 0) {
+		(*func)(arg);
 
-	if (cpu == DTRACE_CPUALL) {
-		CPUSET_ALL(set);
-	} else {
-		CPUSET_ADD(set, cpu);
+		/* Mask the current CPU from the set */
+		cpus &= ~(1 << curcpu);
 	}
 
-	kpreempt_disable();
-	xc_sync((xc_arg_t)func, (xc_arg_t)arg, 0, X_CALL_HIPRI, set,
-		(xc_func_t)dtrace_xcall_func);
-	kpreempt_enable();
-#else
-	critical_enter();
-	(*func)(arg);
+	/* If there are any CPUs in the set, cross-call to those CPUs */
+	if (cpus != 0)
+		smp_rendezvous_cpus(cpus, NULL, func, smp_no_rendevous_barrier, arg);
+
 	critical_exit();
-#endif
 }
 
-#ifdef DOODAD
 void
 dtrace_sync_func(void)
-{}
-#endif
+{
+}
 
 void
 dtrace_sync(void)
 {
-#ifdef DOODAD
         dtrace_xcall(DTRACE_CPUALL, (dtrace_xcall_t)dtrace_sync_func, NULL);
-#endif
 }
 
 #ifdef DOODAD


More information about the p4-projects mailing list