mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@hpl.hp.com>
To: Andi Kleen <ak@suse.de>
Cc: Nicholas Miell <nmiell@comcast.net>,
	Ray Bryant <raybry@mpdtxmail.amd.com>,
	discuss@x86-64.org, linux-kernel@vger.kernel.org,
	perfctr-devel@lists.sourceforge.net
Subject: Re: [discuss] Re: [Perfctr-devel] Re: Enabling RDPMC in user space by default
Date: Thu, 1 Dec 2005 15:41:50 -0800	[thread overview]
Message-ID: <20051201234150.GE3291@frankl.hpl.hp.com> (raw)
In-Reply-To: <20051130162314.GP19515@wotan.suse.de>

Andi,

On Wed, Nov 30, 2005 at 05:23:15PM +0100, Andi Kleen wrote:
> > to count elapsed cycles while executing a ring 0 and ring 3. The watchdog
> > works by polling on the counter and after a certain delta is reached it
> > triggers an NMI interrupt which, in turn, causes a kernel crash and the
> > (bug) report. Is that the correct behavior?
> 
> The watchdog is driven by the performance counter (this means
> it has varying frequency, but that's not a big issue for the watchdog) 
> 
> It underflows every second in the fastest case or very slowly
> (if the machine is idle). Every time it underflows it checks if 
> the per CPU timer has been ticking, and if it hasn't for some time
> it triggers an oops.

How is the checking for underflows done? Polling?

> 
> The obvious solution would be to set an underflow interrupt at 2^46 or so
> and then reset the counters. For that you would need to count down though.
> 
> > 
> > Also are you sure that the PERFCTR0/PERFSEL0 are not affected when going
> > into lower power state? I know by experience that one IA-64, for instance,
> > the counters are seriously affected.
> 
> They stop ticking in idle. Yes, that's ok if you just want to measure
> cycles because there are no cycles in idle.
> 
Ok that makes sense.

> It's not ok for timing (wall clock time) purposes, but it's also not
> intended for that. If you want time use gettimeofday
> 
I agree.

> They will also clock slower if the CPU is in a P state (runs with lower
> frequency), but for measurements that's also wanted and expected I believe.
> e.g with RDTSC on Intel right now if you are in a lower P state you will
> get wrong results.
> 
> Basically it's a good cycle timer for instruction measurements and
> nothing more.

Yes, it requires pinning and also that nothing else can run
on the processor. This is very restrictive and I wonder if
this is really useable?

> Not ticking in idle actually helps with that because it makes
> it totally clear to everybody that it's not a wall clock :)
> 
Yes, except that this is silently done. There needs to be a
STRONG warning about this somewhere.

> > As Ray mentioned, it all depends on what the user/sysdamin is after.
> > Some people maybe okay with disbaling NMI in favor of more counters.
> > Obviously others people are not.
> 
> I cannot stop them from hacking the kernel, but I don't think
> I will make it easy for them to do this in a stock kernel
> (or at least not until they provide an reliable alternative watchdog
> time source) 
> 

-- 

-Stephane

  reply	other threads:[~2005-12-02  0:04 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-29 15:15 Andi Kleen
2005-11-29 16:04 ` Mikael Pettersson
2005-11-29 16:17   ` Andi Kleen
2005-11-29 16:56 ` Ray Bryant
2005-11-29 16:15   ` Andi Kleen
2005-11-29 18:09   ` [Perfctr-devel] " Stephane Eranian
2005-11-29 18:13     ` Andi Kleen
2005-11-29 18:29       ` John Reiser
2005-11-29 18:38         ` Andi Kleen
2005-11-29 19:05         ` Lee Revell
2005-11-29 21:43       ` Nicholas Miell
2005-11-29 21:52         ` Andi Kleen
2005-11-29 22:19           ` Stephane Eranian
2005-11-29 22:51             ` [discuss] " Andi Kleen
2005-11-30 16:01               ` Stephane Eranian
2005-11-30 16:23                 ` Andi Kleen
2005-12-01 23:41                   ` Stephane Eranian [this message]
2005-12-02  0:07                     ` Andi Kleen
2005-12-02  7:09                       ` Stephane Eranian
2005-12-02 11:36                         ` Andi Kleen
2005-11-29 22:33           ` Nicholas Miell
2005-11-29 22:43             ` Andi Kleen
2005-11-29 23:02               ` Nicholas Miell
2005-11-29 23:17                 ` Andi Kleen
2005-11-29 23:29                   ` Nicholas Miell
2005-11-29 23:39                     ` Andi Kleen
2005-11-29 23:56                       ` David Gibson
2005-11-30  0:34                         ` Andi Kleen
2005-11-30  0:52                           ` David Gibson
2005-11-30  1:04                             ` [discuss] " Andi Kleen
2005-11-30  0:50                       ` Ray Bryant
2005-11-30  0:38                         ` Andi Kleen
2005-11-30  7:38                     ` Stephane Eranian
2005-11-30  8:22                       ` Nicholas Miell
2005-11-30 15:48                         ` Stephane Eranian
2005-11-29 23:07               ` David Gibson
2005-11-29 23:18                 ` [discuss] " Andi Kleen
2005-11-29 23:28               ` Bernd Schmidt
2005-11-29 23:46                 ` [discuss] " Andi Kleen
2005-11-30  2:39 ` Zwane Mwaikambo
2005-11-30  3:38   ` Andi Kleen
2005-12-01  4:08     ` Zwane Mwaikambo
2005-12-01 13:05       ` Andi Kleen
2005-12-01 17:01         ` Zwane Mwaikambo

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=20051201234150.GE3291@frankl.hpl.hp.com \
    --to=eranian@hpl.hp.com \
    --cc=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nmiell@comcast.net \
    --cc=perfctr-devel@lists.sourceforge.net \
    --cc=raybry@mpdtxmail.amd.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

Powered by JetHome