[PATCH 0/4] KVM/ARM: Misc PMU fixes

From: Eric Auger
Date: Fri Jan 24 2020 - 09:25:55 EST


While writing new PMUv3 event counter kvm-unit-tests I found
some bugs related to the chained counter implementation:

- the enable state of the high counter is not taken into account,
- chain counters are not implemented along with SW_INCR type,
- SW_INCR does not take into account the global enable state

The last patch rather is an optimization that avoids manipulating
non supported counters.

Best Regards

Eric

This series can be found at:
https://github.com/eauger/linux/tree/v5.5-rc7-pmu-fixes-v1

Test:
Tested with kvm-unit-tests [1]: all tests now pass,
at the exception of one sub-test in pmu-chain-promotion
but this is a bug in test.

Other testing at higher level (perf) appreciated.

references:
[1] KVM: arm64: PMUv3 Event Counter Tests
(https://lore.kernel.org/kvmarm/c1831b6c-dc75-1bd3-6657-0375682c30af@xxxxxxxxxx/T/)

History:

RFC -> v1:
- remove [RFC 3/3] KVM: arm64: pmu: Enforce PMEVTYPER evtCount size
- add KVM: arm64: pmu: Only handle supported event counters
- Take into account the enable state of the CHAIN high counter
- revisit kvm_pmu_software_increment() implementation as suggested
by Marc


Eric Auger (4):
KVM: arm64: pmu: Don't increment SW_INCR if PMCR.E is unset
KVM: arm64: pmu: Don't mark a counter as chained if the odd one is
disabled
KVM: arm64: pmu: Fix chained SW_INCR counters
KVM: arm64: pmu: Only handle supported event counters

virt/kvm/arm/pmu.c | 114 +++++++++++++++++++++++++++------------------
1 file changed, 69 insertions(+), 45 deletions(-)

--
2.20.1