linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vince Weaver <vincent.weaver@maine.edu>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>,
	linux-kernel@vger.kernel.org, Will Deacon <will.deacon@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: perf: multiple mmap of fd behavior on x86/ARM
Date: Fri, 11 Aug 2017 11:25:37 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.20.1708111114370.2445@macbook-air> (raw)
In-Reply-To: <20170811100127.GB12985@leverpostej>

On Fri, 11 Aug 2017, Mark Rutland wrote:

> IIUC by 'rdpmc' you mean direct userspace counter access?
> 
> Patches for that never made it upstream. Last I saw, there were no
> patches in a suitable state for review.

yes, someone from Linaro sent me some code a while back that implemented 
the userspace side and claimed the kernel patches would appear at some 
point.  I should try to dig up that e-mail.

The "rdpmc" code looked something like this
	if (counter == PERF_COUNT_HW_CPU_CYCLES)
                asm volatile("mrs %0, pmccntr_el0" : "=r" (ret));
        else {
                asm volatile("msr pmselr_el0, %0" : : "r" ((counter-1)));
                asm volatile("mrs %0, pmxevcntr_el0" : "=r" (ret));
        }


> > On ARM/ARM64 you can only mmap() it once, any other attempts fail.
> 
> Interesting. Which platform(s) are you testing on, with which kernel
> version(s)?

This is on a Dragonbaord 401c running a vendor 64-bit 4.4 kernel,
a Nvidia Jetson TX-1 board running a 64-bit 3.10 vendor kernel,
as well as a Raspberry Pi 3B running a 32-bit 4.9 pi foundation kernel.

It's a pain getting a recent-git kernel on these boards but I'm most of 
the way to getting one booting on the Pi 3B.  (got distracted by the fact 
that Linpack still reliably crashes the Pi-3b even with a heatsink).

Here's strace from the Dragonboard:
perf_event_open(0x7fc649e900, 0, -1, -1, 0) = 3
mmap(NULL, 36864, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0x7f7e1b1000
mmap(NULL, 36864, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = -1 EINVAL (Invalid argument)

Vince

  parent reply	other threads:[~2017-08-11 15:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 18:48 perf: multiple mmap of fd behavior on x86/ARM Vince Weaver
2017-08-11 10:01 ` Mark Rutland
2017-08-11 10:52   ` Peter Zijlstra
2017-08-11 11:06     ` Mark Rutland
2017-08-11 14:53       ` Peter Zijlstra
2017-08-14 10:57         ` Will Deacon
2017-08-11 15:25   ` Vince Weaver [this message]
2017-08-11 16:23     ` Mark Rutland
2017-08-11 16:51       ` Vince Weaver
2017-08-11 17:09         ` Mark Rutland
2017-08-11 19:01           ` Vince Weaver

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=alpine.DEB.2.20.1708111114370.2445@macbook-air \
    --to=vincent.weaver@maine.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will.deacon@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).