diff options
author | Marc Zyngier <maz@kernel.org> | 2019-10-03 18:02:08 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2019-10-20 10:47:07 +0100 |
commit | f4e23cf9477452640d2522f3286db5df6fcfe45a (patch) | |
tree | 3ba0f3b6e9dc1c02ec973ca96dabf3f068d32375 /lib/math | |
parent | da0c9ea146cbe92b832f1b0f694840ea8eb33cce (diff) | |
download | linux-f4e23cf9477452640d2522f3286db5df6fcfe45a.tar.bz2 |
KVM: arm64: pmu: Fix cycle counter truncation
When a counter is disabled, its value is sampled before the event
is being disabled, and the value written back in the shadow register.
In that process, the value gets truncated to 32bit, which is adequate
for any counter but the cycle counter (defined as a 64bit counter).
This obviously results in a corrupted counter, and things like
"perf record -e cycles" not working at all when run in a guest...
A similar, but less critical bug exists in kvm_pmu_get_counter_value.
Make the truncation conditional on the counter not being the cycle
counter, which results in a minor code reorganisation.
Fixes: 80f393a23be6 ("KVM: arm/arm64: Support chained PMU counters")
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Reported-by: Julien Thierry <julien.thierry.kdev@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'lib/math')
0 files changed, 0 insertions, 0 deletions