From owner-p4-projects@FreeBSD.ORG Thu Sep 13 01:27:51 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 51ABA16A420; Thu, 13 Sep 2007 01:27:51 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B05416A41A for ; Thu, 13 Sep 2007 01:27:51 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 245E513C46E for ; Thu, 13 Sep 2007 01:27:51 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l8D1RpD2014109 for ; Thu, 13 Sep 2007 01:27:51 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l8D1RoJU014106 for perforce@freebsd.org; Thu, 13 Sep 2007 01:27:50 GMT (envelope-from kmacy@freebsd.org) Date: Thu, 13 Sep 2007 01:27:50 GMT Message-Id: <200709130127.l8D1RoJU014106@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 126348 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: Thu, 13 Sep 2007 01:27:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=126348 Change 126348 by kmacy@kmacy_home:ethng on 2007/09/13 01:27:50 remove bogus assert preventing recursion be extra paranoid about volatile when doing adaptive spinning Affected files ... .. //depot/projects/ethng/src/sys/kern/kern_rwlock.c#2 edit Differences ... ==== //depot/projects/ethng/src/sys/kern/kern_rwlock.c#2 (text+ko) ==== @@ -186,9 +186,6 @@ MPASS(curthread != NULL); KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_wlock() of destroyed rwlock @ %s:%d", file, line)); - KASSERT(rw_wowner(rw) != curthread, - ("%s (%s): wlock already held @ %s:%d", __func__, - rw->lock_object.lo_name, file, line)); WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, line); __rw_wlock(rw, curthread, file, line); @@ -327,7 +324,7 @@ * the owner stops running or the state of the lock * changes. */ - owner = (struct thread *)RW_OWNER(x); + owner = (volatile struct thread *)RW_OWNER(x); if (TD_IS_RUNNING(owner)) { turnstile_cancel(ts); if (LOCK_LOG_TEST(&rw->lock_object, 0)) @@ -337,13 +334,16 @@ lock_profile_obtain_lock_failed(&rw->lock_object, &contested, &waittime); #endif - while ((struct thread*)RW_OWNER(rw->rw_lock)== owner && - TD_IS_RUNNING(owner)) + if (owner == curthread) + panic("logic error in rwlock"); + while ((volatile struct thread*)RW_OWNER(rw->rw_lock)== owner && + TD_IS_RUNNING(owner)) cpu_spinwait(); + continue; + } #endif - /* * We were unable to acquire the lock and the read waiters * flag is set, so we must block on the turnstile.