diff options
author | Sean Christopherson <seanjc@google.com> | 2023-11-10 05:28:56 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-02-01 20:35:48 +0300 |
commit | e35529fb4ac930a4a39e0c15bafcb28a30d26611 (patch) | |
tree | 27ef009c0846b25be27ccc2fcd14a9b7272cf475 /lib/test-string_helpers.c | |
parent | afda2d7666f894d1d7b8406cf54801e6c11f63c2 (diff) | |
download | linux-e35529fb4ac930a4a39e0c15bafcb28a30d26611.tar.xz |
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/20231110022857.1273836-10-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'lib/test-string_helpers.c')
0 files changed, 0 insertions, 0 deletions