mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
kvm: x86/pmu: Fix the compare function used by the pmu event filter
[ Upstream commit4ac19ead0d
] 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:7ff775aca4
("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7f9c8edddd
commit
3b41960085
1 changed files with 5 additions and 2 deletions
|
@ -171,9 +171,12 @@ static bool pmc_resume_counter(struct kvm_pmc *pmc)
|
|||
return true;
|
||||
}
|
||||
|
||||
static int cmp_u64(const void *a, const void *b)
|
||||
static int cmp_u64(const void *pa, const void *pb)
|
||||
{
|
||||
return *(__u64 *)a - *(__u64 *)b;
|
||||
u64 a = *(u64 *)pa;
|
||||
u64 b = *(u64 *)pb;
|
||||
|
||||
return (a > b) - (a < b);
|
||||
}
|
||||
|
||||
void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel)
|
||||
|
|
Loading…
Add table
Reference in a new issue