public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Exit recording if events have non matching sample type
@ 2011-09-29 16:01 Jiri Olsa
  2011-09-29 22:05 ` Arnaldo Carvalho de Melo
  2011-10-21  7:18 ` Xu, Anhua
  0 siblings, 2 replies; 23+ messages in thread
From: Jiri Olsa @ 2011-09-29 16:01 UTC (permalink / raw)
  To: acme, a.p.zijlstra, mingo, paulus; +Cc: linux-kernel, Jiri Olsa

The event processing relies on all events having the same sample_type.

This is being checked when the session is being opened read only.
It also needs to be checked when we do record, since events could be
read during processing build IDs at the end of the record command.

If we process events with different sample_type the processing might
skip some events or hang.

Following command hangs on my setup:
  ./perf record -o perf.data -e ext4:ext4_mb_new_group_pa \
   -e LLC-loads -- date '+%F'

because hardware and tracepoint events have different sample type.

With the patch applied the record command displays
"Non matching sample_type" message and exits.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/builtin-record.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f4c3fbe..71e2c4e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -832,6 +832,12 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		goto out_symbol_exit;
 	}
 
+	if (!perf_evlist__valid_sample_type(evsel_list)) {
+		pr_err("Non matching sample_type\n");
+		err = -EINVAL;
+		goto out_symbol_exit;
+	}
+
 	if (target_pid != -1)
 		target_tid = target_pid;
 
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* Re: [PATCH] perf tools: Exit recording if events have non matching sample type
@ 2011-09-29 23:06 Arnaldo Carvalho de Melo
  2011-09-29 23:33 ` David Ahern
  0 siblings, 1 reply; 23+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-09-29 23:06 UTC (permalink / raw)
  To: David Ahern; +Cc: Jiri Olsa, a.p.zijlstra, mingo, paulus, linux-kernel

Em Thu, Sep 29, 2011 at 04:55:23PM -0600, David Ahern escreveu:
> On 09/29/2011 04:05 PM, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Sep 29, 2011 at 06:01:08PM +0200, Jiri Olsa escreveu:
> >> Following command hangs on my setup:
> >>   ./perf record -o perf.data -e ext4:ext4_mb_new_group_pa \
> >>    -e LLC-loads -- date '+%F'
> >>
> >> because hardware and tracepoint events have different sample type.
> >>
> >> With the patch applied the record command displays
> >> "Non matching sample_type" message and exits.
> > 
> > That is way too cryptic :-\
> > 
> > What is that makes the sample type not match in this case? Can we make
> > it match instead?
> > 
> > This is something to be properly fixed by _allowing_ non matching sample
> > types, the evsel/evlist abstractions are getting we close but not there
> > yet, multiple files in a perf.data/ directory are needed.
> 
> >From what I can see sample_type has to be the same for all samples:
> https://lkml.org/lkml/2011/8/15/6

We could add a PERF_SAMPLE_ID2 that if present would be guaranteed to be
the last, or we can, as PeterZ prefers/suggests, to use one mmap per
sample id, then we know that if we're getting it on that mmap, it has
that sample_type.

For record that means we need to dump each per-sample_id mmap onto a
separate file, i.e. use a directory, etc.

But what I suggested as a short term solution was to check what is the
difference in the above case and then make them use a single sample
type, i.e. bow to the current restriction.

- Arnaldo


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2011-10-21 14:43 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-29 16:01 [PATCH] perf tools: Exit recording if events have non matching sample type Jiri Olsa
2011-09-29 22:05 ` Arnaldo Carvalho de Melo
2011-09-29 22:55   ` David Ahern
2011-10-03 10:22   ` Jiri Olsa
2011-10-03 16:27     ` Arnaldo Carvalho de Melo
2011-10-03 19:15       ` Jiri Olsa
2011-10-17 12:50       ` Jiri Olsa
2011-10-21  7:18 ` Xu, Anhua
2011-10-21  8:10   ` Jiri Olsa
2011-10-21 14:16     ` David Ahern
2011-10-21 14:29       ` David Ahern
2011-10-21 14:43         ` Jiri Olsa
2011-10-21 14:42       ` Jiri Olsa
  -- strict thread matches above, loose matches on Subject: below --
2011-09-29 23:06 Arnaldo Carvalho de Melo
2011-09-29 23:33 ` David Ahern
2011-09-30  0:40   ` Arnaldo Carvalho de Melo
2011-09-30  0:58     ` David Ahern
2011-09-30  2:21       ` Arnaldo Carvalho de Melo
2011-09-30  2:41         ` David Ahern
2011-09-30  7:39   ` Peter Zijlstra
2011-10-04  4:14     ` David Ahern
2011-10-04 10:00       ` Peter Zijlstra
2011-10-04 13:41         ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox