diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index df77a44fe276a78b6ba27ab17593a89a81c6620d..10fcc0372aa9e457b3145c8a0d3774c10fc063e5 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -314,6 +314,13 @@ static int perf_evlist__id_add_fd(struct perf_evlist *evlist, /* Legacy way to get event id.. All hail to old kernels! */ + /* + * This way does not work with group format read, so bail + * out in that case. + */ + if (perf_evlist__read_format(evlist) & PERF_FORMAT_GROUP) + return -1; + if (!(evsel->attr.read_format & PERF_FORMAT_ID) || read(fd, &read_data, sizeof(read_data)) == -1) return -1;