Date: Fri, 7 Mar 2003 09:42:43 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 26502 for review Message-ID: <200303071742.h27HghlJ066126@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=26502 Change 26502 by jhb@jhb_laptop on 2003/03/07 09:42:24 Make this compile and add a test case for removing a witness structre. Affected files ... .. //depot/projects/smpng/sys/modules/crash/crash.c#2 edit Differences ... ==== //depot/projects/smpng/sys/modules/crash/crash.c#2 (text+ko) ==== @@ -55,7 +55,7 @@ static struct sx foo, bar, bar2; static struct cv event_cv; -static struct mtx event_mtx, test_mtx; +static struct mtx event_mtx, test_mtx, test1_mtx, test2_mtx; static struct proc *kthread; static int event; static const char *event_names[] = { @@ -75,7 +75,8 @@ "re-init of test_mtx", "assert that Giant is locked while it is unlocked", "assert that foo is slocked while it is xlocked", - "lock test, slock foo, sunlock foo, unlock test" + "lock test, slock foo, sunlock foo, unlock test", + "use test1 and test2 mutexes to test witness removal" }; static int mod_event(struct module *module, int cmd, void *arg); @@ -194,7 +195,7 @@ break; case 13: Debugger("about to init again"); - mtx_init(&test_mtx, "test", MTX_DEF); + mtx_init(&test_mtx, "test", NULL, MTX_DEF); Debugger("if we haven't panic'd by now, ouch. :("); mtx_destroy(&test_mtx); break; @@ -212,6 +213,22 @@ sx_sunlock(&foo); mtx_unlock(&test_mtx); break; + case 17: + mtx_init(&test1_mtx, "test1", NULL, MTX_DEF); + mtx_init(&test1_mtx, "test2", NULL, MTX_DEF); + Debugger("no order yet"); + mtx_lock(&Giant); + mtx_lock(&test1_mtx); + mtx_lock(&test2_mtx); + mtx_unlock(&test2_mtx); + mtx_unlock(&test1_mtx); + mtx_unlock(&Giant); + Debugger("test1 and test2 should be ordered"); + mtx_destroy(&test1_mtx); + Debugger("test1 should be gone, test2 should be after Giant"); + mtx_destroy(&test2_mtx); + Debugger("test1 and test2 should be gone"); + break; default: panic("event %d is bogus\n", event); } @@ -221,23 +238,25 @@ static int load(void *arg) { + struct thread *td; + struct proc *p; int error; - struct proc *p; - error = kthread_create(crash_thread, NULL, &p, RFSTOPPED, "crash"); + error = kthread_create(crash_thread, NULL, &p, RFSTOPPED, 0, "crash"); if (error) return (error); sx_init(&foo, "foo"); sx_init(&bar, "bar"); sx_init(&bar2, "bar"); - mtx_init(&test_mtx, "test", MTX_DEF); + mtx_init(&test_mtx, "test", NULL, MTX_DEF); event = 0; - mtx_init(&event_mtx, "crash event", MTX_DEF); + mtx_init(&event_mtx, "crash event", NULL, MTX_DEF); cv_init(&event_cv, "crash"); + td = FIRST_THREAD_IN_PROC(p); mtx_lock_spin(&sched_lock); - FIRST_THREAD_IN_PROC(p)->td_priority = PRI_MIN_IDLE; - p->p_stat = SRUN; - setrunqueue(FIRST_THREAD_IN_PROC(p)); + td->td_priority = PRI_MIN_IDLE; + TD_SET_CAN_RUN(td); + setrunqueue(td); mtx_unlock_spin(&sched_lock); kthread = p; return (0); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303071742.h27HghlJ066126>