[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YbT7DgbmLDXctakZ@krava>
Date: Sat, 11 Dec 2021 20:25:02 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Andi Kleen <ak@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
John Garry <john.garry@...wei.com>,
Kajol Jain <kjain@...ux.ibm.com>,
"Paul A . Clarke" <pc@...ibm.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Riccardo Mancini <rickyman7@...il.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
Vineet Singh <vineet.singh@...el.com>,
James Clark <james.clark@....com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
Leo Yan <leo.yan@...aro.org>, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org, eranian@...gle.com
Subject: Re: [PATCH 06/22] perf cpumap: Remove map+index get_socket
On Tue, Dec 07, 2021 at 06:45:51PM -0800, Ian Rogers wrote:
> Migrate final users to appropriate cpu variant.
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
> tools/perf/tests/topology.c | 2 +-
> tools/perf/util/cpumap.c | 9 ---------
> tools/perf/util/cpumap.h | 1 -
> tools/perf/util/stat.c | 2 +-
> 4 files changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
> index 869986139146..69a64074b897 100644
> --- a/tools/perf/tests/topology.c
> +++ b/tools/perf/tests/topology.c
> @@ -150,7 +150,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
>
> // Test that socket ID contains only socket
> for (i = 0; i < map->nr; i++) {
> - id = cpu_map__get_socket(map, i, NULL);
> + id = cpu_map__get_socket_aggr_by_cpu(perf_cpu_map__cpu(map, i), NULL);
you could also use the perf_cpu_map__for_each_cpu in here?
same for the following changes
jirka
> TEST_ASSERT_VAL("Socket map - Socket ID doesn't match",
> session->header.env.cpu[map->map[i]].socket_id == id.socket);
>
> diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
> index feaf34b25efc..342a5eaee9d3 100644
> --- a/tools/perf/util/cpumap.c
> +++ b/tools/perf/util/cpumap.c
> @@ -136,15 +136,6 @@ struct aggr_cpu_id cpu_map__get_socket_aggr_by_cpu(int cpu, void *data __maybe_u
> return id;
> }
>
> -struct aggr_cpu_id cpu_map__get_socket(struct perf_cpu_map *map, int idx,
> - void *data)
> -{
> - if (idx < 0 || idx > map->nr)
> - return cpu_map__empty_aggr_cpu_id();
> -
> - return cpu_map__get_socket_aggr_by_cpu(map->map[idx], data);
> -}
> -
> static int cmp_aggr_cpu_id(const void *a_pointer, const void *b_pointer)
> {
> struct aggr_cpu_id *a = (struct aggr_cpu_id *)a_pointer;
> diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
> index 9648816c4255..a53af24301d2 100644
> --- a/tools/perf/util/cpumap.h
> +++ b/tools/perf/util/cpumap.h
> @@ -32,7 +32,6 @@ size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size);
> size_t cpu_map__fprintf(struct perf_cpu_map *map, FILE *fp);
> int cpu_map__get_socket_id(int cpu);
> struct aggr_cpu_id cpu_map__get_socket_aggr_by_cpu(int cpu, void *data);
> -struct aggr_cpu_id cpu_map__get_socket(struct perf_cpu_map *map, int idx, void *data);
> int cpu_map__get_die_id(int cpu);
> struct aggr_cpu_id cpu_map__get_die_aggr_by_cpu(int cpu, void *data);
> struct aggr_cpu_id cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data);
> diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
> index 09ea334586f2..9eca1111fa52 100644
> --- a/tools/perf/util/stat.c
> +++ b/tools/perf/util/stat.c
> @@ -328,7 +328,7 @@ static int check_per_pkg(struct evsel *counter,
> if (!(vals->run && vals->ena))
> return 0;
>
> - s = cpu_map__get_socket(cpus, cpu, NULL).socket;
> + s = cpu_map__get_socket_id(cpu);
> if (s < 0)
> return -1;
>
> --
> 2.34.1.400.ga245620fadb-goog
>
Powered by blists - more mailing lists