PERFORCE change 131456 for review

John Birrell jb at FreeBSD.org
Sat Dec 22 20:36:22 PST 2007


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

Change 131456 by jb at jb_freebsd1 on 2007/12/23 04:36:02

	Initialise the CPU mutex and ensure it gets locked around
	calls that have asserts which check that it is locked.
	
	Leave the cyclic_fire() call disabled for now.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/kern/kern_cyclic.c#6 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/kern/kern_cyclic.c#6 (text+ko) ====

@@ -32,8 +32,24 @@
 static void
 cyclic_load(void *dummy)
 {
+	int i;
+
+	mutex_init(&cpu_lock, "Cyclic CPU lock", MUTEX_DEFAULT, NULL);
+
+	mutex_enter(&cpu_lock);
+
+	/*
+	 * "Enable" all CPUs even though they may not exist just so
+	 * that the asserts work. On FreeBSD, if a CPU exists, it is
+	 * enabled.
+	 */
+	for (i = 0; i < MAXCPU; i++)
+		cyclic_cpu[i].cpu_flags &= CPU_ENABLE;
+
 	/* Initialise the machine-dependent backend. */
 	cyclic_machdep_init();
+
+	mutex_exit(&cpu_lock);
 }
 
 SYSINIT(cyclic_register, SI_SUB_CYCLIC, SI_ORDER_SECOND, cyclic_load, NULL)
@@ -41,8 +57,14 @@
 static void
 cyclic_unload(void)
 {
+	mutex_enter(&cpu_lock);
+
 	/* Uninitialise the machine-dependent backend. */
 	cyclic_machdep_uninit();
+
+	mutex_exit(&cpu_lock);
+
+	mutex_destroy(&cpu_lock);
 }
 
 SYSUNINIT(cyclic_unregister, SI_SUB_CYCLIC, SI_ORDER_SECOND, cyclic_unload, NULL);
@@ -58,8 +80,10 @@
 
 	c->cpu_intr_actv |= (1 << CY_HIGH_LEVEL);
 
+#ifdef DOODAD
 	/* Fire any timers that are due. */
 	cyclic_fire(c);
+#endif
 
 	c->cpu_intr_actv &= ~(1 << CY_HIGH_LEVEL);
 }


More information about the p4-projects mailing list