All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Alexey Budankov <alexey.budankov@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Michael Petlan <mpetlan@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 057/107] libperf: Add perf_cpu_map__get()/perf_cpu_map__put()
Date: Mon, 29 Jul 2019 23:55:20 -0300	[thread overview]
Message-ID: <20190730025610.22603-58-acme@kernel.org> (raw)
In-Reply-To: <20190730025610.22603-1-acme@kernel.org>

From: Jiri Olsa <jolsa@kernel.org>

Moving the following functions:

  cpu_map__get()
  cpu_map__put()

to libperf with following names:

  perf_cpu_map__get()
  perf_cpu_map__put()

Committer notes:

Added fixes for arm/arm64

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-31-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/arch/arm/util/cs-etm.c          |  6 +++---
 tools/perf/arch/arm64/util/header.c        |  4 ++--
 tools/perf/builtin-ftrace.c                |  2 +-
 tools/perf/builtin-stat.c                  |  4 ++--
 tools/perf/lib/cpumap.c                    | 24 ++++++++++++++++++++++
 tools/perf/lib/include/perf/cpumap.h       |  2 ++
 tools/perf/lib/libperf.map                 |  2 ++
 tools/perf/tests/bitmap.c                  |  2 +-
 tools/perf/tests/code-reading.c            |  4 ++--
 tools/perf/tests/cpumap.c                  |  8 ++++----
 tools/perf/tests/event-times.c             |  4 ++--
 tools/perf/tests/event_update.c            |  4 ++--
 tools/perf/tests/keep-tracking.c           |  2 +-
 tools/perf/tests/mem2node.c                |  2 +-
 tools/perf/tests/mmap-basic.c              |  2 +-
 tools/perf/tests/openat-syscall-all-cpus.c |  2 +-
 tools/perf/tests/sw-clock.c                |  2 +-
 tools/perf/tests/switch-tracking.c         |  2 +-
 tools/perf/tests/task-exit.c               |  2 +-
 tools/perf/tests/topology.c                |  2 +-
 tools/perf/util/cpumap.c                   | 22 --------------------
 tools/perf/util/cpumap.h                   |  3 ---
 tools/perf/util/cputopo.c                  |  4 ++--
 tools/perf/util/env.c                      |  2 +-
 tools/perf/util/event.c                    |  2 +-
 tools/perf/util/evlist.c                   | 16 +++++++--------
 tools/perf/util/evsel.c                    |  4 ++--
 tools/perf/util/parse-events.c             |  4 ++--
 tools/perf/util/pmu.c                      |  2 +-
 tools/perf/util/python.c                   |  2 +-
 tools/perf/util/record.c                   |  6 +++---
 tools/perf/util/session.c                  |  2 +-
 tools/perf/util/svghelper.c                |  2 +-
 33 files changed, 78 insertions(+), 75 deletions(-)

diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index 268fcb31cd53..3a78b38e43ca 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -181,7 +181,7 @@ static int cs_etm_set_option(struct auxtrace_record *itr,
 
 	err = 0;
 out:
-	cpu_map__put(online_cpus);
+	perf_cpu_map__put(online_cpus);
 	return err;
 }
 
@@ -517,7 +517,7 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused,
 		}
 	}
 
-	cpu_map__put(online_cpus);
+	perf_cpu_map__put(online_cpus);
 
 	return (CS_ETM_HEADER_SIZE +
 	       (etmv4 * CS_ETMV4_PRIV_SIZE) +
@@ -679,7 +679,7 @@ static int cs_etm_info_fill(struct auxtrace_record *itr,
 		if (cpu_map__has(cpu_map, i))
 			cs_etm_get_metadata(i, &offset, itr, info);
 
-	cpu_map__put(online_cpus);
+	perf_cpu_map__put(online_cpus);
 
 	return 0;
 }
diff --git a/tools/perf/arch/arm64/util/header.c b/tools/perf/arch/arm64/util/header.c
index b3e73a413f5a..602caf550e7f 100644
--- a/tools/perf/arch/arm64/util/header.c
+++ b/tools/perf/arch/arm64/util/header.c
@@ -27,7 +27,7 @@ char *get_cpuid_str(struct perf_pmu *pmu)
 		return NULL;
 
 	/* read midr from list of cpus mapped to this pmu */
-	cpus = cpu_map__get(pmu->cpus);
+	cpus = perf_cpu_map__get(pmu->cpus);
 	for (cpu = 0; cpu < cpus->nr; cpu++) {
 		scnprintf(path, PATH_MAX, "%s/devices/system/cpu/cpu%d"MIDR,
 				sysfs, cpus->map[cpu]);
@@ -60,6 +60,6 @@ char *get_cpuid_str(struct perf_pmu *pmu)
 		buf = NULL;
 	}
 
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 	return buf;
 }
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 105ef2a17a9c..6943352b8d94 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -206,7 +206,7 @@ static int reset_tracing_cpu(void)
 	int ret;
 
 	ret = set_tracing_cpumask(cpumap);
-	cpu_map__put(cpumap);
+	perf_cpu_map__put(cpumap);
 	return ret;
 }
 
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 36e66a4f3c57..39bd73d0e06e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -933,8 +933,8 @@ static int perf_stat_init_aggr_mode(void)
 
 static void perf_stat__exit_aggr_mode(void)
 {
-	cpu_map__put(stat_config.aggr_map);
-	cpu_map__put(stat_config.cpus_aggr_map);
+	perf_cpu_map__put(stat_config.aggr_map);
+	perf_cpu_map__put(stat_config.cpus_aggr_map);
 	stat_config.aggr_map = NULL;
 	stat_config.cpus_aggr_map = NULL;
 }
diff --git a/tools/perf/lib/cpumap.c b/tools/perf/lib/cpumap.c
index 80d587ab95aa..f3cfb4c71106 100644
--- a/tools/perf/lib/cpumap.c
+++ b/tools/perf/lib/cpumap.c
@@ -3,6 +3,8 @@
 #include <stdlib.h>
 #include <linux/refcount.h>
 #include <internal/cpumap.h>
+#include <asm/bug.h>
+#include <stdio.h>
 
 struct perf_cpu_map *perf_cpu_map__dummy_new(void)
 {
@@ -16,3 +18,25 @@ struct perf_cpu_map *perf_cpu_map__dummy_new(void)
 
 	return cpus;
 }
+
+static void cpu_map__delete(struct perf_cpu_map *map)
+{
+	if (map) {
+		WARN_ONCE(refcount_read(&map->refcnt) != 0,
+			  "cpu_map refcnt unbalanced\n");
+		free(map);
+	}
+}
+
+struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map)
+{
+	if (map)
+		refcount_inc(&map->refcnt);
+	return map;
+}
+
+void perf_cpu_map__put(struct perf_cpu_map *map)
+{
+	if (map && refcount_dec_and_test(&map->refcnt))
+		cpu_map__delete(map);
+}
diff --git a/tools/perf/lib/include/perf/cpumap.h b/tools/perf/lib/include/perf/cpumap.h
index fa1e5aa9d662..e16c2515a499 100644
--- a/tools/perf/lib/include/perf/cpumap.h
+++ b/tools/perf/lib/include/perf/cpumap.h
@@ -7,5 +7,7 @@
 struct perf_cpu_map;
 
 LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void);
+LIBPERF_API struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map);
+LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map);
 
 #endif /* __LIBPERF_CPUMAP_H */
diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map
index 65201c6cbe7e..76ce3bc59dd8 100644
--- a/tools/perf/lib/libperf.map
+++ b/tools/perf/lib/libperf.map
@@ -2,6 +2,8 @@ LIBPERF_0.0.1 {
 	global:
 		libperf_set_print;
 		perf_cpu_map__dummy_new;
+		perf_cpu_map__get;
+		perf_cpu_map__put;
 	local:
 		*;
 };
diff --git a/tools/perf/tests/bitmap.c b/tools/perf/tests/bitmap.c
index 74d0cd32a5c4..95304d29092e 100644
--- a/tools/perf/tests/bitmap.c
+++ b/tools/perf/tests/bitmap.c
@@ -21,7 +21,7 @@ static unsigned long *get_bitmap(const char *str, int nbits)
 	}
 
 	if (map)
-		cpu_map__put(map);
+		perf_cpu_map__put(map);
 	return bm;
 }
 
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index ec4b0bf28270..ce2d3266286a 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -655,7 +655,7 @@ static int do_test_code_reading(bool try_kcore)
 				 * and will be freed by following perf_evlist__set_maps
 				 * call. Getting refference to keep them alive.
 				 */
-				cpu_map__get(cpus);
+				perf_cpu_map__get(cpus);
 				thread_map__get(threads);
 				perf_evlist__set_maps(evlist, NULL, NULL);
 				evlist__delete(evlist);
@@ -705,7 +705,7 @@ static int do_test_code_reading(bool try_kcore)
 	if (evlist) {
 		evlist__delete(evlist);
 	} else {
-		cpu_map__put(cpus);
+		perf_cpu_map__put(cpus);
 		thread_map__put(threads);
 	}
 	machine__delete_threads(machine);
diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c
index 10da4400493d..6c921087b0fe 100644
--- a/tools/perf/tests/cpumap.c
+++ b/tools/perf/tests/cpumap.c
@@ -39,7 +39,7 @@ static int process_event_mask(struct perf_tool *tool __maybe_unused,
 		TEST_ASSERT_VAL("wrong cpu", map->map[i] == i);
 	}
 
-	cpu_map__put(map);
+	perf_cpu_map__put(map);
 	return 0;
 }
 
@@ -68,7 +68,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,
 	TEST_ASSERT_VAL("wrong cpu", map->map[0] == 1);
 	TEST_ASSERT_VAL("wrong cpu", map->map[1] == 256);
 	TEST_ASSERT_VAL("wrong refcnt", refcount_read(&map->refcnt) == 1);
-	cpu_map__put(map);
+	perf_cpu_map__put(map);
 	return 0;
 }
 
@@ -83,7 +83,7 @@ int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __may
 	TEST_ASSERT_VAL("failed to synthesize map",
 		!perf_event__synthesize_cpu_map(NULL, cpus, process_event_mask, NULL));
 
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 
 	/* This one is better stores in cpu values. */
 	cpus = cpu_map__new("1,256");
@@ -91,7 +91,7 @@ int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __may
 	TEST_ASSERT_VAL("failed to synthesize map",
 		!perf_event__synthesize_cpu_map(NULL, cpus, process_event_cpus, NULL));
 
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 	return 0;
 }
 
diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c
index bf00d3d792fb..dcfff4b20c92 100644
--- a/tools/perf/tests/event-times.c
+++ b/tools/perf/tests/event-times.c
@@ -132,7 +132,7 @@ static int attach__cpu_disabled(struct evlist *evlist)
 		return err;
 	}
 
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 	return evsel__enable(evsel);
 }
 
@@ -154,7 +154,7 @@ static int attach__cpu_enabled(struct evlist *evlist)
 	if (err == -EACCES)
 		return TEST_SKIP;
 
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 	return err ? TEST_FAIL : TEST_OK;
 }
 
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c
index eb0dd359762d..415d12e96834 100644
--- a/tools/perf/tests/event_update.c
+++ b/tools/perf/tests/event_update.c
@@ -73,7 +73,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,
 	TEST_ASSERT_VAL("wrong cpus", map->map[0] == 1);
 	TEST_ASSERT_VAL("wrong cpus", map->map[1] == 2);
 	TEST_ASSERT_VAL("wrong cpus", map->map[2] == 3);
-	cpu_map__put(map);
+	perf_cpu_map__put(map);
 	return 0;
 }
 
@@ -113,6 +113,6 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu
 	TEST_ASSERT_VAL("failed to synthesize attr update cpus",
 			!perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus));
 
-	cpu_map__put(evsel->own_cpus);
+	perf_cpu_map__put(evsel->own_cpus);
 	return 0;
 }
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 7bfc859971e5..43e55fe98f8c 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -149,7 +149,7 @@ int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_un
 		evlist__disable(evlist);
 		evlist__delete(evlist);
 	} else {
-		cpu_map__put(cpus);
+		perf_cpu_map__put(cpus);
 		thread_map__put(threads);
 	}
 
diff --git a/tools/perf/tests/mem2node.c b/tools/perf/tests/mem2node.c
index e12eedfba781..6fe2c1e7918b 100644
--- a/tools/perf/tests/mem2node.c
+++ b/tools/perf/tests/mem2node.c
@@ -32,7 +32,7 @@ static unsigned long *get_bitmap(const char *str, int nbits)
 	}
 
 	if (map)
-		cpu_map__put(map);
+		perf_cpu_map__put(map);
 	else
 		free(bm);
 
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index 40511025208f..d15282174b2e 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -155,7 +155,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
 	cpus	= NULL;
 	threads = NULL;
 out_free_cpus:
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 out_free_threads:
 	thread_map__put(threads);
 	return err;
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index f96cbd304024..611f6ea9b702 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -120,7 +120,7 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int
 out_evsel_delete:
 	evsel__delete(evsel);
 out_cpu_map_delete:
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 out_thread_map_delete:
 	thread_map__put(threads);
 	return err;
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c
index c6d3f4488b73..c464e301ade9 100644
--- a/tools/perf/tests/sw-clock.c
+++ b/tools/perf/tests/sw-clock.c
@@ -125,7 +125,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
 	}
 
 out_free_maps:
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 	thread_map__put(threads);
 out_delete_evlist:
 	evlist__delete(evlist);
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index d5537edb47db..27af7b7109a3 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -569,7 +569,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_
 		evlist__disable(evlist);
 		evlist__delete(evlist);
 	} else {
-		cpu_map__put(cpus);
+		perf_cpu_map__put(cpus);
 		thread_map__put(threads);
 	}
 
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index c094fb8cc877..f026759a05d7 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -135,7 +135,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
 	}
 
 out_free_maps:
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 	thread_map__put(threads);
 out_delete_evlist:
 	evlist__delete(evlist);
diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
index 443d0272ebbd..1b57ded58d59 100644
--- a/tools/perf/tests/topology.c
+++ b/tools/perf/tests/topology.c
@@ -133,7 +133,7 @@ int test__session_topology(struct test *test __maybe_unused, int subtest __maybe
 	}
 
 	ret = check_cpu_topology(path, map);
-	cpu_map__put(map);
+	perf_cpu_map__put(map);
 
 free_path:
 	unlink(path);
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index acda9bfb4002..44082e5eabde 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -273,28 +273,6 @@ struct perf_cpu_map *cpu_map__empty_new(int nr)
 	return cpus;
 }
 
-static void cpu_map__delete(struct perf_cpu_map *map)
-{
-	if (map) {
-		WARN_ONCE(refcount_read(&map->refcnt) != 0,
-			  "cpu_map refcnt unbalanced\n");
-		free(map);
-	}
-}
-
-struct perf_cpu_map *cpu_map__get(struct perf_cpu_map *map)
-{
-	if (map)
-		refcount_inc(&map->refcnt);
-	return map;
-}
-
-void cpu_map__put(struct perf_cpu_map *map)
-{
-	if (map && refcount_dec_and_test(&map->refcnt))
-		cpu_map__delete(map);
-}
-
 static int cpu__get_topology_int(int cpu, const char *name, int *value)
 {
 	char path[PATH_MAX];
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
index 0ce3f6bd9449..b7af2cb68c19 100644
--- a/tools/perf/util/cpumap.h
+++ b/tools/perf/util/cpumap.h
@@ -29,9 +29,6 @@ int cpu_map__build_die_map(struct perf_cpu_map *cpus, struct perf_cpu_map **diep
 int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep);
 const struct perf_cpu_map *cpu_map__online(void); /* thread unsafe */
 
-struct perf_cpu_map *cpu_map__get(struct perf_cpu_map *map);
-void cpu_map__put(struct perf_cpu_map *map);
-
 static inline int cpu_map__socket(struct perf_cpu_map *sock, int s)
 {
 	if (!sock || s > sock->nr || s < 0)
diff --git a/tools/perf/util/cputopo.c b/tools/perf/util/cputopo.c
index 157b0988435e..0cd99c460cd4 100644
--- a/tools/perf/util/cputopo.c
+++ b/tools/perf/util/cputopo.c
@@ -219,7 +219,7 @@ struct cpu_topology *cpu_topology__new(void)
 	}
 
 out_free:
-	cpu_map__put(map);
+	perf_cpu_map__put(map);
 	if (ret) {
 		cpu_topology__delete(tp);
 		tp = NULL;
@@ -335,7 +335,7 @@ struct numa_topology *numa_topology__new(void)
 out:
 	free(buf);
 	fclose(fp);
-	cpu_map__put(node_map);
+	perf_cpu_map__put(node_map);
 	return tp;
 }
 
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index 9909ec40c6d2..d77912b2b5e7 100644
--- a/tools/perf/util/env.c
+++ b/tools/perf/util/env.c
@@ -179,7 +179,7 @@ void perf_env__exit(struct perf_env *env)
 	zfree(&env->cpu);
 
 	for (i = 0; i < env->nr_numa_nodes; i++)
-		cpu_map__put(env->numa_nodes[i].map);
+		perf_cpu_map__put(env->numa_nodes[i].map);
 	zfree(&env->numa_nodes);
 
 	for (i = 0; i < env->caches_cnt; i++)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index f78837788b14..1a3db35f9f7d 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1403,7 +1403,7 @@ size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp)
 	else
 		ret += fprintf(fp, "failed to get cpumap from event\n");
 
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 	return ret;
 }
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 461c1e68e9e7..35020d50f51e 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -141,7 +141,7 @@ void evlist__delete(struct evlist *evlist)
 
 	perf_evlist__munmap(evlist);
 	evlist__close(evlist);
-	cpu_map__put(evlist->cpus);
+	perf_cpu_map__put(evlist->cpus);
 	thread_map__put(evlist->threads);
 	evlist->cpus = NULL;
 	evlist->threads = NULL;
@@ -158,11 +158,11 @@ static void __perf_evlist__propagate_maps(struct evlist *evlist,
 	 * keep it, if there's no target cpu list defined.
 	 */
 	if (!evsel->own_cpus || evlist->has_user_cpus) {
-		cpu_map__put(evsel->cpus);
-		evsel->cpus = cpu_map__get(evlist->cpus);
+		perf_cpu_map__put(evsel->cpus);
+		evsel->cpus = perf_cpu_map__get(evlist->cpus);
 	} else if (evsel->cpus != evsel->own_cpus) {
-		cpu_map__put(evsel->cpus);
-		evsel->cpus = cpu_map__get(evsel->own_cpus);
+		perf_cpu_map__put(evsel->cpus);
+		evsel->cpus = perf_cpu_map__get(evsel->own_cpus);
 	}
 
 	thread_map__put(evsel->threads);
@@ -1115,8 +1115,8 @@ void perf_evlist__set_maps(struct evlist *evlist, struct perf_cpu_map *cpus,
 	 * the caller to increase the reference count.
 	 */
 	if (cpus != evlist->cpus) {
-		cpu_map__put(evlist->cpus);
-		evlist->cpus = cpu_map__get(cpus);
+		perf_cpu_map__put(evlist->cpus);
+		evlist->cpus = perf_cpu_map__get(cpus);
 	}
 
 	if (threads != evlist->threads) {
@@ -1383,7 +1383,7 @@ static int perf_evlist__create_syswide_maps(struct evlist *evlist)
 out:
 	return err;
 out_put:
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 	goto out;
 }
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index a389752840a9..72c0e6948e83 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1325,8 +1325,8 @@ void perf_evsel__exit(struct evsel *evsel)
 	perf_evsel__free_id(evsel);
 	perf_evsel__free_config_terms(evsel);
 	cgroup__put(evsel->cgrp);
-	cpu_map__put(evsel->cpus);
-	cpu_map__put(evsel->own_cpus);
+	perf_cpu_map__put(evsel->cpus);
+	perf_cpu_map__put(evsel->own_cpus);
 	thread_map__put(evsel->threads);
 	zfree(&evsel->group_name);
 	zfree(&evsel->name);
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index decb66d243ca..8c9928feb38a 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -332,8 +332,8 @@ __add_event(struct list_head *list, int *idx,
 		return NULL;
 
 	(*idx)++;
-	evsel->cpus        = cpu_map__get(cpus);
-	evsel->own_cpus    = cpu_map__get(cpus);
+	evsel->cpus        = perf_cpu_map__get(cpus);
+	evsel->own_cpus    = perf_cpu_map__get(cpus);
 	evsel->system_wide = pmu ? pmu->is_uncore : false;
 	evsel->auto_merge_stats = auto_merge_stats;
 
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 4929a50c0973..d355f9506a1c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -626,7 +626,7 @@ static bool pmu_is_uncore(const char *name)
 
 	snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name);
 	cpus = __pmu_cpumask(path);
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 
 	return !!cpus;
 }
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index cc4af99ab190..677c93f91c6c 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -557,7 +557,7 @@ static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus,
 
 static void pyrf_cpu_map__delete(struct pyrf_cpu_map *pcpus)
 {
-	cpu_map__put(pcpus->cpus);
+	perf_cpu_map__put(pcpus->cpus);
 	Py_TYPE(pcpus)->tp_free((PyObject*)pcpus);
 }
 
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index 9f8841548539..fecccfd71aa1 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -67,7 +67,7 @@ static bool perf_probe_api(setup_probe_fn_t fn)
 	if (!cpus)
 		return false;
 	cpu = cpus->map[0];
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 
 	do {
 		ret = perf_do_probe_api(fn, cpu, try[i++]);
@@ -122,7 +122,7 @@ bool perf_can_record_cpu_wide(void)
 	if (!cpus)
 		return false;
 	cpu = cpus->map[0];
-	cpu_map__put(cpus);
+	perf_cpu_map__put(cpus);
 
 	fd = sys_perf_event_open(&attr, -1, cpu, -1, 0);
 	if (fd < 0)
@@ -278,7 +278,7 @@ bool perf_evlist__can_select_event(struct evlist *evlist, const char *str)
 		struct perf_cpu_map *cpus = cpu_map__new(NULL);
 
 		cpu =  cpus ? cpus->map[0] : 0;
-		cpu_map__put(cpus);
+		perf_cpu_map__put(cpus);
 	} else {
 		cpu = evlist->cpus->map[0];
 	}
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index c191dc152175..62d37440cbee 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -2310,7 +2310,7 @@ int perf_session__cpu_bitmap(struct perf_session *session,
 	err = 0;
 
 out_delete_map:
-	cpu_map__put(map);
+	perf_cpu_map__put(map);
 	return err;
 }
 
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index 99132c6a30a6..a9ca5c4fffee 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -745,7 +745,7 @@ static int str_to_bitmap(char *s, cpumask_t *b)
 		set_bit(c, cpumask_bits(b));
 	}
 
-	cpu_map__put(m);
+	perf_cpu_map__put(m);
 
 	return ret;
 }
-- 
2.21.0

  parent reply	other threads:[~2019-07-30  2:55 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  2:54 [GIT PULL 000/107] perf/core improvements and fixes Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 001/107] perf include bpf: Add bpf_tail_call() prototype Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 002/107] perf bpf: Do not attach a BPF prog to a tracepoint if its name starts with ! Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 003/107] perf evsel: Store backpointer to attached bpf_object Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 004/107] perf trace: Add pointer to BPF object containing __augmented_syscalls__ Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 005/107] perf trace: Look up maps just on the __augmented_syscalls__ BPF object Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 006/107] perf trace: Order -e syscalls table Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 007/107] perf trace: Add BPF handler for unaugmented syscalls Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 008/107] perf trace: Allow specifying the bpf prog to augment specific syscalls Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 009/107] perf trace: Put the per-syscall entry/exit prog_array BPF map infrastructure in place Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 010/107] perf trace: Handle raw_syscalls:sys_enter just like the BPF_OUTPUT augmented event Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 011/107] perf augmented_raw_syscalls: Add handler for "openat" Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 012/107] perf augmented_raw_syscalls: Switch to using BPF_MAP_TYPE_PROG_ARRAY Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 013/107] perf augmented_raw_syscalls: Support copying two string syscall args Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 014/107] perf trace: Look for default name for entries in the syscalls prog array Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 015/107] perf augmented_raw_syscalls: Rename augmented_args_filename to augmented_args_payload Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 016/107] perf augmented_raw_syscalls: Augment sockaddr arg in 'connect' Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 017/107] perf trace beauty: Make connect's addrlen be printed as an int, not hex Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 018/107] perf trace beauty: Disable fd->pathname when close() not enabled Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 019/107] perf trace beauty: Do not try to use the fd->pathname beautifier for bind/connect fd arg Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 020/107] perf trace beauty: Beautify 'sendto's sockaddr arg Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 021/107] perf trace beauty: Beautify bind's " Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 022/107] perf trace beauty: Add BPF augmenter for the 'rename' syscall Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 023/107] perf trace: Forward error codes when trying to read syscall info Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 024/107] perf trace: Mark syscall ids that are not allocated to avoid unnecessary error messages Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 025/107] perf trace: Preallocate the syscall table Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 026/107] perf trace: Reuse BPF augmenters from syscalls with similar args signature Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 027/107] perf trace: Add "sendfile64" alias to the "sendfile" syscall Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 028/107] perf stat: Move loaded out of struct perf_counts_values Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 029/107] perf cpu_map: Rename struct cpu_map to struct perf_cpu_map Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 030/107] perf tools: Rename struct thread_map to struct perf_thread_map Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 031/107] perf evsel: Rename struct perf_evsel to struct evsel Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 032/107] perf evlist: Rename struct perf_evlist to struct evlist Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 033/107] perf evsel: Rename perf_evsel__init() to evsel__init() Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 034/107] perf evlist: Rename perf_evlist__init() to evlist__init() Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 035/107] perf evlist: Rename perf_evlist__new() to evlist__new() Arnaldo Carvalho de Melo
2019-07-30  2:54 ` [PATCH 036/107] perf evlist: Rename perf_evlist__delete() to evlist__delete() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 037/107] perf evsel: Rename perf_evsel__delete() to evsel__delete() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 038/107] perf evsel: Rename perf_evsel__new() to evsel__new() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 039/107] perf evlist: Rename perf_evlist__add() to evlist__add() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 040/107] perf evlist: Rename perf_evlist__remove() to evlist__remove() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 041/107] perf evsel: Rename perf_evsel__open() to evsel__open() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 042/107] perf evsel: Rename perf_evsel__enable() to evsel__enable() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 043/107] perf evsel: Rename perf_evsel__disable() to evsel__disable() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 044/107] perf evsel: Rename perf_evsel__apply_filter() to evsel__apply_filter() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 045/107] perf evsel: Rename perf_evsel__cpus() to evsel__cpus() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 046/107] perf evlist: Rename perf_evlist__open() to evlist__open() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 047/107] perf evlist: Rename perf_evlist__close() to evlist__close() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 048/107] perf evlist: Rename perf_evlist__enable() to evlist__enable() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 049/107] perf evlist: Rename perf_evlist__disable() to evlist__disable() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 050/107] libperf: Make libperf.a part of the perf build Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 051/107] libperf: Add build version support Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 052/107] libperf: Add libperf to the python.so build Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 053/107] libperf: Add perf/core.h header Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 054/107] libperf: Add debug output support Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 055/107] libperf: Add perf_cpu_map struct Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 056/107] libperf: Add perf_cpu_map__dummy_new() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` Arnaldo Carvalho de Melo [this message]
2019-07-30  2:55 ` [PATCH 058/107] libperf: Add perf_thread_map struct Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 059/107] libperf: Add perf_thread_map__new_dummy() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 060/107] libperf: Add perf_thread_map__get()/perf_thread_map__put() Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 061/107] libperf: Add perf_evlist and perf_evsel structs Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 062/107] libperf: Include perf_evsel in evsel object Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 063/107] libperf: Include perf_evlist in evlist object Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 064/107] libperf: Add perf_evsel__init function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 065/107] libperf: Add perf_evlist__init() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 066/107] libperf: Add perf_evlist__add() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 067/107] libperf: Add perf_evlist__remove() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 068/107] libperf: Add nr_entries to struct perf_evlist Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 069/107] libperf: Move perf_event_attr field from perf's evsel to libperf's perf_evsel Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 070/107] libperf: Add perf_cpu_map__new()/perf_cpu_map__read() functions Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 071/107] libperf: Move zalloc.o into libperf Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 072/107] libperf: Add perf_evlist__new() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 073/107] libperf: Add perf_evsel__new() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 074/107] libperf: Add perf_evlist__for_each_evsel() iterator Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 075/107] libperf: Add perf_evlist__delete() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 076/107] libperf: Add perf_evsel__delete() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 077/107] libperf: Add cpus to struct perf_evsel Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 078/107] libperf: Add own_cpus " Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 079/107] libperf: Add threads " Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 080/107] libperf: Add has_user_cpus to struct perf_evlist Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 081/107] libperf: Add cpus " Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 082/107] libperf: Add threads " Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 083/107] libperf: Add perf_evlist__set_maps() function Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 084/107] libperf: Adopt xyarray class from perf Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 085/107] libperf: Move fd array from perf's evsel to lobperf's perf_evsel class Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 086/107] libperf: Move nr_members from perf's evsel to libperf's perf_evsel Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 087/107] libperf: Adopt the readn()/writen() functions from tools/perf Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 088/107] libperf: Adopt perf_evsel__alloc_fd() function " Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 089/107] libperf: Adopt simplified perf_evsel__open() " Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 090/107] libperf: Adopt simplified perf_evsel__close() " Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 091/107] libperf: Adopt perf_evsel__read() " Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 092/107] libperf: Adopt perf_evsel__enable()/disable()/apply_filter() functions Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 093/107] libperf: Add perf_cpu_map__for_each_cpu() macro Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 094/107] libperf: Add perf_evsel__cpus()/threads() functions Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 095/107] libperf: Adopt simplified perf_evlist__open()/close() functions from tools/perf Arnaldo Carvalho de Melo
2019-07-30  2:55 ` [PATCH 096/107] libperf: Adopt perf_evlist__enable()/disable() functions from perf Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 097/107] libperf: Add perf_evsel__attr() function Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 098/107] libperf: Add install targets Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 099/107] libperf: Add tests support Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 100/107] libperf: Add perf_cpu_map test Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 101/107] libperf: Add perf_thread_map test Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 102/107] libperf: Add perf_evlist test Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 103/107] libperf: Add perf_evsel tests Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 104/107] libperf: Add perf_evlist__enable/disable test Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 105/107] libperf: Add perf_evsel__enable/disable test Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 106/107] libperf: Initial documentation Arnaldo Carvalho de Melo
2019-07-30  2:56 ` [PATCH 107/107] perf vendor events power9: Added missing event descriptions Arnaldo Carvalho de Melo
2019-07-30  2:56   ` Arnaldo Carvalho de Melo
2019-07-31 11:56   ` Michael Ellerman
2019-07-31 11:56     ` Michael Ellerman
2019-07-30  8:03 ` [GIT PULL 000/107] perf/core improvements and fixes Ingo Molnar
2019-07-30  8:50   ` Thomas Gleixner
2019-07-30 10:13     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190730025610.22603-58-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.