Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Jan 2008 09:06:42 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 132239 for review
Message-ID:  <200801010906.m0196grI086602@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132239

Change 132239 by jb@jb_freebsd1 on 2008/01/01 09:06:34

	Add the trap function to the hook on loading and NULL when unloading.
	
	Re-order some locks.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_load.c#22 edit
.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_unload.c#19 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_load.c#22 (text+ko) ====

@@ -27,10 +27,8 @@
 {
 	dtrace_provider_id_t id;
 
-#if defined(__i386__)
-	/* Hang our hook for DTrace traps during probes. */
-	dtrace_instr_size_func = dtrace_instr_size;
-#endif
+	/* Hook into the trap handler. */
+	dtrace_trap_func = dtrace_trap;
 
 #ifdef DOODAD
 	/* Hang our hook for thread switches. */
@@ -56,9 +54,9 @@
 	mutex_init(&dtrace_meta_lock,"dtrace meta-provider state", MUTEX_DEFAULT, NULL);
 	mutex_init(&dtrace_errlock,"dtrace error lock", MUTEX_DEFAULT, NULL);
 
-	mutex_enter(&cpu_lock);
 	mutex_enter(&dtrace_provider_lock);
 	mutex_enter(&dtrace_lock);
+	mutex_enter(&cpu_lock);
 
 #ifdef DOODAD
 	dtrace_modload = dtrace_module_loaded;

==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_unload.c#19 (text+ko) ====

@@ -41,23 +41,23 @@
 		clone_cleanup(&dtrace_clones);
 	}
 
-	mutex_enter(&cpu_lock);
 	mutex_enter(&dtrace_provider_lock);
 	mutex_enter(&dtrace_lock);
+	mutex_enter(&cpu_lock);
 
 	ASSERT(dtrace_opens == 0);
 
 	if (dtrace_helpers > 0) {
+		mutex_exit(&cpu_lock);
+		mutex_exit(&dtrace_lock);
 		mutex_exit(&dtrace_provider_lock);
-		mutex_exit(&dtrace_lock);
-		mutex_exit(&cpu_lock);
 		return (EBUSY);
 	}
 
 	if (dtrace_unregister((dtrace_provider_id_t)dtrace_provider) != 0) {
+		mutex_exit(&cpu_lock);
+		mutex_exit(&dtrace_lock);
 		mutex_exit(&dtrace_provider_lock);
-		mutex_exit(&dtrace_lock);
-		mutex_exit(&cpu_lock);
 		return (EBUSY);
 	}
 
@@ -168,10 +168,8 @@
 	dtrace_vtime_switch_func = NULL;
 #endif
 
-#if defined(__i386__)
-	/* Reset our hook for DTrace traps during probes. */
-	dtrace_instr_size_func = NULL;
-#endif
+	/* Unhook from the trap handler. */
+	dtrace_trap_func = NULL;
 
 	return (error);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801010906.m0196grI086602>