> On Fri, 1 Aug 2025 12:21:05 +0200
> Tomasz Duszynski <tduszyn...@marvell.com> wrote:
>
> > /proc/sys/kernel/perf_user_access attribute allow user process to access
> > perf counters. Though in order to change it binary requires elevated
> > capabilities or must be run as root. If that's not the case counter
> > access remains disabled. Hence to avoid confusion log message that
> > that warns user about that.
> >
> > Signed-off-by: Tomasz Duszynski <tduszyn...@marvell.com>
> > ---
>
> What do Linux perf tools do in this case?

perf does not collect data directly reading pmu rigisters. It gets data by 
calling read() on
descriptor returned by perf_event_open().

This series on the other hand, is for allowing that direct through-register 
access to save on
cycles.

`perf test -v user` may be used to check if direct access can work.

On arm64 with perf_user_access=0:

$ perf test -v user
Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, 
etc
  4.2: User space counter reading of instructions                    : Skip 
(permissions)
  4.3: User space counter reading of cycles                          : Skip 
(permissions)

On arm64 with perf_user_access=1:

$ perf test -v user
Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, 
etc
  4.2: User space counter reading of instructions                    : Ok
  4.3: User space counter reading of cycles                          : Ok

On x86 there is no perf_user_access knob available so you achieve same 
functionality with
perf_event_paranoid.

Reply via email to