linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Cohen <wcohen@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Stephane Eranian <eranian@hpl.hp.com>,
	Philip Mucci <mucci@cs.utk.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg KH <gregkh@suse.de>, Robert Richter <robert.richter@amd.com>,
	linux-kernel@vger.kernel.org
Subject: Re: perfmon2 merge news
Date: Fri, 16 Nov 2007 12:13:07 -0500	[thread overview]
Message-ID: <473DCFA3.3020203@redhat.com> (raw)
In-Reply-To: <20071116162813.GA29644@one.firstfloor.org>

Andi Kleen wrote:
> On Fri, Nov 16, 2007 at 08:00:56AM -0800, Stephane Eranian wrote:
>> No, he is talking about something similar to what was in perfctr.
>> The kernel emulates 64-bit counters in software and that is you
>> get back when you read the counters. If you read via RDPMC, you
>> get 40 bits. To reconstruct the full 64-bit value from user land
>> you need the upper bits. One approach is for the kernel to allow
>> you to remap a page that has the 64-bit (software) counters. With
>> that and a bit of mask/shifting you can reconstruct the full value.
> 
> You mean the page contains the upper [40;63] bits? 
> 
> Sounds reasonable, although I don't remember seeing that when I looked
> at the perfmon code last.

Upper 32-bit ([32:63]). On many implementations the only lower 32-bit are 
available in the register. the 32:40 bits in several processor implementation of 
x86 processors can not be set to bit outside of sign extension of bit 32. On 
other processor implementations the event counters are only 32-bit in width.

> 
>>> I'm considering that an essential feature too. I wasn't aware
>>> it was dropped.
>>>
>> What I dropped is the cr4.pce enabled for self-monitoring sessions.
> 
> That sounds bad.
> 
>> Perfmon2 allows you to have an in-kernel sampling buffer. The idea is
> 
> ... you also didn't say *why* that is needed.
> 
> Can you give a concrete use case for something that cannot be done
> without custom buffer formats? 
> 
>> Using this mechanism, for instance, we were able to connect the
>> Oprofile kernel code to perfmon2 on Itanium with a 100 lines of
>> code. The exact same approach would also work on X86 Oprofile as well.
> 
> The existing oprofile code works already fine on x86, no real
> need for another one.

OProfile is very useful in many cases, but it only perform sampling. If one want 
to take a look at the number events a specific section of code causes, one can't 
really do that with oprofile. The counters are running systemwide, not per 
thread. For some experiments developers really like to have per thread counters.

The rewrite of oprofile to use the perfmon code was to consolidate code using 
the performance monitoring hardware. Use one interface for accessing the 
performance monitoring hardware rather than have one for sampling and another 
for virtualizing the counters on a per thread basis.

>>> e.g. PEBS and so on pretty much fix the in memory sample format in hardware,
>>> so they only way to get a custom format would be to use a separate buffer.
>>>
>> This is also how we support PEBS because, as you said, the format of the
>> samples is not under your control. if you want zero-copy PEBS support,
>> you have to follow the PEBS format.
> 
> Exactly that makes the support for random custom buffers questionable.
> 
> e.g. as I can see the main advantage of perfmon over existing setups
> is that it support PEBS etc., but with your custom buffer formats which
> are by definition incompatible with PEBS you would negate that advantage
> again.
> 
> Ok IBS will probably need some special handling.
> 
>> Yes, you could do that without changing the core implementation of
>> perfmon2.
> 
> Why this insistence against changing anything?
> 
> -Andi

So the alternative approach is to write a new device driver for each of the new 
performance monitoring mechanisms, e.g. one for PEBS and another for IBS?

One of the reason for the custom sample buffers was to avoid having an expensive 
user-space signal for a process to record some simple pieces of data each time 
the data becomes available. For the oprofile port to the perfmon2 custom buffer 
  mechanism the instruction pointer and the counter that overflowed are 
recorded. The buffer can be processed in one large chunk by userspace, reducing 
overhead. In essence the current implementation of OProfile in the mainline 
kernels has a custom buffer mechanism.

-Will


  reply	other threads:[~2007-11-16 17:18 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07  0:34 [PATCH] fix up perfmon to build on -mm Greg KH
2007-11-07 10:34 ` Stephane Eranian
2007-11-07 17:07   ` Greg KH
2007-11-07 13:42 ` Stephane Eranian
2007-11-07 17:08   ` Greg KH
2007-11-07 17:33     ` Andrew Morton
2007-11-07 17:41       ` Greg KH
2007-11-07 17:50     ` Stephane Eranian
2007-11-07 17:47   ` Greg KH
2007-11-07 17:57     ` Stephane Eranian
2007-11-07 19:53       ` Greg KH
2007-11-07 20:39         ` Stephane Eranian
2007-11-08 15:27         ` Stephane Eranian
2007-11-09 20:06 ` Andrew Morton
2007-11-09 21:38   ` Greg KH
2007-11-10 20:32     ` Andi Kleen
2007-11-13 15:17       ` perfmon2 merge news Robert Richter
2007-11-13 15:35         ` [perfmon2] " William Cohen
2007-11-13 17:55           ` Stephane Eranian
2007-11-13 18:33             ` [perfmon] " William Cohen
2007-11-13 21:13               ` Stephane Eranian
2007-11-13 21:29                 ` Andi Kleen
2007-11-13 21:46                   ` Stephane Eranian
2007-11-13 21:50                     ` Andi Kleen
2007-11-13 22:22                       ` Stephane Eranian
2007-11-13 22:25                         ` Andi Kleen
2007-11-13 22:58                           ` Stephane Eranian
2007-11-14  2:07                             ` Andi Kleen
2007-11-14 13:09                               ` Stephane Eranian
2007-11-14 14:24                                 ` Andi Kleen
2007-11-14 15:44                                   ` William Cohen
2007-11-14 16:13                                     ` Stephane Eranian
2007-11-14 18:53                                     ` Philippe Elie
2007-11-14 19:15                                       ` Andi Kleen
2007-11-15  0:07                                   ` Stephane Eranian
2007-11-13 18:47             ` Philip Mucci
2007-11-13 18:59               ` Greg KH
2007-11-13 20:07                 ` Andrew Morton
2007-11-13 20:14                   ` Greg KH
2007-11-13 20:36                   ` Andi Kleen
2007-11-14  0:28                     ` Philip Mucci
2007-11-14  1:52                       ` Andi Kleen
2007-11-16  9:18                         ` Philip Mucci
2007-11-16 15:15                           ` Andi Kleen
2007-11-16 16:00                             ` Stephane Eranian
2007-11-16 16:28                               ` Andi Kleen
2007-11-16 17:13                                 ` William Cohen [this message]
2007-11-16 21:56                                   ` Stephane Eranian
2007-11-16 17:36                                 ` Stephane Eranian
2007-11-16 17:51                             ` dean gaudet
2007-11-17  0:29                               ` David Miller
2007-11-17  1:07                                 ` Greg KH
2007-11-16 20:16                             ` Philip Mucci
2007-11-17  0:15                             ` David Miller
     [not found]                             ` <1d7226b10711161713j675341b7wdb4f050c59a8be0a@mail.gmail.com>
2007-11-17  1:25                               ` Greg KH
     [not found]                                 ` <1d7226b10711161748n39b7f195q796d85282ef66134@mail.gmail.com>
2007-11-17  2:13                                   ` Greg KH
2007-11-14  7:24                   ` [perfmon] Re: [perfmon2] " Paul Mackerras
2007-11-14  7:40                     ` Andrew Morton
2007-11-14 10:38                     ` Christoph Hellwig
2007-11-14 10:43                       ` Paul Mackerras
2007-11-14 11:00                         ` Christoph Hellwig
2007-11-14 11:12                           ` David Miller
2007-11-14 11:14                             ` David Miller
2007-11-14 11:44                             ` Paul Mackerras
2007-11-13 23:49                               ` Nick Piggin
2007-11-14 11:58                                 ` David Miller
2007-11-14  0:25                                   ` Nick Piggin
2007-11-14 21:30                                     ` Paul Mackerras
2007-11-14 10:17                                       ` Nick Piggin
2007-11-14 22:56                                         ` Chuck Ebbert
2007-11-14 11:03                                           ` Nick Piggin
2007-11-14 11:52                               ` David Miller
2007-11-14 12:03                                 ` Paul Mackerras
2007-11-14 12:07                                   ` David Miller
2007-11-14  0:28                                     ` Nick Piggin
2007-11-14 21:50                                     ` Paul Mackerras
2007-11-14 23:03                                       ` David Miller
2007-11-14 23:12                                         ` Paul Mackerras
2007-11-14 23:21                                           ` David Miller
2007-11-15  1:11                                             ` Paul Mackerras
2007-11-15  1:27                                               ` David Miller
2007-11-15  2:34                                                 ` Paul Mackerras
2007-11-15  7:48                                                   ` Herbert Xu
2007-11-15  8:19                                                     ` Andi Kleen
2007-11-19 13:08                                                 ` David Miller
2007-11-19 20:53                                                   ` Stephane Eranian
2007-11-20  0:55                                                     ` David Miller
2007-11-19 21:43                                                   ` Paul Mackerras
2007-11-19 22:48                                                     ` Stephane Eranian
2007-11-20  0:53                                                       ` David Miller
2007-12-13 16:00                                                         ` Stephane Eranian
2007-12-14 19:12                                                           ` Frank Ch. Eigler
2007-12-14 21:07                                                             ` Stephane Eranian
2007-12-15 15:54                                                               ` Frank Ch. Eigler
2007-11-15  8:29                                               ` [perfmon] " Stephane Eranian
2007-11-14 13:51                               ` Stephane Eranian
2007-11-14 11:39                           ` Paul Mackerras
2007-11-14 11:52                             ` David Miller
2007-11-14 13:47                             ` Stephane Eranian
2007-11-14 12:38                           ` Andi Kleen
2007-11-14 14:13                             ` Stephane Eranian
2007-11-14 14:26                               ` Andi Kleen
2007-11-15  0:23                                 ` Paul Mackerras
2007-11-14 19:48                             ` David Miller
2007-11-15  4:20                             ` dean gaudet
2007-11-15  4:47                               ` Paul Mackerras
2007-11-15  5:14                                 ` dean gaudet
2007-11-15  8:53                               ` Stephane Eranian
2007-11-15 17:01                               ` [perfmon2] [perfmon] " Dan Terpstra
2007-11-13 21:33                 ` [perfmon] Re: [perfmon2] " Stephane Eranian
2007-11-13 21:45                   ` Greg KH
2007-11-13 22:27               ` Christoph Hellwig
2007-11-13 20:42           ` Andi Kleen
2007-11-13 18:32         ` Stephane Eranian
2007-11-13 22:29           ` Christoph Hellwig
2007-11-16 18:25           ` PMC core internal API design Mathieu Desnoyers
2007-11-17 17:19 perfmon2 merge news Patrick DEMICHEL
2007-11-18  0:35 ` David Miller

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=473DCFA3.3020203@redhat.com \
    --to=wcohen@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=eranian@hpl.hp.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mucci@cs.utk.edu \
    --cc=robert.richter@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;
as well as URLs for NNTP newsgroup(s).