linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [perf] why is /proc/sys/kernel/perf_user_access ARM64 only?
@ 2022-06-15 17:57 Vince Weaver
  2022-06-15 19:46 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Vince Weaver @ 2022-06-15 17:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Catalin Marinas,
	linux-perf-users, Will Deacon, Mark Rutland, Rob Herring


Just wasted a lot of time tracking down why rdpmc() event reading wasn't 
working on an ARM64 machine.

It turns out ARM64 has added a custom
	"/proc/sys/kernel/perf_user_access"
to control rdpmc access, but only on ARM64.
	e2012600810c9ded81f6f63a8d04781be3c300ad

Why is this ARM64-only?  Why isn't this generic perf infrastructure?
How is this different from the existing
	/sys/bus/event_source/devices/cpu/rdpmc
tooling?

Also, when user events are disabled, why is the ARMv8 PMU not disabling
the cap_user_rdpmc bit in the perf mmap() page?

rdpmc was trouble before, but now it's an even bigger 
architecture-dependent mess just trying to figure out if the feature is 
enabled or not.

Vince

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [perf] why is /proc/sys/kernel/perf_user_access ARM64 only?
  2022-06-15 17:57 [perf] why is /proc/sys/kernel/perf_user_access ARM64 only? Vince Weaver
@ 2022-06-15 19:46 ` Rob Herring
  2022-06-17 20:11   ` Vince Weaver
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2022-06-15 19:46 UTC (permalink / raw)
  To: Vince Weaver
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Catalin Marinas, linux-perf-users, Will Deacon,
	Mark Rutland

On Wed, Jun 15, 2022 at 11:57 AM Vince Weaver <vincent.weaver@maine.edu> wrote:
>
>
> Just wasted a lot of time tracking down why rdpmc() event reading wasn't
> working on an ARM64 machine.
>
> It turns out ARM64 has added a custom
>         "/proc/sys/kernel/perf_user_access"
> to control rdpmc access, but only on ARM64.
>         e2012600810c9ded81f6f63a8d04781be3c300ad
>
> Why is this ARM64-only?  Why isn't this generic perf infrastructure?

Adding it on x86 would break users at least if default off.

> How is this different from the existing
>         /sys/bus/event_source/devices/cpu/rdpmc
> tooling?

big.LITTLE

We need a single point of control. Otherwise, there's dealing with
mismatched state of multiple PMUs.

> Also, when user events are disabled, why is the ARMv8 PMU not disabling
> the cap_user_rdpmc bit in the perf mmap() page?

Humm, maybe that should be changed. The current behavior of
cap_user_rdpmc is static for the event and set means user access may
be enabled at some point. Several factors can still prevent userspace
from getting an event index. A counter couldn't be allocated or
perf_user_access is disabled.

Should the event open fail if perf_user_access is disabled? Current
operation is it isn't considered and perf_user_access can change while
the event is opened.

> rdpmc was trouble before, but now it's an even bigger
> architecture-dependent mess just trying to figure out if the feature is
> enabled or not.

The thing is that x86 started with access being wide open and has
since been trying to lock things down without breaking userspace. It
still has questionable uses enabled which complicates the
implementation. For arm, we're starting with access being an explicit
request on open and only for task bound events. If there's a real need
for other scenarios, then we can revisit that.

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [perf] why is /proc/sys/kernel/perf_user_access ARM64 only?
  2022-06-15 19:46 ` Rob Herring
@ 2022-06-17 20:11   ` Vince Weaver
  0 siblings, 0 replies; 3+ messages in thread
From: Vince Weaver @ 2022-06-17 20:11 UTC (permalink / raw)
  To: Rob Herring
  Cc: Vince Weaver, linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Catalin Marinas, linux-perf-users, Will Deacon,
	Mark Rutland

On Wed, 15 Jun 2022, Rob Herring wrote:

> On Wed, Jun 15, 2022 at 11:57 AM Vince Weaver <vincent.weaver@maine.edu> wrote:
> > It turns out ARM64 has added a custom
> >         "/proc/sys/kernel/perf_user_access"
> > to control rdpmc access, but only on ARM64.
> >         e2012600810c9ded81f6f63a8d04781be3c300ad
> >
> > Why is this ARM64-only?  Why isn't this generic perf infrastructure?
> 
> Adding it on x86 would break users at least if default off.

Well in theory the file could have been added on x86 but default to on.
Some of the low-level perf feature detection is bad enough as is, without
having architecture-dependent proc files to worry about too.

> > How is this different from the existing
> >         /sys/bus/event_source/devices/cpu/rdpmc
> > tooling?
> 
> big.LITTLE

interesting.  I wonder how x86 Alder Lake deals with things.

In any case I guess it's really too late to do anything about this.  I 
should check to make sure the manpage gets updated.

Vince

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-17 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 17:57 [perf] why is /proc/sys/kernel/perf_user_access ARM64 only? Vince Weaver
2022-06-15 19:46 ` Rob Herring
2022-06-17 20:11   ` Vince Weaver

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).