mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: ak@muc.de, bos@serpentine.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64
Date: 15 May 2004 21:26:40 +0200	[thread overview]
Date: Sat, 15 May 2004 21:26:40 +0200	[thread overview]
Message-ID: <20040515192640.GB5748@colin2.muc.de> (raw)
In-Reply-To: <200405151444.i4FEiDkK001433@harpo.it.uu.se>

On Sat, May 15, 2004 at 04:44:13PM +0200, Mikael Pettersson wrote:
> On Sat, 15 May 2004 11:09:11 +0200, Andi Kleen wrote:
> >> entail; just look at the horrendous mess that is the P4 performance
> >> counter event selector.
> >
> >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.
> 
> The NMI watchdog uses a simple static mapping. No problem there.

So how do you prevent your user applications from overwriting
the single perfctr the watchdog uses?

I actually wrote some monitoring applications that changed perfctrs
from user space in the past (using /dev/msr), but I always wanted
to get rid of the adhoc hacks I had to do to detect interaction with the 
watchdog and replace them with a real mechanism.

> User-space needs to know about it anyway. For instance, unless
> you understand the HW constraints, you may try to enable mutually
> exclusive events. Some events may be unconstrained, but you need
> to know about the constrained ones before you assign the
> unconstrained ones. And user-space must know the mapping anyway
> for the RDPMC instruction.

Sure, but it could still ask the kernel if it's available, no?

> 
> The kernel, in the case of both perfctr and oprofile, needs to be
> informed of the mapping, but it has no real reason to compute it
> itself -- especially not on a complex machine like the P4.

It needs some way to veto a mapping when the counter is already
used for something.

> We don't put an abstract floating-point module in the kernel,
> charging it with choosing x87, 3dnow!, or sse code, and
> performing register allocation, do we?

Bad analogy.  The kernel switches the FP state and each process
has its own and does not impact any other processes.

It would be needed if the kernel used e.g. XMM0 for something
without hiding it from the user (like the NMI watchdog does), but 
that's not the case.

-AndI

  reply	other threads:[~2004-05-15 19:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-15 14:44 Mikael Pettersson
2004-05-15 19:26 ` Andi Kleen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-05-16  9:58 Mikael Pettersson
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
     [not found] <1VLRr-38z-19@gated-at.bofh.it>
2004-05-14 15:14 ` 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
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=20040515192640.GB5748@colin2.muc.de \
    --to=ak@muc.de \
    --cc=bos@serpentine.com \
    --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

all inboxes | Powered by JetHome®