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