Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf intel-pt: Record Event Trace capability flag

The change to the MODE.Exec packet means processing must distinguish
between the old and new cases. Record the Event Trace capability flag to
make that possible.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lore.kernel.org/r/20220124084201.2699795-14-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
f2be829e 8ee9a9ab

+16 -1
+7
tools/perf/arch/x86/util/intel-pt.c
··· 306 306 307 307 ptr->priv_size = (INTEL_PT_AUXTRACE_PRIV_MAX * sizeof(u64)) + 308 308 intel_pt_filter_bytes(filter); 309 + ptr->priv_size += sizeof(u64); /* Cap Event Trace */ 309 310 310 311 return ptr->priv_size; 311 312 } ··· 336 335 unsigned long max_non_turbo_ratio; 337 336 size_t filter_str_len; 338 337 const char *filter; 338 + int event_trace; 339 339 __u64 *info; 340 340 int err; 341 341 ··· 359 357 if (perf_pmu__scan_file(intel_pt_pmu, "max_nonturbo_ratio", 360 358 "%lu", &max_non_turbo_ratio) != 1) 361 359 max_non_turbo_ratio = 0; 360 + if (perf_pmu__scan_file(intel_pt_pmu, "caps/event_trace", 361 + "%d", &event_trace) != 1) 362 + event_trace = 0; 362 363 363 364 filter = intel_pt_find_filter(session->evlist, ptr->intel_pt_pmu); 364 365 filter_str_len = filter ? strlen(filter) : 0; ··· 411 406 strncpy((char *)info, filter, len); 412 407 info += len >> 3; 413 408 } 409 + 410 + *info++ = event_trace; 414 411 415 412 return 0; 416 413 }
+9 -1
tools/perf/util/intel-pt.c
··· 75 75 bool mispred_all; 76 76 bool use_thread_stack; 77 77 bool callstack; 78 + bool cap_event_trace; 78 79 unsigned int br_stack_sz; 79 80 unsigned int br_stack_sz_plus; 80 81 int have_sched_switch; ··· 3796 3795 } 3797 3796 3798 3797 info = &auxtrace_info->priv[INTEL_PT_FILTER_STR_LEN] + 1; 3799 - info_end = (void *)info + auxtrace_info->header.size; 3798 + info_end = (void *)auxtrace_info + auxtrace_info->header.size; 3800 3799 3801 3800 if (intel_pt_has(auxtrace_info, INTEL_PT_FILTER_STR_LEN)) { 3802 3801 size_t len; ··· 3833 3832 goto err_free_queues; 3834 3833 } 3835 3834 intel_pt_print_info_str("Filter string", pt->filter); 3835 + } 3836 + 3837 + if ((void *)info < info_end) { 3838 + pt->cap_event_trace = *info++; 3839 + if (dump_trace) 3840 + fprintf(stdout, " Cap Event Trace %d\n", 3841 + pt->cap_event_trace); 3836 3842 } 3837 3843 3838 3844 pt->timeless_decoding = intel_pt_timeless_decoding(pt);