A strange thing with yesterday's head..

Giovanni Trematerra giovanni.trematerra at gmail.com
Wed Feb 3 23:43:37 UTC 2010


> Just tried it again (a few times) at r203430, with similar results.

Hi Brandon,
did you update -STABLE? I meant -CURRENT!
Anyway, if you are updating -STABLE, please try the patch below. I
don't know if it applies on -STABLE, let me know.

Thanks for your time.

--
Gianni

--- head/sys/kern/kern_umtx.c	2010/01/10 09:31:57	201991
+++ head/sys/kern/kern_umtx.c	2010/02/03 03:56:32	203414
@@ -2526,6 +2526,12 @@
 		umtxq_busy(&uq->uq_key);
 		umtxq_unlock(&uq->uq_key);

+		/*
+		 * re-read the state, in case it changed between the try-lock above
+		 * and the check below
+		 */
+		state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state));
+
 		/* set read contention bit */
 		while ((state & wrflags) && !(state & URWLOCK_READ_WAITERS)) {
 			oldstate = casuword32(&rwlock->rw_state, state, state |
URWLOCK_READ_WAITERS);
@@ -2658,6 +2664,12 @@
 		umtxq_busy(&uq->uq_key);
 		umtxq_unlock(&uq->uq_key);

+		/*
+		 * re-read the state, in case it changed between the try-lock above
+		 * and the check below
+		 */
+		state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state));
+
 		while (((state & URWLOCK_WRITE_OWNER) || URWLOCK_READER_COUNT(state) != 0) &&
 		       (state & URWLOCK_WRITE_WAITERS) == 0) {
 			oldstate = casuword32(&rwlock->rw_state, state, state |
URWLOCK_WRITE_WAITERS);


More information about the freebsd-current mailing list