PERFORCE change 103908 for review
John Baldwin
jhb at FreeBSD.org
Mon Aug 14 21:02:32 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=103908
Change 103908 by jhb at jhb_mutex on 2006/08/14 21:01:30
Less sucky.
Affected files ...
.. //depot/projects/smpng/sys/modules/crash2/crash2.c#14 edit
Differences ...
==== //depot/projects/smpng/sys/modules/crash2/crash2.c#14 (text+ko) ====
@@ -91,6 +91,7 @@
static struct mtx abc, def, ghi, jkl;
static struct sx one, two, three, four;
static struct lock fee, fi, fo, fum;
+static int crash2_wait = 1;
static int mod_event(struct module *module, int cmd, void *arg);
static int load(void *arg);
@@ -105,10 +106,21 @@
static void
mtx_deadlock(int thread)
{
+ static int barrier;
+ atomic_add_int(&barrier, 1);
+ while (barrier != NTHREADS)
+ cpu_spinwait();
mtx_lock(mtxen[thread % 4]);
DELAY(500);
+
+ atomic_add_int(&barrier, 1);
+ while (barrier != 2 * NTHREADS)
+ cpu_spinwait();
mtx_lock(mtxen[(thread + 1) % 4]);
+
+ while (crash2_wait)
+ cpu_spinwait();
}
CRASH2_EVENT("mutex cycle", mtx_deadlock, mtx_deadlock, mtx_deadlock,
mtx_deadlock);
More information about the p4-projects
mailing list