From: Mark Hounschell <markh@compro.net>
To: markh@compro.net
Cc: Arjan van de Ven <arjan@infradead.org>,
"linux-os (Dick Johnson)" <linux-os@analogic.com>,
Jan Engelhardt <jengelh@medozas.de>,
"Kok, Auke" <auke-jan.h.kok@intel.com>,
"solsTiCe d'Hiver" <solstice.dhiver@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: no cpu MHz in /proc/cpuinfo on 2.6.25.4-rt6
Date: Wed, 11 Jun 2008 16:37:38 -0400 [thread overview]
Message-ID: <48503792.50003@compro.net> (raw)
In-Reply-To: <48501159.4050908@compro.net>
Mark Hounschell wrote:
> Arjan van de Ven wrote:
>> On Wed, 11 Jun 2008 12:59:24 -0400
>> Mark Hounschell <markh@compro.net> wrote:
>>
>>> Arjan van de Ven wrote:
>>>> On Wed, 11 Jun 2008 10:14:50 -0400
>>>> "linux-os (Dick Johnson)" <linux-os@analogic.com> wrote:
>>>>
>>>>> I use CPU frequency to scale the output of rdtsc when timing
>>>>> routines being optimized.
>>>> Ok this is broken in various really bad ways.
>>>>
>>>> 1) CPU frequency is very fluctuating, it changes in principle every
>>>> millisecond or more
>>> I'm curious. What do you mean by "in principle"? And why will it
>>> change?
>> ondemand governor will change the cpu frequency dynamically all the
>> time.
>> the cpu itself has a dynamic range in which it operates (at least on
>> cpus that support Intel Dynamic Acceleration technology, IDA)
>>
>
> OK. If I am always using AMD Opteron/X64 class machines am I safe here
> when no cpu freq scaling stuff is on and I'm pinned to a particular processor?
>
>>>> 2) the rdtsc "frequency" is conceptually unrelated to cpu
>>>> frequency. In fact, you'll be hard-pressed to buy a system today
>>>> where this relationship works....
>>>>
>>> And what do you mean by "conceptually unrelated to cpu frequency"?
>>> Is it not the clock freq that is driving the cpu and the freq at which
>>> the tsc is incremented?
>> no it is not that... at all.
>> the tsc comes from an entirely different clock, and on anything you can
>> buy today from AMD or Intel (or the last year for that matter), it's
>> fixed frequency (except in idle) irrespective of the frequency the CPU
>> is operating at!
>> it's a "time stamp counter" not a "cpu cycle counter". You can run
>> instructions faster than the tsc increment or slower. Or sometimes at
>> the same rate.
>> Which it is depends on what cpufreq/ondemand are doing and how active
>> IDA is.
>>
>
> I was under the impression that it was the same clock on AMD Opteron and
> newer processors.
>
> So if all this is true how and why can the kernel use it but user land is wrong
> for doing so?
>
> Mark
>
Ok, what would one use besides the tsc to take a fast high-res time stamp in a kernel module that
could also be used in user land (same time source) to for instance calculate the
the time between an event in the kernel to an event in user land?
do_gettimeofday / gettimeofday are not really acceptable.
Mark
next prev parent reply other threads:[~2008-06-11 20:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-10 19:52 PROBLEM: no cpu MHz in /proc/cpuinfo on 2.6.25.4-rt6 solsTiCe d'Hiver
2008-06-10 20:13 ` Arjan van de Ven
2008-06-10 20:42 ` Kok, Auke
2008-06-11 12:42 ` Jan Engelhardt
2008-06-11 13:36 ` Arjan van de Ven
2008-06-11 13:52 ` Jan Engelhardt
2008-06-11 13:58 ` Arjan van de Ven
2008-06-11 14:14 ` linux-os (Dick Johnson)
2008-06-11 15:10 ` Peter Zijlstra
2008-06-11 15:36 ` Arjan van de Ven
2008-06-11 16:59 ` Mark Hounschell
2008-06-11 17:44 ` Arjan van de Ven
2008-06-11 17:54 ` Mark Hounschell
2008-06-11 20:29 ` Arjan van de Ven
2008-06-11 20:37 ` Mark Hounschell [this message]
2008-06-11 20:55 ` Arjan van de Ven
2008-06-11 20:59 ` Mark Hounschell
2008-06-11 20:58 ` Arjan van de Ven
2008-06-11 21:08 ` Mark Hounschell
2008-06-11 21:28 ` Arjan van de Ven
2008-06-11 21:39 ` Chris Friesen
2008-06-11 23:08 ` Andi Kleen
2008-06-11 16:08 ` Ray Lee
2008-06-11 16:32 ` Arjan van de Ven
2008-06-11 12:40 ` Jan Engelhardt
2008-06-11 14:15 ` solsTiCe d'Hiver
2008-06-11 14:36 ` Jan Engelhardt
2008-06-11 15:35 ` solsTiCe d'Hiver
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=48503792.50003@compro.net \
--to=markh@compro.net \
--cc=arjan@infradead.org \
--cc=auke-jan.h.kok@intel.com \
--cc=jengelh@medozas.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=solstice.dhiver@gmail.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;
as well as URLs for NNTP newsgroup(s).