Skip to content

Commit 45ab940

Browse files
committed
Merge tag 'perf-tools-fixes-for-v5.18-2022-04-22' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull perf tools fixes from Arnaldo Carvalho de Melo: - Fix header include for LLVM >= 14 when building with libclang. - Allow access to 'data_src' for auxtrace in 'perf script' with ARM SPE perf.data files, fixing processing data with such attributes. - Fix error message for test case 71 ("Convert perf time to TSC") on s390, where it is not supported. * tag 'perf-tools-fixes-for-v5.18-2022-04-22' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: perf test: Fix error message for test case 71 on s390, where it is not supported perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event perf script: Always allow field 'data_src' for auxtrace perf clang: Fix header include for LLVM >= 14
2 parents 9423edf + 5bb017d commit 45ab940

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

tools/perf/builtin-report.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep)
353353
struct perf_session *session = rep->session;
354354
u64 sample_type = evlist__combined_sample_type(session->evlist);
355355
bool is_pipe = perf_data__is_pipe(session->data);
356+
struct evsel *evsel;
356357

357358
if (session->itrace_synth_opts->callchain ||
358359
session->itrace_synth_opts->add_callchain ||
@@ -407,6 +408,19 @@ static int report__setup_sample_type(struct report *rep)
407408
}
408409

409410
if (sort__mode == SORT_MODE__MEMORY) {
411+
/*
412+
* FIXUP: prior to kernel 5.18, Arm SPE missed to set
413+
* PERF_SAMPLE_DATA_SRC bit in sample type. For backward
414+
* compatibility, set the bit if it's an old perf data file.
415+
*/
416+
evlist__for_each_entry(session->evlist, evsel) {
417+
if (strstr(evsel->name, "arm_spe") &&
418+
!(sample_type & PERF_SAMPLE_DATA_SRC)) {
419+
evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC;
420+
sample_type |= PERF_SAMPLE_DATA_SRC;
421+
}
422+
}
423+
410424
if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) {
411425
ui__error("Selected --mem-mode but no mem data. "
412426
"Did you call perf record without -d?\n");

tools/perf/builtin-script.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session)
461461
return -EINVAL;
462462

463463
if (PRINT_FIELD(DATA_SRC) &&
464-
evsel__check_stype(evsel, PERF_SAMPLE_DATA_SRC, "DATA_SRC", PERF_OUTPUT_DATA_SRC))
464+
evsel__do_check_stype(evsel, PERF_SAMPLE_DATA_SRC, "DATA_SRC", PERF_OUTPUT_DATA_SRC, allow_user_set))
465465
return -EINVAL;
466466

467467
if (PRINT_FIELD(WEIGHT) &&

tools/perf/tests/perf-time-to-tsc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su
123123
evsel->core.attr.enable_on_exec = 0;
124124
}
125125

126+
if (evlist__open(evlist) == -ENOENT) {
127+
err = TEST_SKIP;
128+
goto out_err;
129+
}
126130
CHECK__(evlist__open(evlist));
127131

128132
CHECK__(evlist__mmap(evlist, UINT_MAX));

tools/perf/util/c++/clang.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
#include "llvm/Option/Option.h"
2121
#include "llvm/Support/FileSystem.h"
2222
#include "llvm/Support/ManagedStatic.h"
23+
#if CLANG_VERSION_MAJOR >= 14
24+
#include "llvm/MC/TargetRegistry.h"
25+
#else
2326
#include "llvm/Support/TargetRegistry.h"
27+
#endif
2428
#include "llvm/Support/TargetSelect.h"
2529
#include "llvm/Target/TargetMachine.h"
2630
#include "llvm/Target/TargetOptions.h"

0 commit comments

Comments
 (0)