Deleted Added
full compact
fasttrap.c (211745) fasttrap.c (211925)
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 *
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 211745 2010-08-24 12:12:03Z rpaulo $
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
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
211static int
212fasttrap_highbit(ulong_t i)
213{
214 int h = 1;
215
216 if (i == 0)
217 return (0);
218#ifdef _LP64

--- 65 unchanged lines hidden (view full) ---

284
285/*
286 * This function ensures that no threads are actively using the memory
287 * associated with probes that were formerly live.
288 */
289static void
290fasttrap_mod_barrier(uint64_t gen)
291{
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{
292#if defined(sun)
293 int i;
296 int i;
294#endif
295
296 if (gen < fasttrap_mod_gen)
297 return;
298
299 fasttrap_mod_gen++;
300
297
298 if (gen < fasttrap_mod_gen)
299 return;
300
301 fasttrap_mod_gen++;
302
301#if defined(sun)
302 for (i = 0; i < NCPU; i++) {
303 mutex_enter(&cpu_core[i].cpuc_pid_lock);
304 mutex_exit(&cpu_core[i].cpuc_pid_lock);
303 CPU_FOREACH(i) {
304 mutex_enter(&fasttrap_cpuc_pid_lock[i]);
305 mutex_exit(&fasttrap_cpuc_pid_lock[i]);
305 }
306 }
306#else
307 /* XXX */
308 __asm __volatile("": : :"memory");
309#endif
310}
311
312/*
313 * This is the timeout's callback for cleaning up the providers and their
314 * probes.
315 */
316/*ARGSUSED*/
317static void

--- 2003 unchanged lines hidden (view full) ---

2321 ASSERT(fasttrap_procs.fth_nent > 0);
2322 fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1;
2323 fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent *
2324 sizeof (fasttrap_bucket_t), KM_SLEEP);
2325#if !defined(sun)
2326 for (i = 0; i < fasttrap_procs.fth_nent; i++)
2327 mutex_init(&fasttrap_procs.fth_table[i].ftb_mtx,
2328 "processes bucket mtx", MUTEX_DEFAULT, NULL);
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 }
2329#endif
2330
2331 (void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL,
2332 &fasttrap_meta_id);
2333
2334 return (0);
2335}
2336

--- 108 unchanged lines hidden (view full) ---

2445 dtrace_fasttrap_exec = NULL;
2446
2447 ASSERT(dtrace_fasttrap_exit == &fasttrap_exec_exit);
2448 dtrace_fasttrap_exit = NULL;
2449
2450#if !defined(sun)
2451 destroy_dev(fasttrap_cdev);
2452 mutex_destroy(&fasttrap_count_mtx);
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 }
2453#endif
2454
2455 return (0);
2456}
2457
2458/* ARGSUSED */
2459static int
2460fasttrap_modevent(module_t mod __unused, int type, void *data __unused)

--- 29 unchanged lines hidden ---
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 ---