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

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

From: Rob Herring <robh@kernel.org>
Date: 2020-09-02 17:01:33
Also in: lkml

On Mon, Aug 31, 2020 at 3:11 AM Jiri Olsa [off-list ref] wrote:
On Fri, Aug 28, 2020 at 02:56:10PM -0600, Rob Herring wrote:

SNIP
quoted
+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
Adding a size arg is simple enough to do and saves the hard naming problem. :)

Rob

_______________________________________________
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