Skip to content

Commit e9add8b

Browse files
olsajiriacmel
authored andcommitted
perf evsel: Disable write_backward for leader sampling group events
.. and other related fields that do not need to be enabled for events that have sampling leader. It fixes the perf top usage Ingo reported broken: # perf top -e '{cycles,msr/aperf/}:S' The 'msr/aperf/' event is configured for write_back sampling, which is not allowed by the MSR PMU, so it fails to create the event. Adjusting related attr test. Reported-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180423090823.32309-6-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 9a4a931 commit e9add8b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tools/perf/tests/attr/test-record-group-sampling

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ inherit=0
3535
# sampling disabled
3636
sample_freq=0
3737
sample_period=0
38+
freq=0
39+
write_backward=0
40+
sample_id_all=0

tools/perf/util/evsel.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,11 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
930930
* than leader in case leader 'leads' the sampling.
931931
*/
932932
if ((leader != evsel) && leader->sample_read) {
933-
attr->sample_freq = 0;
934-
attr->sample_period = 0;
933+
attr->freq = 0;
934+
attr->sample_freq = 0;
935+
attr->sample_period = 0;
936+
attr->write_backward = 0;
937+
attr->sample_id_all = 0;
935938
}
936939

937940
if (opts->no_samples)

0 commit comments

Comments
 (0)