From: Rusty Russell <rusty@rustcorp.com.au>
To: Richard Henderson <rth@twiddle.net>
Cc: torvalds@transmeta.com, matthew@hairy.beasts.org,
bcrl@redhat.com, david@mysql.com, wli@holomorphy.com,
linux-kernel@vger.kernel.org, frankeh@watson.ibm.com
Subject: Re: [PATCH] Fast Userspace Mutexes III.
Date: Thu, 7 Mar 2002 14:39:47 +1100 [thread overview]
Message-ID: <20020307143947.000f51dd.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20020306175203.A26064@twiddle.net>
In-Reply-To: <E16hjZY-0001AV-00@wagner.rustcorp.com.au> <20020306175203.A26064@twiddle.net>
On Wed, 6 Mar 2002 17:52:03 -0800
Richard Henderson <rth@twiddle.net> wrote:
> On Mon, Mar 04, 2002 at 02:55:36PM +1100, Rusty Russell wrote:
> > + /* If we take the semaphore from 1 to 0, it's ours. */
> > + while (!atomic_dec_and_test(count)) {
> > + if (signal_pending(current)) {
> > + retval = -EINTR;
> > + break;
>
> This is not safe from wraparound. Let one thread hold the
> lock forever; let other threads keep trying to take the lock
> while periodically getting SIGALRM. Eventually one of the
> spinning threads will incorrectly acquire the mutex.
Yes, this was noted. And yes, it's about time we fixed sparc32
or threw it out of the tree. But since the real problem here is
"lock held forever", so I don't care.
> You really do need that cmpxchg loop.
Well, not decrementing if count < 0 already also works (as seen in
later patches), and I'm not going to break those SMP 386s if I don't
have to.
Cheers!
Rusty.
PS. Will Alpha have to do any special magic with the mmap PROT_SEM flag?
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
next prev parent reply other threads:[~2002-03-07 3:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-04 3:55 [PATCH] Fast Userspace Mutexes III Rusty Russell
2002-03-04 19:49 ` Robert Love
2002-03-04 20:13 ` Davide Libenzi
2002-03-04 20:20 ` Matthew Kirkwood
2002-03-04 20:48 ` Hubertus Franke
2002-03-04 22:15 ` Davide Libenzi
2002-03-05 1:50 ` Robert Love
2002-03-05 2:53 ` Davide Libenzi
2002-03-05 3:45 ` Rusty Russell
2002-03-05 3:55 ` Davide Libenzi
2002-03-05 6:11 ` Rusty Russell
2002-03-05 17:23 ` Davide Libenzi
2002-03-05 15:09 ` Hubertus Franke
2002-03-05 4:30 ` Edgar Toernig
2002-03-07 1:58 ` Richard Henderson
2002-03-07 2:10 ` Davide Libenzi
2002-03-05 4:48 ` Rusty Russell
2002-03-05 15:15 ` Hubertus Franke
2002-03-06 1:31 ` Rusty Russell
2002-03-05 1:34 ` Rusty Russell
2002-03-07 1:52 ` Richard Henderson
2002-03-07 3:39 ` Rusty Russell [this message]
2002-03-07 8:48 ` Richard Henderson
2002-03-07 9:17 ` Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020307143947.000f51dd.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=bcrl@redhat.com \
--cc=david@mysql.com \
--cc=frankeh@watson.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@hairy.beasts.org \
--cc=rth@twiddle.net \
--cc=torvalds@transmeta.com \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox