public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: William Cohen <wcohen@redhat.com>
To: eranian@hpl.hp.com
Cc: Christoph Hellwig <hch@infradead.org>,
	        "Frank Ch. Eigler" <fche@redhat.com>,
	linux-kernel@vger.kernel.org,
	        systemtap@sources.redhat.com, perfmon@napali.hpl.hp.com
Subject: Re: [perfmon] Re: [PATCH 9/16] 2.6.17-rc6 perfmon2 patch for review:  kernel-level API support (kapi)
Date: Thu, 22 Jun 2006 17:00:00 -0000	[thread overview]
Message-ID: <449ACCC4.8010105@redhat.com> (raw)
In-Reply-To: <20060622121259.GF30281@frankl.hpl.hp.com>

Stephane Eranian wrote:
> Christoph,
> 
> On Fri, Jun 16, 2006 at 04:45:19PM +0100, Christoph Hellwig wrote:
> 
>>On Fri, Jun 16, 2006 at 11:41:32AM -0400, Frank Ch. Eigler wrote:
>>
>>>Whether one uses systemtap, raw kprobes, or some specialized
>>>tracing/stats-collecting patch surely forthcoming, kernel-level APIs
>>>would be needed to perform fine-grained kernel-scope measurements
>>>using these counters.
>>
> You do not need to be in the kernel to measure kernel level
> execution. Monitoring is statistical by nature, this is not about capturing
> execution traces. All PMU models have the capability to filter on privilege
> levels so you can distinguish user from kernel.
> 
> To measure certain functions of the kernel, some PMU models provide a
> way to restrict monitoring to a range of contiguous code addresses, e.g.
> Itanium 2. 

The filtering on privilege level is too coarse. For example want to 
start event counting on entry into a kernel function and stop when 
exiting the function. The itanium hw is not ideal for this application. 
The children functions may not be contiguous with the starting function. 
  Other kinds of predication based on state information, e.g. particular 
process or thread could be very useful.

> The case of systemtap is different. I think they would like to start/stop
> monitoring on certain systemtap events, e.g., a function is called, a
> threshold is met. Start and stop would be triggered from a systemtap
> callback which is implemented by a kernel module, if I understand
> the architecture. In the scenario, the monitoring session would have
> to be created and controlled from the kernel. One could envision an
> architecture, where monitoring would be controlled from user level 
> with systemtap making upcalls  but I do not think this is possible given
> that the instrumentation points can be very low level.
> 
> Another usage for a kernel-level monitoring API that I know about is 
> people who want to explore how to use the performance monitoring
> (and profiles) to guide the scheduler. A thread profile can tell the cache
> hit rates, stalls, bus bandwidth utilization, whether it uses flops and so on.
> This could be useful to to find the best placement for threads and avoid co-scheduling
> threads that trash each other's micro-architectural state or saturate the memory bus.
> In this scenario, one could envision a kernel thread controlling monitoring
> and processing profiles for the scheduler. But, to concur with you Christoph,
> I think this could be achieved from user level and the valuable information
> may be passed to the scheduler via a specific system call for instance.

One probably could configure the performance monitoring hardware from 
userspace. However, for micro-measurement in the kernel it seems like 
the pmu reads in kernel space would still be required.

-Will

      parent reply	other threads:[~2006-06-22 17:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200606150907.k5F97coF008178@frankl.hpl.hp.com>
     [not found] ` <20060616135014.GB12657@infradead.org>
2006-06-16 14:10   ` Stephane Eranian
2006-06-16 14:56     ` Christoph Hellwig
2006-06-17  0:06       ` Alan Cox
2006-06-16 15:41     ` Frank Ch. Eigler
2006-06-16 15:45       ` Christoph Hellwig
2006-06-16 16:18         ` Frank Ch. Eigler
     [not found]         ` <20060622121259.GF30281@frankl.hpl.hp.com>
2006-06-22 17:00           ` William Cohen [this message]

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=449ACCC4.8010105@redhat.com \
    --to=wcohen@redhat.com \
    --cc=eranian@hpl.hp.com \
    --cc=fche@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perfmon@napali.hpl.hp.com \
    --cc=systemtap@sources.redhat.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 read-only IMAP folder(s) and NNTP newsgroup(s).