File perf-evsel-set-attr-exclude_kernel-when-probing-max-attr-precise_ip.patch of Package perf
67
1
From: Arnaldo Carvalho de Melo <acme@redhat.com>
2
Date: Mon, 3 Jul 2017 17:01:41 -0300
3
Subject: perf evsel: Set attr.exclude_kernel when probing max attr.precise_ip
4
Git-commit: 97365e81366f5ca16a9ce66cff4dd4c5b0d9f4db
5
Patch-mainline: v4.13-rc1
6
References: bsc#1070010 (git-fixes)
7
Signed-off-By: Tony Jones <tonyj@suse.de>
8
9
We should set attr.exclude_kernel when probing for attr.precise_ip
10
level, otherwise !CAP_SYS_ADMIN users will not default to skidless
11
samples in capable hardware.
12
13
The increase in the paranoid level in commit 0161028b7c8a ("perf/core:
14
Change the default paranoia level to 2") broke this, fix it by excluding
15
kernel samples when probing.
16
17
Before:
18
19
$ perf record usleep 1
20
[ perf record: Woken up 1 times to write data ]
21
[ perf record: Captured and wrote 0.018 MB perf.data (6 samples) ]
22
$ perf evlist -v
23
cycles:u: sample_freq: 4000, sample_type: IP|TID|TIME|PERIOD, exclude_kernel: 1
24
25
After:
26
27
$ perf record usleep 1
28
[ perf record: Woken up 1 times to write data ]
29
[ perf record: Captured and wrote 0.018 MB perf.data (8 samples) ]
30
$ perf evlist -v
31
cycles:ppp: sample_freq: 4000, sample_type: IP|TID|TIME|PERIOD, exclude_kernel: 1, precise_ip: 3
32
^^^^^^^^^^^^^
33
^^^^^^^^^^^^^
34
^^^^^^^^^^^^^
35
$
36
37
To further clarify: we always set .exclude_kernel when non !CAP_SYS_ADMIN
38
users profile, its just on the attr.precise_ip probing that we weren't doing
39
so, fix it.
40
41
Cc: Adrian Hunter <adrian.hunter@intel.com>
42
Cc: Andy Lutomirski <luto@kernel.org>
43
Cc: David Ahern <dsahern@gmail.com>
44
Cc: Jiri Olsa <jolsa@kernel.org>
45
Cc: Namhyung Kim <namhyung@kernel.org>
46
Cc: Wang Nan <wangnan0@huawei.com>
47
Fixes: 7f8d1ade1b19 ("perf tools: By default use the most precise "cycles" hw counter available")
48
Link: http://lkml.kernel.org/n/tip-t2qttwhbnua62o5gt75cueml@git.kernel.org
49
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
50
---
51
tools/perf/util/evsel.c | 1 +
52
1 file changed, 1 insertion(+)
53
54
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
55
index cda44b0e821c..91192415f38d 100644
56
--- a/tools/perf/util/evsel.c
57
+++ b/tools/perf/util/evsel.c
58
59
struct perf_event_attr attr = {
60
.type = PERF_TYPE_HARDWARE,
61
.config = PERF_COUNT_HW_CPU_CYCLES,
62
+ .exclude_kernel = 1,
63
};
64
struct perf_evsel *evsel;
65
66
67