Commit f19063b
committed
KVM: x86/pmu: Snapshot event selectors that KVM emulates in software
Snapshot the event selectors for the events that KVM emulates in software,
which is currently instructions retired and branch instructions retired.
The event selectors a tied to the underlying CPU, i.e. are constant for a
given platform even though perf doesn't manage the mappings as such.
Getting the event selectors from perf isn't exactly cheap, especially if
mitigations are enabled, as at least one indirect call is involved.
Snapshot the values in KVM instead of optimizing perf as working with the
raw event selectors will be required if KVM ever wants to emulate events
that aren't part of perf's uABI, i.e. that don't have an "enum perf_hw_id"
entry.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>1 parent d2b321e commit f19063b
4 files changed
+24
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
819 | 822 | | |
820 | 823 | | |
821 | 824 | | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | 825 | | |
830 | 826 | | |
831 | 827 | | |
| |||
845 | 841 | | |
846 | 842 | | |
847 | 843 | | |
848 | | - | |
| 844 | + | |
849 | 845 | | |
850 | 846 | | |
851 | 847 | | |
| |||
865 | 861 | | |
866 | 862 | | |
867 | 863 | | |
868 | | - | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
869 | 868 | | |
870 | 869 | | |
871 | 870 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| 179 | + | |
174 | 180 | | |
175 | 181 | | |
176 | 182 | | |
| |||
212 | 218 | | |
213 | 219 | | |
214 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
215 | 226 | | |
216 | 227 | | |
217 | 228 | | |
| |||
259 | 270 | | |
260 | 271 | | |
261 | 272 | | |
262 | | - | |
| 273 | + | |
263 | 274 | | |
264 | 275 | | |
265 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3606 | 3606 | | |
3607 | 3607 | | |
3608 | 3608 | | |
3609 | | - | |
| 3609 | + | |
3610 | 3610 | | |
3611 | 3611 | | |
3612 | 3612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8903 | 8903 | | |
8904 | 8904 | | |
8905 | 8905 | | |
8906 | | - | |
| 8906 | + | |
8907 | 8907 | | |
8908 | 8908 | | |
8909 | 8909 | | |
| |||
9216 | 9216 | | |
9217 | 9217 | | |
9218 | 9218 | | |
9219 | | - | |
| 9219 | + | |
9220 | 9220 | | |
9221 | | - | |
| 9221 | + | |
9222 | 9222 | | |
9223 | 9223 | | |
9224 | 9224 | | |
| |||
0 commit comments