Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Dec 2007 04:36:21 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 131456 for review
Message-ID:  <200712230436.lBN4aLSx090190@repoman.freebsd.org>

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

Change 131456 by jb@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);
 }



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