From owner-svn-src-all@FreeBSD.ORG Sat Aug 28 08:13:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11F811065695; Sat, 28 Aug 2010 08:13:39 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAE6A8FC08; Sat, 28 Aug 2010 08:13:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7S8DcRL023758; Sat, 28 Aug 2010 08:13:38 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7S8Dcq3023756; Sat, 28 Aug 2010 08:13:38 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201008280813.o7S8Dcq3023756@svn.freebsd.org> From: Rui Paulo Date: Sat, 28 Aug 2010 08:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211925 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2010 08:13:39 -0000 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);