Thread (56 messages) 56 messages, 8 authors, 2020-07-22

Re: [PATCH v8 00/12] Introduce CAP_PERFMON to secure system performance monitoring and observability

From: Alexey Budankov <hidden>
Date: 2020-04-07 16:53:04
Also in: intel-gfx, linux-doc, linux-man, lkml, selinux

On 07.04.2020 19:36, Arnaldo Carvalho de Melo wrote:
Em Tue, Apr 07, 2020 at 05:54:27PM +0300, Alexey Budankov escreveu:
quoted
On 07.04.2020 17:35, Arnaldo Carvalho de Melo wrote:
quoted
Em Tue, Apr 07, 2020 at 11:30:14AM -0300, Arnaldo Carvalho de Melo escreveu:
quoted
[perf@five ~]$ type perf
<SNIP>
quoted
quoted
quoted
perf is hashed (/home/perf/bin/perf)
[perf@five ~]$
Humm, perf record falls back to cycles:u after initially trying cycles
(i.e. kernel and userspace), lemme see trying 'perf top -e cycles:u',
lemme test, humm not really:

[perf@five ~]$ perf top --stdio -e cycles:u
Error:
Failed to mmap with 1 (Operation not permitted)
[perf@five ~]$ perf record -e cycles:u -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.123 MB perf.data (132 samples) ]
[perf@five ~]$

Back to debugging this.
Could makes sense adding cap_ipc_lock to the binary to isolate from this:

kernel/events/core.c: 6101
	if ((locked > lock_limit) && perf_is_paranoid() &&
		!capable(CAP_IPC_LOCK)) {
		ret = -EPERM;
		goto unlock;
	}

That did the trick, I'll update the documentation and include in my
"Committer testing" section:
Looks like top mode somehow reaches perf mmap limit described here [1].
Using -m option solves the issue avoiding cap_ipc_lock on my 8 cores machine:
perf top -e cycles -m 1

~Alexey

[1] https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html#memory-allocation
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help