1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 * 21 * Portions Copyright 2010 The FreeBSD Foundation 22 * |
23 * $FreeBSD: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c 211925 2010-08-28 08:13:38Z rpaulo $ |
24 */ 25 26/* 27 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31#if defined(sun) --- 171 unchanged lines hidden (view full) --- 203static fasttrap_proc_t *fasttrap_proc_lookup(pid_t); 204static void fasttrap_proc_release(fasttrap_proc_t *); 205 206#define FASTTRAP_PROVS_INDEX(pid, name) \ 207 ((fasttrap_hash_str(name) + (pid)) & fasttrap_provs.fth_mask) 208 209#define FASTTRAP_PROCS_INDEX(pid) ((pid) & fasttrap_procs.fth_mask) 210 |
211#if !defined(sun) 212static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU]; 213#endif 214 |
215static int 216fasttrap_highbit(ulong_t i) 217{ 218 int h = 1; 219 220 if (i == 0) 221 return (0); 222#ifdef _LP64 --- 65 unchanged lines hidden (view full) --- 288 289/* 290 * This function ensures that no threads are actively using the memory 291 * associated with probes that were formerly live. 292 */ 293static void 294fasttrap_mod_barrier(uint64_t gen) 295{ |
296 int i; |
297 298 if (gen < fasttrap_mod_gen) 299 return; 300 301 fasttrap_mod_gen++; 302 |
303 CPU_FOREACH(i) { 304 mutex_enter(&fasttrap_cpuc_pid_lock[i]); 305 mutex_exit(&fasttrap_cpuc_pid_lock[i]); |
306 } |
307} 308 309/* 310 * This is the timeout's callback for cleaning up the providers and their 311 * probes. 312 */ 313/*ARGSUSED*/ 314static void --- 2003 unchanged lines hidden (view full) --- 2318 ASSERT(fasttrap_procs.fth_nent > 0); 2319 fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1; 2320 fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent * 2321 sizeof (fasttrap_bucket_t), KM_SLEEP); 2322#if !defined(sun) 2323 for (i = 0; i < fasttrap_procs.fth_nent; i++) 2324 mutex_init(&fasttrap_procs.fth_table[i].ftb_mtx, 2325 "processes bucket mtx", MUTEX_DEFAULT, NULL); |
2326 2327 CPU_FOREACH(i) { 2328 mutex_init(&fasttrap_cpuc_pid_lock[i], "fasttrap barrier", 2329 MUTEX_DEFAULT, NULL); 2330 } |
2331#endif 2332 2333 (void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL, 2334 &fasttrap_meta_id); 2335 2336 return (0); 2337} 2338 --- 108 unchanged lines hidden (view full) --- 2447 dtrace_fasttrap_exec = NULL; 2448 2449 ASSERT(dtrace_fasttrap_exit == &fasttrap_exec_exit); 2450 dtrace_fasttrap_exit = NULL; 2451 2452#if !defined(sun) 2453 destroy_dev(fasttrap_cdev); 2454 mutex_destroy(&fasttrap_count_mtx); |
2455 CPU_FOREACH(i) { 2456 mutex_destroy(&fasttrap_cpuc_pid_lock[i]); 2457 } |
2458#endif 2459 2460 return (0); 2461} 2462 2463/* ARGSUSED */ 2464static int 2465fasttrap_modevent(module_t mod __unused, int type, void *data __unused) --- 29 unchanged lines hidden --- |