From: Andrea Arcangeli <andrea@suse.de>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: "D . W . Howells" <dhowells@astarte.free-online.co.uk>,
dhowells@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]
Date: Sat, 21 Apr 2001 16:03:27 +0200 [thread overview]
Message-ID: <20010421160327.A17757@athlon.random> (raw)
In-Reply-To: <20010420191710.A32159@athlon.random> <Pine.LNX.4.31.0104201639070.6299-100000@penguin.transmeta.com>
In-Reply-To: <Pine.LNX.4.31.0104201639070.6299-100000@penguin.transmeta.com>; from torvalds@transmeta.com on Fri, Apr 20, 2001 at 04:45:32PM -0700
On Fri, Apr 20, 2001 at 04:45:32PM -0700, Linus Torvalds wrote:
> I would suggest the following:
>
> - the generic semaphores should use the lock that already exists in the
> wait-queue as the semaphore spinlock.
Ok, that is what my generic code does.
> - the generic semaphores should _not_ drop the lock. Right now it drops
> the semaphore lock when it goes into the slow path, only to re-aquire
> it. This is due to bad interfacing with the generic slow-path routines.
My generic code doesn't drop the lock.
> I suspect that this lock-drop is why Andrea sees problems with the
> generic semaphores. The changes to "count" and "sleeper" aren't
> actually atomic, because we don't hold the lock over them all. And
> re-using the lock means that we don't need the two levels of
> spinlocking for adding ourselves to the wait queue. Easily done by just
> moving the locking _out_ of the wait-queue helper functions, no?
Basically yes, however for the wakeup I wrote a dedicated routine that
knows how to do the wake-all-next-readers or wake-next-writer (it is not
the same helper function of sched.c).
> - the generic semaphores are entirely out-of-line, and are just declared
> universally as regular FASTCALL() functions.
This is what I implemented originally but then I moved the fast path inline
for the fast-path benchmark reasons. I think in real life it doesn't matter
much if the fast path is inline or not.
> The fast-path x86 code looks ok to me. The debugging stuff makes it less
> readable than it should be, I suspect, and is probably not worth it at
> this stage. The users of rw-semaphores are so well-defined (and so well
> debugged) that the debugging code only makes the code harder to follow
> right now.
yes I agree, infact I added the ->magic check only to catch uninitialized
semaphores (and this one doesn't hurt readability that much).
> Comments? Andrea? Your patches have looked ok, but I absoutely refuse to
> see the non-inlined fast-path for reasonable x86 hardware..
In my last patch the fast path is inline as said above but it is not in asm yet
because I couldn't get convinced it was right code. I plan to return looking
into the rwsem soon. I also seen David fixed the bug and dropped the buggy
rwsem-spin.h, so I suggest to merge his code for now, after a very short look
it seems certainly better than pre5.
Andrea
next prev parent reply other threads:[~2001-04-21 14:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-19 23:28 rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]] D.W.Howells
2001-04-20 1:42 ` Andrea Arcangeli
2001-04-20 10:10 ` David Howells
2001-04-20 17:17 ` x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]] Andrea Arcangeli
2001-04-20 23:45 ` Linus Torvalds
2001-04-21 14:03 ` Andrea Arcangeli [this message]
2001-04-21 14:17 ` Russell King
2001-04-21 14:29 ` Andrea Arcangeli
2001-04-21 14:37 ` rmk
2001-04-21 15:04 ` Andrea Arcangeli
2001-04-21 17:18 ` Linus Torvalds
2001-04-21 14:37 ` Russell King
2001-04-21 15:07 ` Andrea Arcangeli
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=20010421160327.A17757@athlon.random \
--to=andrea@suse.de \
--cc=dhowells@astarte.free-online.co.uk \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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