PERFORCE change 126348 for review
Kip Macy
kmacy at FreeBSD.org
Wed Sep 12 18:27:51 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=126348
Change 126348 by kmacy at 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.
More information about the p4-projects
mailing list