Merge tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / Documentation / arm64 / perf.txt
1 Perf Event Attributes
2 =====================
3
4 Author: Andrew Murray <andrew.murray@arm.com>
5 Date: 2019-03-06
6
7 exclude_user
8 ------------
9
10 This attribute excludes userspace.
11
12 Userspace always runs at EL0 and thus this attribute will exclude EL0.
13
14
15 exclude_kernel
16 --------------
17
18 This attribute excludes the kernel.
19
20 The kernel runs at EL2 with VHE and EL1 without. Guest kernels always run
21 at EL1.
22
23 For the host this attribute will exclude EL1 and additionally EL2 on a VHE
24 system.
25
26 For the guest this attribute will exclude EL1. Please note that EL2 is
27 never counted within a guest.
28
29
30 exclude_hv
31 ----------
32
33 This attribute excludes the hypervisor.
34
35 For a VHE host this attribute is ignored as we consider the host kernel to
36 be the hypervisor.
37
38 For a non-VHE host this attribute will exclude EL2 as we consider the
39 hypervisor to be any code that runs at EL2 which is predominantly used for
40 guest/host transitions.
41
42 For the guest this attribute has no effect. Please note that EL2 is
43 never counted within a guest.
44
45
46 exclude_host / exclude_guest
47 ----------------------------
48
49 These attributes exclude the KVM host and guest, respectively.
50
51 The KVM host may run at EL0 (userspace), EL1 (non-VHE kernel) and EL2 (VHE
52 kernel or non-VHE hypervisor).
53
54 The KVM guest may run at EL0 (userspace) and EL1 (kernel).
55
56 Due to the overlapping exception levels between host and guests we cannot
57 exclusively rely on the PMU's hardware exception filtering - therefore we
58 must enable/disable counting on the entry and exit to the guest. This is
59 performed differently on VHE and non-VHE systems.
60
61 For non-VHE systems we exclude EL2 for exclude_host - upon entering and
62 exiting the guest we disable/enable the event as appropriate based on the
63 exclude_host and exclude_guest attributes.
64
65 For VHE systems we exclude EL1 for exclude_guest and exclude both EL0,EL2
66 for exclude_host. Upon entering and exiting the guest we modify the event
67 to include/exclude EL0 as appropriate based on the exclude_host and
68 exclude_guest attributes.
69
70 The statements above also apply when these attributes are used within a
71 non-VHE guest however please note that EL2 is never counted within a guest.
72
73
74 Accuracy
75 --------
76
77 On non-VHE hosts we enable/disable counters on the entry/exit of host/guest
78 transition at EL2 - however there is a period of time between
79 enabling/disabling the counters and entering/exiting the guest. We are
80 able to eliminate counters counting host events on the boundaries of guest
81 entry/exit when counting guest events by filtering out EL2 for
82 exclude_host. However when using !exclude_hv there is a small blackout
83 window at the guest entry/exit where host events are not captured.
84
85 On VHE systems there are no blackout windows.