linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] KVM: arm/arm64: add support for chained counters
@ 2019-02-04 16:53 Andrew Murray
  2019-02-04 16:53 ` [PATCH v2 1/5] KVM: arm/arm64: rename kvm_pmu_{enable/disable}_counter functions Andrew Murray
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Andrew Murray @ 2019-02-04 16:53 UTC (permalink / raw)
  To: Christoffer Dall, Marc Zyngier
  Cc: Julien Thierry, kvmarm, linux-arm-kernel, suzuki.poulose

ARMv8 provides support for chained PMU counters, where an event type
of 0x001E is set for odd-numbered counters, the event counter will
increment by one for each overflow of the preceding even-numbered
counter. Let's emulate this in KVM by creating a 64 bit perf counter
when a user chains two emulated counters together.

Testing has been performed by hard-coding hwc->sample_period in
__hw_perf_event_init (arm_pmu.c) to a small value, this results in
regular overflows (for non sampling events). The following command
was then used to measure chained and non-chained instruction cycles:

perf stat -e armv8_pmuv3/long=1,inst_retired/u \
          -e armv8_pmuv3/long=0,inst_retired/u dd if=/dev/zero bs=1M \
	  count=10 | gzip > /dev/null

The reported values were identical (and for non-chained was in the
same ballpark when running on a kernel without this patchset). Debug
was added to verify that the guest received overflow interrupts for
the chain counter.

Changes since v1:

 - Rename kvm_pmu_{enable,disable}_counter to reflect that they can
   operate on multiple counters at once and use these functions where
   possible

 - Fix bugs with overflow handing, kvm_pmu_get_counter_value did not
   take into consideration the perf counter value overflowing the low
   counter

 - Ensure PMCCFILTR_EL0 is used when operating on the cycle counter

 - Rename kvm_pmu_reenable_enabled_{pair, single} and similar

 - Always create perf event disabled to simplify logic elsewhere

 - Move PMCNTENSET_EL0 test to kvm_pmu_enable_counter_mask

Andrew Murray (5):
  KVM: arm/arm64: rename kvm_pmu_{enable/disable}_counter functions
  KVM: arm/arm64: extract duplicated code to own function
  KVM: arm/arm64: re-create event when setting counter value
  KVM: arm/arm64: lazily create perf events on enable
  KVM: arm/arm64: support chained PMU counters

 arch/arm64/kvm/sys_regs.c |   4 +-
 include/kvm/arm_pmu.h     |   9 +-
 virt/kvm/arm/pmu.c        | 409 ++++++++++++++++++++++++++++++++++++++--------
 3 files changed, 352 insertions(+), 70 deletions(-)

-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-02-18 14:03 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 16:53 [PATCH v2 0/5] KVM: arm/arm64: add support for chained counters Andrew Murray
2019-02-04 16:53 ` [PATCH v2 1/5] KVM: arm/arm64: rename kvm_pmu_{enable/disable}_counter functions Andrew Murray
2019-02-05 12:21   ` Julien Thierry
2019-02-11 17:23   ` Suzuki K Poulose
2019-02-04 16:53 ` [PATCH v2 2/5] KVM: arm/arm64: extract duplicated code to own function Andrew Murray
2019-02-04 16:53 ` [PATCH v2 3/5] KVM: arm/arm64: re-create event when setting counter value Andrew Murray
2019-02-05 12:21   ` Julien Thierry
2019-02-05 12:27     ` Andrew Murray
2019-02-13 14:28   ` Suzuki K Poulose
2019-02-18  9:39     ` Andrew Murray
2019-02-04 16:53 ` [PATCH v2 4/5] KVM: arm/arm64: lazily create perf events on enable Andrew Murray
2019-02-14 11:36   ` Suzuki K Poulose
2019-02-18  9:57     ` Andrew Murray
2019-02-04 16:53 ` [PATCH v2 5/5] KVM: arm/arm64: support chained PMU counters Andrew Murray
2019-02-05 14:33   ` Julien Thierry
2019-02-14 11:42     ` Suzuki K Poulose
2019-02-18 12:03       ` Andrew Murray
2019-02-18 14:02         ` Marc Zyngier
2019-02-18 10:11     ` Andrew Murray
2019-02-18  8:52 ` [PATCH v2 0/5] KVM: arm/arm64: add support for chained counters Marc Zyngier
2019-02-18 12:10   ` Andrew Murray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).