PERFORCE change 132306 for review

John Baldwin jhb at FreeBSD.org
Wed Jan 2 09:05:15 PST 2008


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

Change 132306 by jhb at jhb_mutex on 2008/01/02 17:04:34

	Create a test mutex instead of abusing Giant and sched_lock.

Affected files ...

.. //depot/projects/smpng/sys/modules/crash3/crash3.c#2 edit

Differences ...

==== //depot/projects/smpng/sys/modules/crash3/crash3.c#2 (text+ko) ====

@@ -69,6 +69,7 @@
 #define	MAX_EVENT	event_max
 
 static int event_max;
+static struct mtx test1_mtx;
 static struct crash_event **event_start, **event_stop;
 
 static int	mod_event(struct module *module, int cmd, void *arg);
@@ -82,7 +83,9 @@
 ret_spin_mtx_locked(void)
 {
 
-	mtx_lock_spin(&sched_lock);
+	bzero(&test1_mtx, sizeof(test1_mtx));
+	mtx_init(&test1_mtx, "test1", NULL, MTX_SPIN);
+	mtx_lock_spin(&test1_mtx);
 }
 CRASH_EVENT("return with spin mutex locked", ret_spin_mtx_locked);
 
@@ -90,7 +93,9 @@
 ret_mtx_locked(void)
 {
 
-	mtx_lock(&Giant);
+	bzero(&test1_mtx, sizeof(test1_mtx));
+	mtx_init(&test1_mtx, "test1", NULL, MTX_DEF);
+	mtx_lock(&test1_mtx);
 }
 CRASH_EVENT("return with mutex locked", ret_mtx_locked);
 


More information about the p4-projects mailing list