[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cg8Awh9oXdCL4-GQT_R5FpgTz6DYFCfd=9g1YFQ463xSQ@mail.gmail.com>
Date: Wed, 27 Apr 2022 14:54:26 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...hat.com>, Ian Rogers <irogers@...gle.com>,
Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>,
Leo Yan <leo.yan@...aro.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC 05/21] perf auxtrace: Do not mix up mmap idx
On Fri, Apr 22, 2022 at 9:24 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> The idx is with respect to evlist not evsel. That hasn't mattered because
> they are the same at present. Prepare for that not being the case, which it
> won't be when sideband tracking events are allowed on all CPUs even when
> auxtrace is limited to selected CPUs.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> tools/perf/util/auxtrace.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
> index 10936a38031f..2d015b0be549 100644
> --- a/tools/perf/util/auxtrace.c
> +++ b/tools/perf/util/auxtrace.c
> @@ -640,8 +640,14 @@ static int evlist__enable_event_idx(struct evlist *evlist, struct evsel *evsel,
> {
> bool per_cpu_mmaps = !perf_cpu_map__empty(evlist->core.user_requested_cpus);
>
> - if (per_cpu_mmaps)
> - return perf_evsel__enable_cpu(&evsel->core, idx);
> + if (per_cpu_mmaps) {
> + struct perf_cpu evlist_cpu = perf_cpu_map__cpu(evlist->core.all_cpus, idx);
> + int cpu = perf_cpu_map__idx(evsel->core.cpus, evlist_cpu);
While it can be thought of as an index from the function name,
it'd be nice if we could be explicit like cpu_map_idx.
Thanks,
Namhyung
> +
> + if (cpu == -1)
> + return -EINVAL;
> + return perf_evsel__enable_cpu(&evsel->core, cpu);
> + }
>
> return perf_evsel__enable_thread(&evsel->core, idx);
> }
> --
> 2.25.1
>
Powered by blists - more mailing lists