Re: [PATCH] perf probe: Provide more detail with relocation warning

From: Arnaldo Carvalho de Melo
Date: Wed Jun 02 2021 - 09:15:56 EST


Em Wed, Jun 02, 2021 at 09:12:48PM +0900, Masami Hiramatsu escreveu:
> On Wed, 2 Jun 2021 08:52:41 -0300 Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > Em Wed, May 26, 2021 at 11:20:20PM +0900, Masami Hiramatsu escreveu:
> > > On Wed, 26 May 2021 09:56:29 -0300 Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > > > I.e. go the extra step and show what the current value is and what it
> > > > needs to be to achieve what is being attempted.

> > > > IOW combine error message with relevant documentation, to save steps.

> > > > See what 'perf top' does for an unpriv user:

> > > > $ perf top --stdio
> > > > Error:
> > > > Access to performance monitoring and observability operations is limited.
> > > > Enforced MAC policy settings (SELinux) can limit access to performance
> > > > monitoring and observability operations. Inspect system audit records for
> > > > more perf_event access control information and adjusting the policy.
> > > > Consider adjusting /proc/sys/kernel/perf_event_paranoid setting to open
> > > > access to performance monitoring and observability operations for processes
> > > > without CAP_PERFMON, CAP_SYS_PTRACE or CAP_SYS_ADMIN Linux capability.
> > > > More information can be found at 'Perf events and tool security' document:
> > > > https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html
> > > > perf_event_paranoid setting is 2:
> > > > -1: Allow use of (almost) all events by all users
> > > > Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK
> > > > >= 0: Disallow raw and ftrace function tracepoint access
> > > > >= 1: Disallow CPU event access
> > > > >= 2: Disallow kernel profiling
> > > > To make the adjusted perf_event_paranoid setting permanent preserve it
> > > > in /etc/sysctl.conf (e.g. kernel.perf_event_paranoid = <setting>)

> > > Hmm, I would rather like pointing manpages...

> > Man pages are long, if you quote the relevant part of it when the
> > problem takes place, IMHO it helps the user.

> OK, but please also update man pages (*), which can provide a summarized information
> for users if they noticed that. And for each place, I will add some messages
> for letting them know.

Sure, its not one or the other, its both, i.e. man pages are interesting
as the standard reference for a command, while making tools provide
information about a specific problem with actionable advice on how to
fix the problem at hand is important as well.

> (*) https://lore.kernel.org/lkml/162204068898.388434.16842705842611255787.stgit@devnote2/

I saw your patch to the man page and asked Ravi for an Ack/Reviewed-by,

Thanks for all your continued work on this! :-)

- Arnaldo