From: Kyle Moffett <mrmacman_g4@mac.com>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: Andi Kleen <ak@muc.de>, Chris Friesen <cfriesen@nortel.com>,
john cooper <john.cooper@timesys.com>,
linux-kernel@vger.kernel.org
Subject: Re: spinaphore conceptual draft
Date: Mon, 30 May 2005 14:54:52 -0400 [thread overview]
Message-ID: <D051ED6E-5CE3-40AD-99A5-F860B465FCA8@mac.com> (raw)
In-Reply-To: <20050530184059.GA2222@ucw.cz>
On May 30, 2005, at 14:40:59, Vojtech Pavlik wrote:
> On Mon, May 30, 2005 at 02:04:36PM -0400, Kyle Moffett wrote:
>> Unsynchronized is fine, we're only taking differences of short times.
>
> If you ask on two CPUs in a quick succession, you can get a negative
> time difference.
But not on the same CPU, which is the only thing done in the given
implementation.
>
>> Slow drift is likewise OK too. As to the different frequencies, how
>> different are we talking about?
>
> 1GHz vs 2GHz, for example.
Fine, a ratio of 2 or even probably 4 is ok. If it was a ratio of 10:1
or 20:1, that might be an issue if we had no between-CPU ratio
adjustment,
but otherwise it's just guesstimation, so it's not that important to be
accurate.
>> Also, on such a system, is there any way to determine a relative
>> frequency, even if unreliable or occasionally off?
>
> You can measure it. With cpufreq you have a good guess when you switch
> that the new frequency will have a certain ratio to the old one.
The time periods under consideration are so small (and due to the way
it's used, especially WRT the running average, if the CPU changes
frequencies in mid-calculation, we don't really care about same-CPU
changes, as long as we can usually guess about between-CPU ratios.
>> The deltas here are generally short, always on the same CPU, and
>> can be
>> corrected for changing frequency, assuming that said frequency is
>> available somehow.
>
> The fact the deltas are on the same CPU helps. The shortness of the
> interval doesn't, since on AMD CPUs RDTSC is executed speculatively
> and
> out-of-order, and the order of two close RDTSC instructions isn't
> guaranteed, as far as I remember.
Not exactly that short. There will usually be several hundred
instructions
in between, at _least_, otherwise you'd just use a normal spinlock to
minimize overhead.
>> Ideally it would be some sort of CPU cycle-counter, just so I can say
>> "In between lock and unlock, the CPU did 1000 cycles", for some value
>> of "cycle".
> This may be doable if precision isn't required.
This is a best-guess as to whether the CPU should put the process to
sleep
and go do something else if it can or just poll. If we're wrong either
way it doesn't matter much, we'll effectively default back to the old
dumb behavior.
> RDTSC on older Intel CPUs takes something like 6 cycles. On P4's it
> takes much more, since it's decoded to a microcode MSR access.
Ick! Is there any other kind of fast cycle counter on a P4?
Cheers,
Kyle Moffett
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$
r !y?(-)
------END GEEK CODE BLOCK------
next prev parent reply other threads:[~2005-05-30 18:57 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
2005-05-30 18:04 ` Kyle Moffett
2005-05-30 18:40 ` Vojtech Pavlik
2005-05-30 18:54 ` Kyle Moffett [this message]
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=D051ED6E-5CE3-40AD-99A5-F860B465FCA8@mac.com \
--to=mrmacman_g4@mac.com \
--cc=ak@muc.de \
--cc=cfriesen@nortel.com \
--cc=john.cooper@timesys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.cz \
/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
all inboxes | Powered by JetHome®