Date: Sat, 28 Aug 2010 08:13:38 +0000 (UTC) From: Rui Paulo <rpaulo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r211925 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace Message-ID: <201008280813.o7S8Dcq3023756@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rpaulo Date: Sat Aug 28 08:13:38 2010 New Revision: 211925 URL: http://svn.freebsd.org/changeset/base/211925 Log: Replace a memory barrier with a mutex barrier. Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Aug 28 08:03:29 2010 (r211924) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Aug 28 08:13:38 2010 (r211925) @@ -208,6 +208,10 @@ static void fasttrap_proc_release(fasttr #define FASTTRAP_PROCS_INDEX(pid) ((pid) & fasttrap_procs.fth_mask) +#if !defined(sun) +static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU]; +#endif + static int fasttrap_highbit(ulong_t i) { @@ -289,24 +293,17 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t static void fasttrap_mod_barrier(uint64_t gen) { -#if defined(sun) int i; -#endif if (gen < fasttrap_mod_gen) return; fasttrap_mod_gen++; -#if defined(sun) - for (i = 0; i < NCPU; i++) { - mutex_enter(&cpu_core[i].cpuc_pid_lock); - mutex_exit(&cpu_core[i].cpuc_pid_lock); + CPU_FOREACH(i) { + mutex_enter(&fasttrap_cpuc_pid_lock[i]); + mutex_exit(&fasttrap_cpuc_pid_lock[i]); } -#else - /* XXX */ - __asm __volatile("": : :"memory"); -#endif } /* @@ -2326,6 +2323,11 @@ fasttrap_load(void) for (i = 0; i < fasttrap_procs.fth_nent; i++) mutex_init(&fasttrap_procs.fth_table[i].ftb_mtx, "processes bucket mtx", MUTEX_DEFAULT, NULL); + + CPU_FOREACH(i) { + mutex_init(&fasttrap_cpuc_pid_lock[i], "fasttrap barrier", + MUTEX_DEFAULT, NULL); + } #endif (void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL, @@ -2450,6 +2452,9 @@ fasttrap_unload(void) #if !defined(sun) destroy_dev(fasttrap_cdev); mutex_destroy(&fasttrap_count_mtx); + CPU_FOREACH(i) { + mutex_destroy(&fasttrap_cpuc_pid_lock[i]); + } #endif return (0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008280813.o7S8Dcq3023756>