PERFORCE change 90521 for review
John Baldwin
jhb at FreeBSD.org
Fri Jan 27 15:02:49 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=90521
Change 90521 by jhb at jhb_slimer on 2006/01/27 23:02:37
Integ changes from jhb_lock branch.
Affected files ...
.. //depot/projects/smpng/sys/modules/crash/crash.c#28 integrate
Differences ...
==== //depot/projects/smpng/sys/modules/crash/crash.c#28 (text+ko) ====
@@ -49,11 +49,12 @@
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/refcount.h>
+#include <sys/rwlock.h>
#include <sys/sched.h>
-#include <sys/unistd.h>
-#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
+#include <sys/sx.h>
+#include <sys/unistd.h>
struct crash_event {
const char *ev_name;
@@ -69,6 +70,7 @@
#define MAX_EVENT SET_COUNT(crash_event_set)
+static struct rwlock baz;
static struct sx foo, bar, bar2;
static struct cv event_cv;
static struct mtx event_mtx, test_mtx, test1_mtx, test2_mtx;
@@ -83,6 +85,49 @@
/* Events. */
+#ifdef WITNESS
+static void
+fault_with_lock(void)
+{
+ char c, *cp;
+
+ cp = NULL;
+ mtx_lock(&test_mtx);
+ c = *cp;
+ mtx_unlock(&test_mtx);
+ printf("Read value of %x\n", (int)c);
+}
+CRASH_EVENT("fault with a mutex held", fault_with_lock);
+#endif
+
+static void
+rwlock_wlock(void)
+{
+
+ rw_init(&baz, "baz");
+ kdb_enter("baz exists");
+ rw_wlock(&baz);
+ kdb_enter("baz has a writer");
+ rw_wunlock(&baz);
+ kdb_enter("baz is unlocked");
+ rw_destroy(&baz);
+}
+CRASH_EVENT("rw_wlock", rwlock_wlock);
+
+static void
+rwlock_rlock(void)
+{
+
+ rw_init(&baz, "baz");
+ kdb_enter("baz exists");
+ rw_rlock(&baz);
+ kdb_enter("baz has a reader");
+ rw_runlock(&baz);
+ kdb_enter("baz is unlocked");
+ rw_destroy(&baz);
+}
+CRASH_EVENT("rw_rlock", rwlock_rlock);
+
static void
msleep_spin_callout(void *dummy)
{
More information about the p4-projects
mailing list