public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH/RFC 1/2] perfcounters: provide a way to read the current value of interrupting counters
Date: Tue, 17 Mar 2009 08:32:49 +0100	[thread overview]
Message-ID: <1237275169.5189.58.camel@laptop> (raw)
In-Reply-To: <18879.14425.221429.861838@drongo.ozlabs.ibm.com>

On Tue, 2009-03-17 at 16:42 +1100, Paul Mackerras wrote:
> Impact: new feature
> 
> At present, if the user specifies hw_event->record_type ==
> PERF_RECORD_IRQ or PERF_RECORD_GROUP when creating a counter, reads from
> the counter will return records from the interrupt event queue for the
> counter.  This means that there is no way to find out the current value
> of the counter.  Also, using the record_type is slightly problematic in
> that what actually determines whether the counter generates interrupts
> is whether hw_event->irq_period is non-zero or not.

I've never found that to be a problem, I've always read PERF_RECORD_IRQ
as PERF_RECORD_SINGLE or somesuch in that it will give a single counter
output, as opposed to PERF_RECORD_GROUP which will give a tuple.

> This provides a way for users to get a second fd for an interrupting
> counter, which has a different set of file operations, set up so that
> reads on the second (or "clone") fd return the counter value rather than
> reading the interrupt event queue.  The way to get the clone fd is like
> this:
> 
> 	clone_fd = sys_perf_counter_open(NULL, 0, 0, counter_fd, 0);

I'm not sure I understand why. It seems to me you're either interested
in sample data, that is {tid,ip,counter} like things, or you want raw
count values.

These two cases seem clearly distinct and provided for. Why are you
mixing them?

> This will enable us to use a wider range of values in record_type in
> future, allowing the user to specify what information they want recorded
> on an interrupt.

This seems unrelated, what will stop us now from adding record_type
values? PERF_RECORD_CALLCHAIN is one in particular I'd like to add soon.

> Internally, we now potentially have multiple struct files pointing to
> the one struct counter, which could lead to lifetime issues.  We avoid
> any such issues by having the clone files keep a reference to the
> original file.  The reference is dropped when the clone file is closed.
> Thus the original file can never be released while there is any clone
> file still open.

This is a bit bothersome, as we then have no unique identifier anymore.

Currently the group record type writes things like {hw_event->type,
counter} which is ambiguous since we really have a 65bit id space. So I
was thinking of making that {fd, counter} to at least have a unique
identifier in there.




  reply	other threads:[~2009-03-17  7:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17  5:42 [PATCH/RFC 1/2] perfcounters: provide a way to read the current value of interrupting counters Paul Mackerras
2009-03-17  7:32 ` Peter Zijlstra [this message]
2009-03-17  7:47   ` Paul Mackerras
2009-03-17  8:37     ` Peter Zijlstra
2009-03-17  9:17       ` Paul Mackerras
2009-03-19 19:31         ` Corey Ashford

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=1237275169.5189.58.camel@laptop \
    --to=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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