Date: Sat, 5 Jan 2008 04:44:51 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 132546 for review Message-ID: <200801050444.m054ipaD005777@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132546 Change 132546 by jb@jb_freebsd1 on 2008/01/05 04:44:49 Get the CPU cross-calls working. This is a milestone. The profile provider can now fire probes on each CPU and the DTrace module does the right thing. :-) Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/amd64/dtrace_subr.c#4 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/amd64/dtrace_subr.c#4 (text+ko) ==== @@ -33,6 +33,7 @@ #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/kmem.h> +#include <sys/smp.h> #include <sys/dtrace_impl.h> #include <sys/dtrace_bsd.h> #include <machine/frame.h> @@ -168,52 +169,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 +static 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801050444.m054ipaD005777>