public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bryan O'Sullivan" <bos@serpentine.com>
To: Andi Kleen <ak@muc.de>
Cc: Mikael Pettersson <mikpe@csd.uu.se>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64
Date: Sat, 15 May 2004 21:15:54 -0700	[thread overview]
Message-ID: <1084680953.11976.27.camel@camp4.serpentine.com> (raw)
In-Reply-To: <20040515090911.GA21406@colin2.muc.de>

On Sat, 2004-05-15 at 02:09, Andi Kleen wrote:

> > That's currently handled in user space, by PAPI (which sits on top of
> > perfctr).  One reason *not* to do it in the kernel is the bloat it would
> 
> That's clearly the wrong place to do it.

I can see both sides.  The perfctr driver already sanity-checks the
event selectors to make sure they're not set to anything malicious; this
is the very least it must do.

The next step up from that is allocating real performance counters
properly, but this requires quite a bit of work.  For example, you need
to know what the asymmetries in a particular CPU's counters are, so you
can tell which counter can handle the events being requested - this
varies from perfectly symmetrical (K7 and K8) through slightly odd (P3
and PM) to completely insane (P4).

After that, perhaps you start thinking about abstracting the notions of
what you're counting.  Different CPUs provide radically different ways
of counting roughly the same thing.  The event selectors for counting
instructions retired differ between AMD and P3, and between P3 and P4,
but they can all count this kind of event.  More primitive CPUs can't.

Beyond that, it is possible - and in some cases desirable - to, for
example, time-slice the real performance counters so that you could get
a somewhat representative sample of everything you wanted, assuming the
CPU could count it in the first place.  The Irix kernel does this.

Where would you draw the line?

Oh, I forgot to mention IA64 and SPARC64's incompatible performance
counter APIs :-)

> There is no way around that - there are kernel users (like the
> nmi watchdog or oprofile) and kernel users cannot be made dependent 
> on user space modules.

There's no kernel-to-user dependency.

	<b


  reply	other threads:[~2004-05-16  4:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1VLRr-38z-19@gated-at.bofh.it>
2004-05-14 15:14 ` [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64 Andi Kleen
2004-05-15  5:37   ` Bryan O'Sullivan
2004-05-15  9:09     ` Andi Kleen
2004-05-16  4:15       ` Bryan O'Sullivan [this message]
2004-05-16  9:58 Mikael Pettersson
  -- strict thread matches above, loose matches on Subject: below --
2004-05-15 14:44 Mikael Pettersson
2004-05-15 19:26 ` Andi Kleen
2004-05-15 14:42 Mikael Pettersson
2004-05-15 19:16 ` Andi Kleen
2004-05-15 20:40   ` John Reiser
2004-05-15 20:49     ` Andi Kleen
2004-05-14 14:11 Mikael Pettersson

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=1084680953.11976.27.camel@camp4.serpentine.com \
    --to=bos@serpentine.com \
    --cc=ak@muc.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    /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