perf record: Add support for PERF_SAMPLE_CODE_PAGE_SIZE
Adds the infrastructure to sample the code address page size. Introduce a new --code-page-size option for perf record. Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Originally-by: Stephane Eranian <eranian@google.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20210105195752.43489-4-kan.liang@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
06280e3b15
commit
c1de7f3d84
@@ -1195,6 +1195,9 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
|
||||
if (opts->sample_data_page_size)
|
||||
evsel__set_sample_bit(evsel, DATA_PAGE_SIZE);
|
||||
|
||||
if (opts->sample_code_page_size)
|
||||
evsel__set_sample_bit(evsel, CODE_PAGE_SIZE);
|
||||
|
||||
if (opts->record_switch_events)
|
||||
attr->context_switch = track;
|
||||
|
||||
@@ -1880,7 +1883,12 @@ try_fallback:
|
||||
* Must probe features in the order they were added to the
|
||||
* perf_event_attr interface.
|
||||
*/
|
||||
if (!perf_missing_features.data_page_size &&
|
||||
if (!perf_missing_features.code_page_size &&
|
||||
(evsel->core.attr.sample_type & PERF_SAMPLE_CODE_PAGE_SIZE)) {
|
||||
perf_missing_features.code_page_size = true;
|
||||
pr_debug2_peo("Kernel has no PERF_SAMPLE_CODE_PAGE_SIZE support, bailing out\n");
|
||||
goto out_close;
|
||||
} else if (!perf_missing_features.data_page_size &&
|
||||
(evsel->core.attr.sample_type & PERF_SAMPLE_DATA_PAGE_SIZE)) {
|
||||
perf_missing_features.data_page_size = true;
|
||||
pr_debug2_peo("Kernel has no PERF_SAMPLE_DATA_PAGE_SIZE support, bailing out\n");
|
||||
@@ -2376,6 +2384,12 @@ int evsel__parse_sample(struct evsel *evsel, union perf_event *event,
|
||||
array++;
|
||||
}
|
||||
|
||||
data->code_page_size = 0;
|
||||
if (type & PERF_SAMPLE_CODE_PAGE_SIZE) {
|
||||
data->code_page_size = *array;
|
||||
array++;
|
||||
}
|
||||
|
||||
if (type & PERF_SAMPLE_AUX) {
|
||||
OVERFLOW_CHECK_u64(array);
|
||||
sz = *array++;
|
||||
@@ -2685,6 +2699,8 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
|
||||
"We found oprofile daemon running, please stop it and try again.");
|
||||
break;
|
||||
case EINVAL:
|
||||
if (evsel->core.attr.sample_type & PERF_SAMPLE_CODE_PAGE_SIZE && perf_missing_features.code_page_size)
|
||||
return scnprintf(msg, size, "Asking for the code page size isn't supported by this kernel.");
|
||||
if (evsel->core.attr.sample_type & PERF_SAMPLE_DATA_PAGE_SIZE && perf_missing_features.data_page_size)
|
||||
return scnprintf(msg, size, "Asking for the data page size isn't supported by this kernel.");
|
||||
if (evsel->core.attr.write_backward && perf_missing_features.write_backward)
|
||||
|
||||
Reference in New Issue
Block a user