mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Stephane Eranian <eranian@hpl.hp.com>
Cc: Andi Kleen <ak@suse.de>, 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: Tue, 29 Nov 2005 23:51:55 +0100	[thread overview]
Message-ID: <20051129225155.GT19515@wotan.suse.de> (raw)
In-Reply-To: <20051129221915.GA6953@frankl.hpl.hp.com>

On Tue, Nov 29, 2005 at 02:19:15PM -0800, Stephane Eranian wrote:
> Andi,
> 
> On Tue, Nov 29, 2005 at 10:52:07PM +0100, Andi Kleen wrote:
> > On Tue, Nov 29, 2005 at 01:43:11PM -0800, Nicholas Miell wrote:
> > > On Tue, 2005-11-29 at 19:13 +0100, Andi Kleen wrote:
> > > > > Where did you see that PMC0 (PERSEL0/PERFCTR0) can only be programmed
> > > > > to count cpu cycles (i.e. cpu_clk_unhalted)? As far as I can tell from
> > > > > the documentation, the 4 counters are symetrical and can measure
> > > > > any event that the processor offers.
> > > > 
> > > > Linux NMI watchdog does that.
> > > > 
> > > > All other perfctr users are supposed to keep their fingers away 
> > > > from the watchdog (it looks like oprofile doesn't but not for much
> > > > longer ...) 
> > > 
> > > Why? Hardcoding PMC 0 to be a cycle counter seems to be a waste of a
> > > perfectly usable performance counter. What if I want to profile four
> > > things, none of them requiring a cycle count?
> > 
> 
> On AMD you only have 4 counters. That's not a lot for some measurements.

Disabling the NMI watchdog for that is out of question. It's a important
debugging device and without it kernel bug reports are much worse.
It increased the quality of x86-64 bug reports over the years
considerably and I'm unwilling to give that up.

I didn't realize oprofile did this so far, but I plan to definitely 
fix this.

> The other thing is that PERCTR0 is not like the TSC. It can count cycles
> but it does only implement 47bits. At a high clock rate, this can wrap
> around fairly rapidly. It all depends on what is the intended usage model.

TSC also doesn't count cycles in many circumstances (different frequency 
depending on P states or not synchronized over CPUs, even running
at completely different frequencies etc.) 

> Suppose you would have a "stable" performance monitoring interface.

Then you don't use TSC because it's not stable (or conversely
too stable for many performance measurements because it doesn't
follow the P states) 

> One could just use that interface to measure time only when needed.

Good debugging infrastructure has priority imho - and NMI watchdog
is important. You will need to live with three counters.

This means there is one alternative - some of the newer chipsets
have external watchdogs that could be also used (using the ACPI WDOG
table).  If someone writes a nice NMI driver for these then on system
with working WDOG it could replace the perfctr based timeout and free
the perfctr. That would need some code to allocate and deallocate
perfctrs though.

The older IOAPIC watchdog is no alternative because it runs too often (at HZ) 
and has too much overhead.

-Andi


  reply	other threads:[~2005-11-29 22:51 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             ` Andi Kleen [this message]
2005-11-30 16:01               ` [discuss] " Stephane Eranian
2005-11-30 16:23                 ` Andi Kleen
2005-12-01 23:41                   ` Stephane Eranian
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=20051129225155.GT19515@wotan.suse.de \
    --to=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=eranian@hpl.hp.com \
    --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

all inboxes | Powered by JetHome®