Commit 291dcd77 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

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: default avatarIan Rogers <irogers@google.com>
Acked-by: default avatarNamhyung 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e28ee123
...@@ -143,7 +143,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, ...@@ -143,7 +143,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr,
if (!opts->full_auxtrace) if (!opts->full_auxtrace)
return 0; return 0;
if (opts->full_auxtrace && !perf_cpu_map__has_any_cpu_or_is_empty(cpus)) { if (opts->full_auxtrace && !perf_cpu_map__is_any_cpu_or_is_empty(cpus)) {
pr_err(INTEL_BTS_PMU_NAME " does not support per-cpu recording\n"); pr_err(INTEL_BTS_PMU_NAME " does not support per-cpu recording\n");
return -EINVAL; return -EINVAL;
} }
...@@ -224,7 +224,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, ...@@ -224,7 +224,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr,
* In the case of per-cpu mmaps, we need the CPU on the * In the case of per-cpu mmaps, we need the CPU on the
* AUX event. * AUX event.
*/ */
if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus))
evsel__set_sample_bit(intel_bts_evsel, CPU); evsel__set_sample_bit(intel_bts_evsel, CPU);
} }
......
...@@ -369,7 +369,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr, ...@@ -369,7 +369,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,
ui__warning("Intel Processor Trace: TSC not available\n"); ui__warning("Intel Processor Trace: TSC not available\n");
} }
per_cpu_mmaps = !perf_cpu_map__has_any_cpu_or_is_empty(session->evlist->core.user_requested_cpus); per_cpu_mmaps = !perf_cpu_map__is_any_cpu_or_is_empty(session->evlist->core.user_requested_cpus);
auxtrace_info->type = PERF_AUXTRACE_INTEL_PT; auxtrace_info->type = PERF_AUXTRACE_INTEL_PT;
auxtrace_info->priv[INTEL_PT_PMU_TYPE] = intel_pt_pmu->type; auxtrace_info->priv[INTEL_PT_PMU_TYPE] = intel_pt_pmu->type;
...@@ -774,7 +774,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, ...@@ -774,7 +774,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
* Per-cpu recording needs sched_switch events to distinguish different * Per-cpu recording needs sched_switch events to distinguish different
* threads. * threads.
*/ */
if (have_timing_info && !perf_cpu_map__has_any_cpu_or_is_empty(cpus) && if (have_timing_info && !perf_cpu_map__is_any_cpu_or_is_empty(cpus) &&
!record_opts__no_switch_events(opts)) { !record_opts__no_switch_events(opts)) {
if (perf_can_record_switch_events()) { if (perf_can_record_switch_events()) {
bool cpu_wide = !target__none(&opts->target) && bool cpu_wide = !target__none(&opts->target) &&
...@@ -832,7 +832,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, ...@@ -832,7 +832,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
* In the case of per-cpu mmaps, we need the CPU on the * In the case of per-cpu mmaps, we need the CPU on the
* AUX event. * AUX event.
*/ */
if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus))
evsel__set_sample_bit(intel_pt_evsel, CPU); evsel__set_sample_bit(intel_pt_evsel, CPU);
} }
...@@ -858,7 +858,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, ...@@ -858,7 +858,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
tracking_evsel->immediate = true; tracking_evsel->immediate = true;
/* In per-cpu case, always need the time of mmap events etc */ /* In per-cpu case, always need the time of mmap events etc */
if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) { if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) {
evsel__set_sample_bit(tracking_evsel, TIME); evsel__set_sample_bit(tracking_evsel, TIME);
/* And the CPU for switch events */ /* And the CPU for switch events */
evsel__set_sample_bit(tracking_evsel, CPU); evsel__set_sample_bit(tracking_evsel, CPU);
...@@ -870,7 +870,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, ...@@ -870,7 +870,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
* Warn the user when we do not have enough information to decode i.e. * Warn the user when we do not have enough information to decode i.e.
* per-cpu with no sched_switch (except workload-only). * per-cpu with no sched_switch (except workload-only).
*/ */
if (!ptr->have_sched_switch && !perf_cpu_map__has_any_cpu_or_is_empty(cpus) && if (!ptr->have_sched_switch && !perf_cpu_map__is_any_cpu_or_is_empty(cpus) &&
!target__none(&opts->target) && !target__none(&opts->target) &&
!intel_pt_evsel->core.attr.exclude_user) !intel_pt_evsel->core.attr.exclude_user)
ui__warning("Intel Processor Trace decoding will not be possible except for kernel tracing!\n"); ui__warning("Intel Processor Trace decoding will not be possible except for kernel tracing!\n");
......
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