From: Andi Kleen <andi@firstfloor.org>
To: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Andi Kleen <andi@firstfloor.org>,
Thomas Gleixner <tglx@linutronix.de>,
Arjan van de Ven <arjan@infradead.org>,
Venkatesh Pallipadi <venki@google.com>,
Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
chris.mason@oracle.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Export tsc related information in sysfs
Date: Mon, 17 May 2010 18:56:59 +0200 [thread overview]
Message-ID: <20100517165658.GB5947@basil.fritz.box> (raw)
In-Reply-To: <a3572531-ca89-4959-b190-bcb9309a0193@default>
On Mon, May 17, 2010 at 08:23:59AM -0700, Dan Magenheimer wrote:
> will read this long thread and also be convinced never to use
> rdtsc, the problem is there is a high and increasing chance that
> any given systems programmer will write code that uses rdtsc and,
> in all of his/her test machines will NEVER see a problem. But,
It would be probably a good idea to document all this
somewhere central, agreed.
In fact I remember wanting to write such a paper once. Possibly
even with some title borrowing from Swift. It seems it never happened :)
> > From: Andi Kleen [mailto:andi@firstfloor.org]
> > 32bit doesn't have a fast ring 3 gtod() today but that could be also
> > fixed.
>
> That might have helped, because the enterprise app I mentioned
> earlier was 32-bit... but I'll bet the genie is out of the
> bottle now and the app has already shipped using rdtsc.
Well the enterprise will have to live with wrong timing now and then
(or perhaps totally broken timing on some system) then.
> > From: Andi Kleen [mailto:andi@firstfloor.org]
> > It seems to me you're bordering on violating Steinberg's rule
> > of system programming here :-)
>
> <Embarrassed to not know this rule, Dan goes off and googles
> but fails to find any good matches before his TSC goes bad>
Sorry it's Steinbach's rule. Never test for an error condition
you don't know how to handle.
>
> > From: Andi Kleen [mailto:andi@firstfloor.org]
> > First the single instruction is typically quite slow. Then
> > to really get monotonous time you need a barrier anyways.
>
> Agreed, I've measured 30-ish and 60-ish cycles on a
> couple of machines.
It can be worse.
Also for correct behaviour you need the barrier on many systems.
And some other workarounds.
>
> I think vsyscall is an excellent idea and I'm very much in
> favor of continuing to improve it and encouraging people
> to use it. But until it either "always" "just works" in "all"
On 64bit it should just work, although it could be made somewhat
(but not dramatically) faster.
On older kernels vsyscall got a bad name because it was not always
as clever as it could be to chose when to use TSC and when not,
but that is long fixed. It worked in any case, just was slower[1]
[1] That is some specific TSC misbehaviours were only fixed in later
kernels, but it's very unlikely that any other RDTSC user got
that right either.
> > From: Andi Kleen [mailto:andi@firstfloor.org]
> > I don't think that's true. There are various large systems with
> > non synchronized TSC and I haven't heard of any unique cache coherency
> > problems on that.
>
> Here I was referring to clock skew/drift, not the "fixed offset"
> problem. I'm far from an expert in PLL's etc, but I think if
> the clock signal is delayed far enough to cause TSC to skew
> significantly, eventually some critical cache coherency protocol
> is eventually going to miss a beat and screw up and corrupt data.
Generally small systems run on the same clock (and any drift
you see has other reasons), but large systems built out of multiple
boards run on different clocks and the interconnect
does appropiate timing between the different domains for itself.
The interconnects also have checksums and other error checking
and recovery mechanisms and tend to do something appropiate when there
is a transmission problem. It does not usually lead to data corruption.
> I believe (and this is strictly a personal opinion based on my
> view of human psychology) that adding more obscure interfaces and
> more obscure options is a losing battle.
It sounds like you're arguing against your own patch here.
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
next prev parent reply other threads:[~2010-05-17 16:57 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-15 1:40 Venkatesh Pallipadi
2010-05-15 9:57 ` Andi Kleen
2010-05-15 13:29 ` Dan Magenheimer
2010-05-15 16:48 ` Venkatesh Pallipadi
2010-05-15 19:14 ` Arjan van de Ven
2010-05-15 22:32 ` Dan Magenheimer
2010-05-16 5:43 ` Arjan van de Ven
2010-05-16 9:20 ` Thomas Gleixner
2010-05-16 16:42 ` Dan Magenheimer
2010-05-16 19:14 ` Thomas Gleixner
2010-05-17 1:31 ` Dan Magenheimer
2010-05-17 5:06 ` Arjan van de Ven
2010-05-18 9:58 ` Peter Zijlstra
2010-05-18 10:03 ` Peter Zijlstra
2010-05-18 11:25 ` Andi Kleen
2010-05-18 11:58 ` Peter Zijlstra
2010-05-18 15:13 ` Dan Magenheimer
2010-05-18 16:40 ` H. Peter Anvin
2010-05-18 16:52 ` Peter Zijlstra
2010-05-18 17:04 ` H. Peter Anvin
2010-05-18 17:49 ` Dan Magenheimer
2010-05-18 18:46 ` H. Peter Anvin
2010-05-18 19:00 ` Dan Magenheimer
2010-05-18 19:16 ` Dan Magenheimer
2010-05-18 19:26 ` H. Peter Anvin
2010-05-18 20:29 ` Dan Magenheimer
2010-05-18 20:34 ` H. Peter Anvin
2010-05-18 21:02 ` Dan Magenheimer
2010-05-18 21:13 ` Andi Kleen
2010-05-19 6:26 ` Peter Zijlstra
2010-05-17 10:20 ` Thomas Gleixner
2010-05-16 20:29 ` Arjan van de Ven
2010-05-17 10:26 ` Andi Kleen
2010-06-04 14:24 ` Pavel Machek
2010-05-15 22:45 ` Thomas Gleixner
2010-05-17 10:22 ` Andi Kleen
2010-05-17 15:23 ` Dan Magenheimer
2010-05-17 16:56 ` Andi Kleen [this message]
2010-05-17 22:36 ` Thomas Gleixner
2010-05-17 23:33 ` Dan Magenheimer
2010-05-18 0:00 ` Ingo Molnar
2010-05-18 0:02 ` Ingo Molnar
2010-05-15 12:35 ` Jaswinder Singh Rajput
2010-05-15 14:37 ` Venkatesh Pallipadi
2010-05-20 19:19 Brian Bloniarz
2010-05-22 2:03 ` john stultz
2010-05-22 3:33 ` H. Peter Anvin
2010-05-24 18:13 ` Dan Magenheimer
2010-05-24 18:19 ` H. Peter Anvin
2010-05-24 18:51 ` john stultz
2010-05-24 20:20 ` H. Peter Anvin
2010-05-24 20:39 ` john stultz
2010-05-24 21:26 ` H. Peter Anvin
2010-05-24 22:04 ` Dan Magenheimer
2010-05-24 22:30 ` H. Peter Anvin
2010-05-24 22:49 ` john stultz
2010-05-24 23:16 ` Dan Magenheimer
2010-05-24 23:19 ` H. Peter Anvin
2010-05-24 23:30 ` john stultz
2010-05-24 23:42 ` Andi Kleen
2010-05-25 0:01 ` Dan Magenheimer
2010-05-25 0:07 ` H. Peter Anvin
2010-05-25 1:33 ` Brian Bloniarz
2010-05-26 0:16 ` Brian Bloniarz
2010-05-26 0:48 ` john stultz
2010-05-26 2:50 ` Brian Bloniarz
2010-05-26 12:35 ` Thomas Gleixner
2010-05-26 14:26 ` Dan Magenheimer
2010-05-26 14:41 ` Thomas Gleixner
2010-05-26 15:04 ` john stultz
2010-05-26 16:02 ` Brian Bloniarz
2010-05-26 16:25 ` john stultz
2010-05-26 18:24 ` H. Peter Anvin
2010-05-26 18:44 ` Brian Bloniarz
2010-05-26 18:51 ` H. Peter Anvin
2010-05-26 20:19 ` john stultz
2010-05-26 21:06 ` H. Peter Anvin
2010-05-26 19:49 ` john stultz
2010-05-26 20:22 ` Brian Bloniarz
2010-05-26 12:30 ` Thomas Gleixner
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=20100517165658.GB5947@basil.fritz.box \
--to=andi@firstfloor.org \
--cc=arjan@infradead.org \
--cc=chris.mason@oracle.com \
--cc=dan.magenheimer@oracle.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=venki@google.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
all inboxes | Powered by JetHome®