Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Feb 2010 00:43:35 +0100
From:      Giovanni Trematerra <giovanni.trematerra@gmail.com>
To:        Brandon Gooch <jamesbrandongooch@gmail.com>
Cc:        Attilio Rao <attilio@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>, Randall Stewart <rrs@lakerest.net>
Subject:   Re: A strange thing with yesterday's head..
Message-ID:  <4e6cba831002031543r391ba4c7m620868fe9cc044a8@mail.gmail.com>
In-Reply-To: <179b97fb1002031002g617aee35uec79e3367b2ff7a5@mail.gmail.com>
References:  <B4F940BE-04BD-4ACC-B686-21D61423D236@lakerest.net> <20100128201520.6a114290@ernst.jennejohn.org> <117532D7-75B9-4BE8-A8B6-0A6761064B92@lakerest.net> <4e6cba831001290744m6067691ct489c61fe9cd28502@mail.gmail.com> <179b97fb1001291212p5b0829f2pea28ab36a85751cf@mail.gmail.com> <4e6cba831002011404h1b6b893cj2390bf0a7560a7f2@mail.gmail.com> <179b97fb1002011424p4a799ff6t8f6b39e6f4b66828@mail.gmail.com> <4e6cba831002022320u2bd5f325m6564556a1abcf4c5@mail.gmail.com> <179b97fb1002031002g617aee35uec79e3367b2ff7a5@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4e6cba831002031543r391ba4c7m620868fe9cc044a8>