Date: Fri, 23 Feb 2007 20:15:31 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 114899 for review Message-ID: <200702232015.l1NKFVqW084601@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=114899 Change 114899 by jhb@jhb_mutex on 2007/02/23 20:15:10 Merge in changes from jhb_lock. Affected files ... .. //depot/projects/smpng/sys/modules/crash/crash.c#35 integrate .. //depot/projects/smpng/sys/modules/crash2/crash2.c#19 integrate .. //depot/projects/smpng/sys/modules/evtest/evtest.c#23 integrate Differences ... ==== //depot/projects/smpng/sys/modules/crash/crash.c#35 (text+ko) ==== @@ -87,6 +87,71 @@ /* Events. */ static void +sleep_sx_recurse(void) +{ + sx_slock(&foo); + sx_slock(&foo); + printf("sleeping on recursed sx\n"); + sx_sleep(&load, &foo, PWAIT, "sxsslp", hz/10); + sx_sunlock(&foo); + sx_sunlock(&foo); +} +CRASH_EVENT("test recursive sx_sleep()", sleep_sx_recurse); + +static void +sleep_rw_recurse(void) +{ + rw_init(&baz, "baz"); + rw_rlock(&baz); + rw_rlock(&baz); + printf("sleeping on recursed rwlock\n"); + rw_sleep(&load, &baz, PWAIT, "rwrslp", hz/10); + rw_runlock(&baz); + rw_runlock(&baz); + rw_destroy(&baz); +} +CRASH_EVENT("test recursive rw_sleep()", sleep_rw_recurse); + +static void +pause_test(void) +{ + printf("sleeping for 5 seconds..\n"); + pause("pt", 5 * hz); + printf("awake..\n"); +} +CRASH_EVENT("test pause()", pause_test); + +static void +sleep_sx(void) +{ + sx_slock(&foo); + sx_sleep(&load, &foo, PWAIT, "sxsslp", hz/10); + if (sx_try_upgrade(&foo) == 0) + printf("bad juju, upgrade failed\n"); + else { + sx_sleep(&load, &foo, PWAIT, "sxxslp", hz/10); + sx_xunlock(&foo); + } +} +CRASH_EVENT("test sx_sleep()", sleep_sx); + +static void +sleep_rw(void) +{ + rw_init(&baz, "baz"); + rw_rlock(&baz); + rw_sleep(&load, &baz, PWAIT, "rwrslp", hz/10); + if (rw_try_upgrade(&baz) == 0) + printf("bad juju, upgrade failed\n"); + else { + rw_sleep(&load, &baz, PWAIT, "rwwslp", hz/10); + rw_wunlock(&baz); + } + rw_destroy(&baz); +} +CRASH_EVENT("test rw_sleep()", sleep_rw); + +static void lock_destroyed_mtx(void) { @@ -170,7 +235,7 @@ #ifdef WITNESS static void -rw_sleep(void) +rw_tsleep(void) { rw_init(&baz, "baz"); rw_rlock(&baz); @@ -178,7 +243,7 @@ rw_runlock(&baz); rw_destroy(&baz); } -CRASH_EVENT("test sleeping with rw lock held", rw_sleep); +CRASH_EVENT("test sleeping with rw lock held", rw_tsleep); static void rw_order_sx(void) @@ -769,6 +834,8 @@ kthread_exit(0); break; } + /* Give sysctl time to finish. */ + pause("delay", hz / 5); if (ev < 0 || ev >= MAX_EVENT) { printf("crash: event %d is not defined!\n", event); continue; ==== //depot/projects/smpng/sys/modules/crash2/crash2.c#19 (text+ko) ==== @@ -361,6 +361,8 @@ kthread_exit(0); break; } + /* Give sysctl time to finish. */ + pause("delay", hz / 5); if (ev < 0 || ev >= MAX_EVENT) { printf("crash2[%d]: event %d is not defined!\n", i, ev); continue; ==== //depot/projects/smpng/sys/modules/evtest/evtest.c#23 (text+ko) ==== @@ -300,6 +300,8 @@ while ((ev = event) == 0) cv_wait(&event_cv, &event_mtx); mtx_unlock(&event_mtx); + /* Give sysctl time to finish. */ + pause("delay", hz / 5); if (ev >= 1 && ev <= MAX_EVENT && events[ev].ei_help != NULL) printf("evtest: %s\n", events[ev].ei_help); switch (ev) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702232015.l1NKFVqW084601>