]> git.baikalelectronics.ru Git - kernel.git/commit
kvm: x86/pmu: Fix the compare function used by the pmu event filter
authorAaron Lewis <aaronlewis@google.com>
Tue, 17 May 2022 05:12:36 +0000 (05:12 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 20 May 2022 11:06:29 +0000 (07:06 -0400)
commitd2c8e0bc02334b07348d6a0e297897243d5fa969
tree503f77d5e4605325356792e629b5544c4ab9c075
parentb4818c986af1409253a9d05b564df26c2b4775ac
kvm: x86/pmu: Fix the compare function used by the pmu event filter

When returning from the compare function the u64 is truncated to an
int.  This results in a loss of the high nybble[1] in the event select
and its sign if that nybble is in use.  Switch from using a result that
can end up being truncated to a result that can only be: 1, 0, -1.

[1] bits 35:32 in the event select register and bits 11:8 in the event
    select.

Fixes: 4db5fc874f645 ("KVM: x86/pmu: Use binary search to check filtered events")
Signed-off-by: Aaron Lewis <aaronlewis@google.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220517051238.2566934-1-aaronlewis@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/pmu.c