From owner-p4-projects@FreeBSD.ORG Tue Jun 19 15:16:22 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C447C16A46B; Tue, 19 Jun 2007 15:16:21 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 76BB416A469 for ; Tue, 19 Jun 2007 15:16:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 6742913C484 for ; Tue, 19 Jun 2007 15:16:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5JFGLJU000575 for ; Tue, 19 Jun 2007 15:16:21 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5JFGKMq000572 for perforce@freebsd.org; Tue, 19 Jun 2007 15:16:20 GMT (envelope-from jhb@freebsd.org) Date: Tue, 19 Jun 2007 15:16:20 GMT Message-Id: <200706191516.l5JFGKMq000572@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 121978 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2007 15:16:22 -0000 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) {