Skip to content

Commit ae5dcc8

Browse files
Stephane Eranianacmel
authored andcommitted
perf record: Prevent override of attr->sample_period for libpfm4 events
Before: $ perf record -c 10000 --pfm-events=cycles:period=77777 Would yield a cycles event with period=10000, instead of 77777. the event string and perf record initializing the event. This was due to an ordering issue between libpfm4 parsing events with attr->sample_period != 0 by the time intent of the author. perf_evsel__config() is invoked. This seems to have been the This patch fixes the problem by preventing override for Signed-off-by: Stephane Eranian <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Athira Jajeev <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Fastabend <[email protected]> Cc: KP Singh <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Cc: Yonghong Song <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Ian Rogers <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent ce4326d commit ae5dcc8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tools/perf/util/evsel.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,8 +976,7 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
976976
* We default some events to have a default interval. But keep
977977
* it a weak assumption overridable by the user.
978978
*/
979-
if (!attr->sample_period || (opts->user_freq != UINT_MAX ||
980-
opts->user_interval != ULLONG_MAX)) {
979+
if (!attr->sample_period) {
981980
if (opts->freq) {
982981
attr->freq = 1;
983982
attr->sample_freq = opts->freq;

0 commit comments

Comments
 (0)