diff options
author | Andrew Murray <andrew.murray@arm.com> | 2019-04-09 15:22:17 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2019-04-24 10:46:26 -0400 |
commit | a9bf3130ebfe0378df449a1b13997c47a58e661a (patch) | |
tree | 4fb87b3993757a3c4200e3f6aea6a67d578970bf | |
parent | 39e3406a090a54e700a7c0820c8258af1196b0c2 (diff) |
arm64: docs: Document perf event attributes
The interaction between the exclude_{host,guest} flags,
exclude_{user,kernel,hv} flags and presence of VHE can result in
different exception levels being filtered by the ARMv8 PMU. As this
can be confusing let's document how they work on arm64.
Signed-off-by: Andrew Murray <andrew.murray@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | Documentation/arm64/perf.txt | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/Documentation/arm64/perf.txt b/Documentation/arm64/perf.txt new file mode 100644 index 000000000000..0d6a7d87d49e --- /dev/null +++ b/Documentation/arm64/perf.txt | |||
@@ -0,0 +1,85 @@ | |||
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. | ||