PERFORCE change 132544 for review

John Birrell jb at FreeBSD.org
Fri Jan 4 20:41:48 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=132544

Change 132544 by jb at jb_freebsd1 on 2008/01/05 04:41:40

	Add a SYSINIT to setup the APs.
	
	The boot CPU is setup in the load function itself rather than waiting
	for the SYSINIT which happens late in the boot process.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_load.c#23 edit

Differences ...

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

@@ -23,6 +23,26 @@
  */
 
 static void
+dtrace_ap_start(void *dummy)
+{
+	int i;
+
+	mutex_enter(&cpu_lock);
+
+	/* Setup the rest of the CPUs. */
+	for (i = 1; i <= mp_maxid; i++) {
+		if (pcpu_find(i) == NULL)
+			continue;
+
+		(void) dtrace_cpu_setup(CPU_CONFIG, i);
+	}
+
+	mutex_exit(&cpu_lock);
+}
+
+SYSINIT(dtrace_ap_start, SI_SUB_SMP, SI_ORDER_ANY, dtrace_ap_start, NULL);
+
+static void
 dtrace_load(void *dummy)
 {
 	dtrace_provider_id_t id;
@@ -59,9 +79,6 @@
 	mutex_enter(&cpu_lock);
 
 #ifdef DOODAD
-	dtrace_modload = dtrace_module_loaded;
-	dtrace_modunload = dtrace_module_unloaded;
-	dtrace_cpu_init = dtrace_cpu_setup_initial;
 	dtrace_helpers_cleanup = dtrace_helpers_destroy;
 	dtrace_helpers_fork = dtrace_helpers_duplicate;
 	dtrace_cpustart_init = dtrace_suspend;
@@ -71,10 +88,8 @@
 	dtrace_kreloc_init = dtrace_suspend;
 	dtrace_kreloc_fini = dtrace_resume;
 
-	register_cpu_setup_func((cpu_setup_func_t *)dtrace_cpu_setup, NULL);
-
+#endif
 	ASSERT(MUTEX_HELD(&cpu_lock));
-#endif
 
 	dtrace_arena = vmem_create("dtrace", (void *)1, UINT32_MAX, 1,
 	    NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
@@ -150,6 +165,13 @@
 	mutex_exit(&dtrace_lock);
 	mutex_exit(&dtrace_provider_lock);
 
+	mutex_enter(&cpu_lock);
+
+	/* Setup the boot CPU */
+	(void) dtrace_cpu_setup(CPU_CONFIG, 0);
+
+	mutex_exit(&cpu_lock);
+
 	/* Enable device cloning. */
 	clone_setup(&dtrace_clones);
 


More information about the p4-projects mailing list