public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Kan Liang <kan.liang@intel.com>,
	mingo@kernel.org, eranian@google.com, andi@firstfloor.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V8 7/8] perf, x86: introduce PERF_RECORD_LOST_SAMPLES
Date: Thu, 7 May 2015 17:01:15 -0300	[thread overview]
Message-ID: <20150507200114.GG7862@kernel.org> (raw)
In-Reply-To: <20150507173750.GB27504@twins.programming.kicks-ass.net>

Em Thu, May 07, 2015 at 07:37:50PM +0200, Peter Zijlstra escreveu:
> On Thu, May 07, 2015 at 01:22:23PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, May 07, 2015 at 04:39:39PM +0200, Peter Zijlstra escreveu:
> > > On Thu, May 07, 2015 at 11:15:20AM -0300, Arnaldo Carvalho de Melo wrote:
> > > > Em Thu, May 07, 2015 at 01:54:46PM +0200, Peter Zijlstra escreveu:
> > > > > On Thu, May 07, 2015 at 01:35:24PM +0200, Peter Zijlstra wrote:
> > > > > > 
> > > > > >  - dropped the @id field from the record, it is already included in the
> > > > > >    @sample_id values.
> > > > > 
> > > > > Hmm, this would force people to use sample_id; which in general is a
> > > > > good idea, but should we really force that on people?
> > > > 
> > > > Well, if there are more than one sample, we need it, right? If there is
> > > > just one, we don't need it, what is different? Am I needing (even more)
> > > > coffee?
> > > > 
> > > > /me goes read some code...
> > > 
> > > So the question was, do we do:
> > > 
> > > 	/*
> > > 	 * struct {
> > > 	 *	struct perf_event_header	header;
> > > 	 *	u64				id;
> > > 	 *	u64				lost;
> > > 	 *	struct sample_id		sample_id;
> > > 	 * };
> > > 	 */
> > > 	PERF_RECORD_LOST_SAMPLES
> > > 
> > > And have the id thing twice if attr.sample_id && PERF_SAMPLE_ID, but
> > > allow decoding if !attr.sample_id.
> > > 
> > > Or force attr.sample_id && PERF_SAMPLE_ID if there's multiple events and
> > > do away with the extra id field, like:
> > > 
> > > 	/*
> > > 	 * struct {
> > > 	 *	struct perf_event_header	header;
> > > 	 *	u64				lost;
> > > 	 *	struct sample_id		sample_id;
> > > 	 * };
> > > 	 */
> > > 	PERF_RECORD_LOST_SAMPLES
> > > 
> > > Should we force the use of sample_id on people?
> > 
> > If we have more than one event we _need_ PERF_SAMPLE_ID, to
> > disambiguate, if we don't, then the lost events are just for that one,
> > no?
 
> Sure, PERF_SAMPLE_ID is required, but attr::sample_id_all is not is it?
> 
> We can largely get by without using sample_id_all, as we did for a
> while.
 
> That said; sample_id_all has been around for more than 4 years and its
> recommended for use; but should we mandate it?

Got it now, to have PERF_SAMPLE_ID(ENTIFIER) in records !=
PERF_RECORD_SAMPLE when multiplexing more than one event on a ring
buffer, one would have to set attr.sample_id_all.

So, if we have just one event, we don't need sample_id_all (but we will
end up using it to have PERF_SAMPLE_TIME, to order metadata events
accross CPUs), we also don't need PERF_SAMPLE_ID, and we don't need to
have the u64 id in the PERF_RECORD_LOST_SAMPLE, no?

- Arnaldo


Below is some rambling, thinking out loud, ignore it if you want.

The attr::sample_id_all thing was more to be able to have
PERF_SAMPLE_TIME, and with that be able to order metadata events
together with PERF_SAMPLE_TIME, where we can ask for PERF_SAMPLE_TIME.

PERF_SAMPLE_ID(ENTIFIER) is about mapping back a PERF_RECORD_SAMPLE to
an event, with this it would also be used to figure out what event is
getting samples LOST, so I think the same semantic applies, i.e. if we
mux more than one event in a ring buffer, then PERF_RECORD_SAMPLE _and_
PERF_RECORD_LOST_SAMPLES should use the same mechanism _when we need to
disambiguate_, right?

I.e. those 8 bytes would only be required when we have more than one
event.

What downsides would we have if we used attr.sample_id_all +
PERF_SAMPLE_ID(ENTIFIER) to figure out what event the
PERF_RECORD_LOST_SAMPLES refers to?

Looking at
__perf_event__output_id_sample(kernel)/perf_evsel__parse_id_sample(tools)
we only insert/parse:

	if (type & PERF_SAMPLE_IDENTIFIER) {
	if (type & PERF_SAMPLE_CPU) {
	if (type & PERF_SAMPLE_STREAM_ID) {
	if (type & PERF_SAMPLE_ID) {
	if (type & PERF_SAMPLE_TIME) {
	if (type & PERF_SAMPLE_TID) {

- Arnaldo

  reply	other threads:[~2015-05-07 20:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 19:33 [PATCH V8 0/8] large PEBS interrupt threshold Kan Liang
2015-05-06 19:33 ` [PATCH V8 1/8] perf, x86: use the PEBS auto reload mechanism when possible Kan Liang
2015-06-07 17:49   ` [tip:perf/core] perf/x86/intel: Use " tip-bot for Yan, Zheng
2015-05-06 19:33 ` [PATCH V8 2/8] perf, x86: introduce setup_pebs_sample_data() Kan Liang
2015-06-07 17:49   ` [tip:perf/core] perf/x86/intel: Introduce setup_pebs_sample_data( ) tip-bot for Yan, Zheng
2015-05-06 19:33 ` [PATCH V8 3/8] perf, x86: handle multiple records in PEBS buffer Kan Liang
2015-05-08 11:05   ` Andi Kleen
2015-05-08 11:29     ` Peter Zijlstra
2015-06-07 17:49   ` [tip:perf/core] perf/x86/intel: Handle multiple records in the " tip-bot for Yan, Zheng
2015-05-06 19:33 ` [PATCH V8 4/8] perf, x86: large PEBS interrupt threshold Kan Liang
2015-06-07 17:49   ` [tip:perf/core] perf/x86/intel: Implement batched PEBS interrupt handling (large PEBS interrupt threshold ) tip-bot for Yan, Zheng
2015-05-06 19:33 ` [PATCH V8 5/8] perf, x86: drain PEBS buffer during context switch Kan Liang
2015-06-07 17:50   ` [tip:perf/core] perf/x86/intel: Drain the PEBS buffer during context switches tip-bot for Yan, Zheng
2015-05-06 19:33 ` [PATCH V8 6/8] perf, x86: enlarge PEBS buffer Kan Liang
2015-06-07 17:50   ` [tip:perf/core] perf/intel/x86: Enlarge the " tip-bot for Yan, Zheng
2015-05-06 19:33 ` [PATCH V8 7/8] perf, x86: introduce PERF_RECORD_LOST_SAMPLES Kan Liang
2015-05-07 11:35   ` Peter Zijlstra
2015-05-07 11:54     ` Peter Zijlstra
2015-05-07 14:15       ` Arnaldo Carvalho de Melo
2015-05-07 14:21         ` Arnaldo Carvalho de Melo
2015-05-07 14:39         ` Peter Zijlstra
2015-05-07 16:22           ` Arnaldo Carvalho de Melo
2015-05-07 17:37             ` Peter Zijlstra
2015-05-07 20:01               ` Arnaldo Carvalho de Melo [this message]
2015-05-07 13:56     ` Liang, Kan
2015-05-07 13:58       ` Peter Zijlstra
2015-05-06 19:33 ` [PATCH V8 8/8] perf tools: handle PERF_RECORD_LOST_SAMPLES Kan Liang
2015-05-07 10:33   ` Andi Kleen
2015-05-07 14:17     ` Liang, Kan

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=20150507200114.GG7862@kernel.org \
    --to=acme@infradead.org \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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