[PATCH] perf tools: Exit recording if events have non matching sample type

September 29th, 2011 - 12:10 pm ET by Jiri Olsa | Report spam
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");
+ err = -EINVAL;
+ goto out_symbol_exit;
+ }
+
if (target_pid != -1)
target_tid = target_pid;

1.7.4

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
email Follow the discussionReplies 12 repliesReplies Make a reply

Replies

#1 Arnaldo Carvalho de Melo
September 29th, 2011 - 06:10 pm ET | Report spam
Em Thu, Sep 29, 2011 at 06:01:08PM +0200, Jiri Olsa escreveu:
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.



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.

Till then can you check if we can make it match or else just say that
the mix of events is not yet supported, please collect them in different
sessions or something along those lines?

- Arnaldo
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Similar topics