Thread (18 messages) 18 messages, 3 authors, 2020-09-04

Re: [PATCH v2 5/9] libperf: Add support for user space counter access

From: Jiri Olsa <hidden>
Date: 2020-08-31 09:11:50
Also in: lkml

On Fri, Aug 28, 2020 at 02:56:10PM -0600, Rob Herring wrote:

SNIP
 
+void *perf_evsel__mmap(struct perf_evsel *evsel)
+{
+	int ret;
+	struct perf_mmap *map;
+	struct perf_mmap_param mp = {
+		.mask = -1,
+		.prot = PROT_READ | PROT_WRITE,
+	};
+
+	if (FD(evsel, 0, 0) < 0)
+		return NULL;
+
+	map = zalloc(sizeof(*map));
+	if (!map)
+		return NULL;
+
+	perf_mmap__init(map, NULL, false, NULL);
+
+	ret = perf_mmap__mmap(map, &mp, FD(evsel, 0, 0), 0);
+	if (ret) {
+		free(map);
+		return NULL;
+	}
+
+	evsel->mmap = map;
+	return map->base;
+}
so this only maps first page, I think we should use different
name and keep perf_evsel__mmap for some generic map with size

perf_evsel__mmap_user
perf_evsel__mmap_zero
...?

not sure.. or we could add size argument

jirka


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help