Date: Tue, 19 Jun 2007 15:16:20 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 121978 for review Message-ID: <200706191516.l5JFGKMq000572@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=121978 Change 121978 by jhb@jhb_mutex on 2007/06/19 15:15:46 Pullup additional tests from jhb_lock branch (such as a test for the various cases of the sx recursion stuff). Affected files ... .. //depot/projects/smpng/sys/modules/crash/crash.c#38 integrate Differences ... ==== //depot/projects/smpng/sys/modules/crash/crash.c#38 (text+ko) ==== @@ -72,7 +72,7 @@ static int event_max; static struct crash_event **event_start, **event_stop; static struct rwlock baz; -static struct sx foo, bar, bar2; +static struct sx foo, bar, bar2, qux; static struct cv event_cv; static struct mtx event_mtx, test_mtx, test1_mtx, test2_mtx; static struct proc *kthread; @@ -87,6 +87,32 @@ /* Events. */ static void +sx_recurse(void) +{ + + sx_init_flags(&qux, "qux", SX_RECURSE); + sx_xlock(&qux); + sx_xlock(&qux); + kdb_enter("qux should be recursed"); + sx_xunlock(&qux); + if (sx_try_xlock(&qux) == 0) + panic("try_xlock failed!"); + sx_xunlock(&qux); + sx_xunlock(&qux); + sx_destroy(&qux); + sx_init(&qux, "qux"); + sx_xlock(&qux); + if (sx_try_xlock(&qux)) + panic("try_xlock worked!"); + printf("nested xlock should go boom\n"); + sx_xlock(&qux); + sx_xunlock(&qux); + sx_xunlock(&qux); + sx_destroy(&qux); +} +CRASH_EVENT("test sx xlock recurse", sx_recurse); + +static void cv_sx(void) { struct cv blah; @@ -169,6 +195,30 @@ CRASH_EVENT("test rw_sleep()", sleep_rw); static void +lock_destroyed_sx(void) +{ + + sx_init(&qux, "qux"); + sx_destroy(&qux); + kdb_enter("examine qux"); + sx_xlock(&qux); + kdb_enter("examine again"); +} +CRASH_EVENT("lock destroyed sx", lock_destroyed_sx); + +static void +lock_destroyed_rw(void) +{ + + rw_init(&baz, "baz"); + rw_destroy(&baz); + kdb_enter("examine baz"); + rw_wlock(&baz); + kdb_enter("examine again"); +} +CRASH_EVENT("lock destroyed rwlock", lock_destroyed_rw); + +static void lock_destroyed_mtx(void) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706191516.l5JFGKMq000572>