Commit 45ab9400 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'perf-tools-fixes-for-v5.18-2022-04-22' of...

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
parents 9423edfc 5bb017d4
...@@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep) ...@@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep)
struct perf_session *session = rep->session; struct perf_session *session = rep->session;
u64 sample_type = evlist__combined_sample_type(session->evlist); u64 sample_type = evlist__combined_sample_type(session->evlist);
bool is_pipe = perf_data__is_pipe(session->data); bool is_pipe = perf_data__is_pipe(session->data);
struct evsel *evsel;
if (session->itrace_synth_opts->callchain || if (session->itrace_synth_opts->callchain ||
session->itrace_synth_opts->add_callchain || session->itrace_synth_opts->add_callchain ||
...@@ -407,6 +408,19 @@ static int report__setup_sample_type(struct report *rep) ...@@ -407,6 +408,19 @@ static int report__setup_sample_type(struct report *rep)
} }
if (sort__mode == SORT_MODE__MEMORY) { if (sort__mode == SORT_MODE__MEMORY) {
/*
* FIXUP: prior to kernel 5.18, Arm SPE missed to set
* PERF_SAMPLE_DATA_SRC bit in sample type. For backward
* compatibility, set the bit if it's an old perf data file.
*/
evlist__for_each_entry(session->evlist, evsel) {
if (strstr(evsel->name, "arm_spe") &&
!(sample_type & PERF_SAMPLE_DATA_SRC)) {
evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC;
sample_type |= PERF_SAMPLE_DATA_SRC;
}
}
if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) { if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) {
ui__error("Selected --mem-mode but no mem data. " ui__error("Selected --mem-mode but no mem data. "
"Did you call perf record without -d?\n"); "Did you call perf record without -d?\n");
......
...@@ -461,7 +461,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) ...@@ -461,7 +461,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session)
return -EINVAL; return -EINVAL;
if (PRINT_FIELD(DATA_SRC) && if (PRINT_FIELD(DATA_SRC) &&
evsel__check_stype(evsel, PERF_SAMPLE_DATA_SRC, "DATA_SRC", PERF_OUTPUT_DATA_SRC)) evsel__do_check_stype(evsel, PERF_SAMPLE_DATA_SRC, "DATA_SRC", PERF_OUTPUT_DATA_SRC, allow_user_set))
return -EINVAL; return -EINVAL;
if (PRINT_FIELD(WEIGHT) && if (PRINT_FIELD(WEIGHT) &&
......
...@@ -123,6 +123,10 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su ...@@ -123,6 +123,10 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su
evsel->core.attr.enable_on_exec = 0; evsel->core.attr.enable_on_exec = 0;
} }
if (evlist__open(evlist) == -ENOENT) {
err = TEST_SKIP;
goto out_err;
}
CHECK__(evlist__open(evlist)); CHECK__(evlist__open(evlist));
CHECK__(evlist__mmap(evlist, UINT_MAX)); CHECK__(evlist__mmap(evlist, UINT_MAX));
......
...@@ -20,7 +20,11 @@ ...@@ -20,7 +20,11 @@
#include "llvm/Option/Option.h" #include "llvm/Option/Option.h"
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/ManagedStatic.h"
#if CLANG_VERSION_MAJOR >= 14
#include "llvm/MC/TargetRegistry.h"
#else
#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetRegistry.h"
#endif
#include "llvm/Support/TargetSelect.h" #include "llvm/Support/TargetSelect.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment