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