Linux Perf Users
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Rob Herring <robh@kernel.org>
Cc: Will Deacon <will@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Vince Weaver <vincent.weaver@maine.edu>,
	Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
	Zachary.Leaf@arm.com, Catalin Marinas <catalin.marinas@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, X86 ML <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v11 0/5] arm64 userspace counter support
Date: Wed, 27 Oct 2021 13:20:56 +0100	[thread overview]
Message-ID: <20211027122056.GD54628@C02TD0UTHF1T.local> (raw)
In-Reply-To: <CAL_Jsq+JLcWESzGzjsmrir+gCFEO88YMYdj+FOBhjZgSBNOeVA@mail.gmail.com>

On Tue, Oct 26, 2021 at 08:34:35AM -0500, Rob Herring wrote:
> On Tue, Oct 26, 2021 at 8:10 AM Mark Rutland <mark.rutland@arm.com> wrote:
> >
> > On Tue, Oct 19, 2021 at 06:19:02PM -0500, Rob Herring wrote:
> > > Another version of arm64 userspace counter access support.
> > >
> > > The arm64 support departs from the x86 implementation by requiring the user
> > > to explicitly request user access (via attr.config1) and only enables access
> > > for task bound events. Since usage is explicitly requested, access is
> > > enabled at perf_event_open() rather than on mmap() as that greatly
> > > simplifies the implementation. Rather than trying to lock down the access
> > > as the x86 implementation has been doing, we can start with only a limited
> > > use case enabled and later expand it if needed.
> > >
> > > I've run this version thru Vince's perf tests[13] with arm64 support added.
> > > I wish I'd found these tests sooner...
> >
> > When you say "with arm64 support added", do you mean with patches not
> > yet upstreamed?
> 
> Correct.

Did that require significant changes? I'd like to be able to run the
tests locally if possible.

> > I took a look at the upstream repo, and there's some existing RDPMC
> > support even though upstream never previously supported userspace
> > access. That support code uses PMSELR_EL0, which this series adds no
> > provisions for.
> >
> > Kernel-side, we'll need to either:
> >
> > * Document that PMSELR_EL0 is unreliable, and explcitly zero it within
> >   the kernel such that it cnanot be used as a covert channel. Get the
> >   tests updated to not rely on the never-previously-supported use of
> >   PMSELR_EL0.
> >
> > * Context switch PMSELR_EL0 (which'll IIUC is unreliable for big.LITTLE,
> >   even where the registers exist on each CPU).
> 
> Whether we support userspace using PMSELR_EL0 or not, we just need to
> zero it when userspace access is enabled (like the dirty counters).

Sure; doing that in armv8pmu_enable_user_access() makes sense to me,
given it's not exposed to userspace otherwise, and the kernel itself
doesn't care.

If we do that, I think that we should document that it may be zero'd
arbitrarily from userspace's PoV. That should only need a sentence or
two in the documentation added in the final patch.

Thanks,
Mark.

      reply	other threads:[~2021-10-27 12:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 23:19 [PATCH v11 0/5] arm64 userspace counter support Rob Herring
2021-10-19 23:19 ` [PATCH v11 1/5] x86: perf: Move RDPMC event flag to a common definition Rob Herring
2021-10-19 23:19 ` [PATCH v11 2/5] perf: Add a counter for number of user access events in context Rob Herring
2021-10-19 23:19 ` [PATCH v11 3/5] arm64: perf: Add userspace counter access disable switch Rob Herring
2021-10-19 23:19 ` [PATCH v11 4/5] arm64: perf: Enable PMU counter userspace access for perf event Rob Herring
2021-10-26 13:11   ` Mark Rutland
2021-10-19 23:19 ` [PATCH v11 5/5] Documentation: arm64: Document PMU counters access from userspace Rob Herring
2021-10-26 13:10 ` [PATCH v11 0/5] arm64 userspace counter support Mark Rutland
2021-10-26 13:34   ` Rob Herring
2021-10-27 12:20     ` Mark Rutland [this message]

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=20211027122056.GD54628@C02TD0UTHF1T.local \
    --to=mark.rutland@arm.com \
    --cc=Zachary.Leaf@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=robh@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.weaver@maine.edu \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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