Re: perf: multiple mmap of fd behavior on x86/ARM

Vince Weaver
2017-08-11T16:51:21Z

On Fri, 11 Aug 2017, Mark Rutland wrote:

> IIRC, patches were sent back in 2014, but as I mentioned above, those
> were far from suitable for upstream, even ignoring cases like
> big.LITTLE. Said patches were never reworked and reposted.

Here's the commit message in the perf_event_tests tree, having trouble
finding the original e-mail that went with it.

commit 2cc2e21e349243889ba59408527cc1a97dd0dc44
Author: Yogesh Tillu <yogesh.tillu@linaro.org>
Date: Tue Mar 1 14:18:22 2016 +0530

Add support for RDPMC test with mmap way

This test adds support for reading perf hw counter from userspace.
Method (2)
rdpmc_comparision_mmap:
Test read perf hw counter in userspace using open/mmap syscall.
It requires kernel with perf mmap patchset and
echo 1 > /sys/bus/platform/drivers/armv8-pmu/rdpmc

Above Method Tested On:(X86/ARM)
It is tested with perf mmap patchset on kernel v4.5.0-rc5+
With above Tests, we can benchmark access of perf hw counters in
userspace with syscall vs perf_event_mmap_page way.

Signed-off-by: Yogesh Tillu <yogesh.tillu@linaro.org>

> Just to check, how does x86 behave on each of those kernel releases?
>
> Many things have changed since v4.4.

I'm fairly sure this test (well, the equivelent code in
tests/record_sample/record_mmap that I based the test on) has been passing
on all of my x86 test machines since ~3.10 or so, or else I would noticed.

If I can get a custom kernel to boot on one of my machines I can start
digging in and see if I can find where the EINVAL comes from.

This isn't some key thing that needs to be fixed, I was just curious about
the behavior difference between x86 and ARM. There are a few other minor
x86/ARM diferences, especially realting to perf_event_open() error
returns, that I had to special case in a few of my tests.

Vince