From: Andi Kleen <ak@muc.de>
To: Chris Friesen <cfriesen@nortel.com>
Cc: Kyle Moffett <mrmacman_g4@mac.com>,
john cooper <john.cooper@timesys.com>,
linux-kernel@vger.kernel.org
Subject: Re: spinaphore conceptual draft
Date: Mon, 30 May 2005 19:46:35 +0200 [thread overview]
Message-ID: <m1k6lgwqro.fsf@muc.de> (raw)
In-Reply-To: <429B4957.7070405@nortel.com> (Chris Friesen's message of "Mon, 30 May 2005 11:11:51 -0600")
Chris Friesen <cfriesen@nortel.com> writes:
> Andi Kleen wrote:
>> On Mon, May 30, 2005 at 08:52:13AM -0600, Chris Friesen wrote:
>
>>>What about rdtsc?
>
>> It fails the reliable and monotonic test on AMD;
>
> tsc goes backwards on AMD? Under what circumstances (I'm curious,
> since I'm running one...)
It is not synchronized between CPUs and slowly drifts and can even run
at completely different frequencies there when you use powernow! on a
MP system.
It can be used reliably when you only do deltas on same CPU
and correct for the changing frequency. However then you run
into other problems, like it being quite slow on Intel.
I suspect any attempt to use time stamps in locks is a bad
idea because of this.
Note that at least on modern Intel systems you can just use
MONITOR/MWAIT which is much more efficient, if you are willing to eat
the fake wakeups due to the cache line padding they use.
My impression is that the aggressive bus access avoidance the
original poster was trying to implement is not that useful
on modern systems anyways which have fast busses. Also
it is not even clear it even saves anything; after all the
CPU will always snoop cache accesses for all cache lines
and polling for the EXCLUSIVE transition of the local cache line
is probably either free or very cheap.
Optimizing for the congested case is always a bad idea anyways; in
case lock congestion is a problem it is better to fix the lock. And
when you have a really congested lock that for some reason cannot be
fixed then using some kind of queued lock (which also gives you
fairness on NUMA) is probably a better idea. But again you should
really fix the the lock instead, everything else is the wrong answer.
BTW Getting the fairness on the backoff scheme right would have been
probably a major problem.
The thing that seems to tickle CPU vendors much more is to avoid
wasting CPU time on SMT or on Hypervisors while spinning. That can be
all done with much simpler hints (like rep ; nop).
-Andi
next prev parent reply other threads:[~2005-05-30 17:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-27 22:31 spinaphore conceptual draft (was discussion of RT patch) David Nicol
2005-05-28 1:04 ` Kyle Moffett
2005-05-29 5:25 ` David Nicol
2005-05-29 13:41 ` Kyle Moffett
2005-05-29 8:42 ` Nikita Danilov
2005-05-29 13:45 ` Kyle Moffett
2005-05-29 13:29 ` Joe Seigh
2005-05-29 15:32 ` Kyle Moffett
2005-05-30 11:06 ` spinaphore conceptual draft Andi Kleen
2005-05-30 14:52 ` Chris Friesen
2005-05-30 16:40 ` Andi Kleen
2005-05-30 17:11 ` Chris Friesen
2005-05-30 17:46 ` Andi Kleen [this message]
2005-05-30 18:04 ` Kyle Moffett
2005-05-30 18:40 ` Vojtech Pavlik
2005-05-30 18:54 ` Kyle Moffett
2005-05-30 19:24 ` Andi Kleen
2005-05-30 19:28 ` Andi Kleen
2005-05-30 19:39 ` Kyle Moffett
2005-05-31 22:25 ` Paul E. McKenney
2005-05-28 1:05 ` spinaphore conceptual draft (was discussion of RT patch) john cooper
2005-05-28 2:02 ` Steven Rostedt
2005-05-28 13:59 ` Alan Cox
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=m1k6lgwqro.fsf@muc.de \
--to=ak@muc.de \
--cc=cfriesen@nortel.com \
--cc=john.cooper@timesys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mrmacman_g4@mac.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