Date: Thu, 13 Sep 2007 01:27:50 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 126348 for review Message-ID: <200709130127.l8D1RoJU014106@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709130127.l8D1RoJU014106>