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

perf intel-pt/intel-bts: Switch perf_cpu_map__has_any_cpu_or_is_empty use

Switch perf_cpu_map__has_any_cpu_or_is_empty() to
perf_cpu_map__is_any_cpu_or_is_empty() as a CPU map may contain CPUs as
well as the dummy event and perf_cpu_map__is_any_cpu_or_is_empty() is a
more correct alternative.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Andrew Jones <ajones@ventanamicro.com>
Cc: André Almeida <andrealmeid@igalia.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Atish Patra <atishp@rivosinc.com>
Cc: Changbin Du <changbin.du@huawei.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paran Lee <p4ranlee@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Steinar H. Gunderson <sesse@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Yang Li <yang.lee@linux.alibaba.com>
Cc: Yanteng Si <siyanteng@loongson.cn>
Link: https://lore.kernel.org/r/20240202234057.2085863-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
291dcd77 e28ee123

+7 -7
+2 -2
tools/perf/arch/x86/util/intel-bts.c
··· 143 143 if (!opts->full_auxtrace) 144 144 return 0; 145 145 146 - if (opts->full_auxtrace && !perf_cpu_map__has_any_cpu_or_is_empty(cpus)) { 146 + if (opts->full_auxtrace && !perf_cpu_map__is_any_cpu_or_is_empty(cpus)) { 147 147 pr_err(INTEL_BTS_PMU_NAME " does not support per-cpu recording\n"); 148 148 return -EINVAL; 149 149 } ··· 224 224 * In the case of per-cpu mmaps, we need the CPU on the 225 225 * AUX event. 226 226 */ 227 - if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) 227 + if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) 228 228 evsel__set_sample_bit(intel_bts_evsel, CPU); 229 229 } 230 230
+5 -5
tools/perf/arch/x86/util/intel-pt.c
··· 369 369 ui__warning("Intel Processor Trace: TSC not available\n"); 370 370 } 371 371 372 - per_cpu_mmaps = !perf_cpu_map__has_any_cpu_or_is_empty(session->evlist->core.user_requested_cpus); 372 + per_cpu_mmaps = !perf_cpu_map__is_any_cpu_or_is_empty(session->evlist->core.user_requested_cpus); 373 373 374 374 auxtrace_info->type = PERF_AUXTRACE_INTEL_PT; 375 375 auxtrace_info->priv[INTEL_PT_PMU_TYPE] = intel_pt_pmu->type; ··· 774 774 * Per-cpu recording needs sched_switch events to distinguish different 775 775 * threads. 776 776 */ 777 - if (have_timing_info && !perf_cpu_map__has_any_cpu_or_is_empty(cpus) && 777 + if (have_timing_info && !perf_cpu_map__is_any_cpu_or_is_empty(cpus) && 778 778 !record_opts__no_switch_events(opts)) { 779 779 if (perf_can_record_switch_events()) { 780 780 bool cpu_wide = !target__none(&opts->target) && ··· 832 832 * In the case of per-cpu mmaps, we need the CPU on the 833 833 * AUX event. 834 834 */ 835 - if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) 835 + if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) 836 836 evsel__set_sample_bit(intel_pt_evsel, CPU); 837 837 } 838 838 ··· 858 858 tracking_evsel->immediate = true; 859 859 860 860 /* In per-cpu case, always need the time of mmap events etc */ 861 - if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) { 861 + if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) { 862 862 evsel__set_sample_bit(tracking_evsel, TIME); 863 863 /* And the CPU for switch events */ 864 864 evsel__set_sample_bit(tracking_evsel, CPU); ··· 870 870 * Warn the user when we do not have enough information to decode i.e. 871 871 * per-cpu with no sched_switch (except workload-only). 872 872 */ 873 - if (!ptr->have_sched_switch && !perf_cpu_map__has_any_cpu_or_is_empty(cpus) && 873 + if (!ptr->have_sched_switch && !perf_cpu_map__is_any_cpu_or_is_empty(cpus) && 874 874 !target__none(&opts->target) && 875 875 !intel_pt_evsel->core.attr.exclude_user) 876 876 ui__warning("Intel Processor Trace decoding will not be possible except for kernel tracing!\n");