Commit e35529f
committed
KVM: x86/pmu: Check eventsel first when emulating (branch) insns retired
When triggering events, i.e. emulating PMC events in software, check for
a matching event selector before checking the event is allowed. The "is
allowed" check *might* be cheap, but it could also be very costly, e.g. if
userspace has defined a large PMU event filter. The event selector check
on the other hand is all but guaranteed to be <10 uops, e.g. looks
something like:
0xffffffff8105e615 <+5>: movabs $0xf0000ffff,%rax
0xffffffff8105e61f <+15>: xor %rdi,%rsi
0xffffffff8105e622 <+18>: test %rax,%rsi
0xffffffff8105e625 <+21>: sete %al
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>1 parent afda2d7 commit e35529f
1 file changed
+3
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
857 | 857 | | |
858 | 858 | | |
859 | 859 | | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | 860 | | |
864 | 861 | | |
865 | 862 | | |
| |||
874 | 871 | | |
875 | 872 | | |
876 | 873 | | |
877 | | - | |
| 874 | + | |
| 875 | + | |
878 | 876 | | |
879 | 877 | | |
880 | | - | |
881 | | - | |
| 878 | + | |
882 | 879 | | |
883 | 880 | | |
884 | 881 | | |
| |||
0 commit comments