linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] Add support for monitoring guest TLB operations
@ 2017-01-10 11:38 Punit Agrawal
  2017-01-10 11:38 ` [PATCH v3 1/9] arm64/kvm: hyp: tlb: use __tlbi() helper Punit Agrawal
                   ` (8 more replies)
  0 siblings, 9 replies; 23+ messages in thread
From: Punit Agrawal @ 2017-01-10 11:38 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel
  Cc: Punit Agrawal, linux-kernel, kvm, Christoffer Dall, Marc Zyngier,
	Steven Rostedt, Peter Zijlstra, Will Deacon

Hi,

This is a new version of the patchset to monitor guest TLB
operations. The user interface has been re-written to incorporate
feedback from LPC'16 on the previous version - it now uses a software
PMU instead of relying on perf trace to track guest TLB operations
(Patch 6 and 7). Previous versions of the patches can be found at
[0][1][2][3].

Guest TLB operations can impact on system performance but these are
not exported as architected PMU events on arm/arm64. Instead the
architecture allows trapping of TLB operations to the hypervisor. This
patchset builds on this feature to monitor TLB operations.

To minimise the performance impact, trapping is enabled -
* on user request
* for the VM of interest

With this patchset, running 'perf' on the host can be used to monitor
the TLB operations. E.g., to monitor a VM with process id 2589 -

# perf stat -a -C 0 -e kvm/kvm_tlb_invalidate,vm=2589/ sleep 25

 Performance counter stats for 'system wide':

             3,386      kvm/tlb_invalidate,vm=2589/

      25.001086522 seconds time elapsed


The patches are based on v4.10-rc3 and have been tested on arm and
arm64.

Thanks,
Punit

[0] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1210715.html
[1] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1224353.html
[2] https://marc.info/?l=linux-kernel&m=147376184208258&w=2
[3] https://marc.info/?l=kvm&m=147750373716545&w=2

Changes:
v2 -> v3
* Replaced perf trace monitoring with software PMU
* Re-ordered patches as a result of the above re-write

v1 -> v2

* New (Patch 6) - Add support for trapping and emulating TLB
  operations to ARM hosts
* Move common code to handle perf trace notifications to virt/kvm/arm
* Move tracepoint to include/trace/events/kvm.h
* Drop patch to introduce __tlbi helper as it is now merged
* Reorder patches

RFC v2 -> v1
* Dropped the RFC tag
* Patch 2 - Use VM thread group id for identification
* Patch 4 - Update comment for clarity
* Patch 6 - Add comment explaining switch to hype-role when VHE is enabled
* Patch 7 - Add comment to clarify struct kvm_trace_hook

RFC -> RFC v2
* Patch 4 - Rename left-over TLBI macro to __TLBI
* Patch 6 - Replace individual TLB operation emulation with
  invalidating all stage 1 TLB for the VM. TLB monitoring is expected
  to be a debug feature and performance is not critical.



Mark Rutland (1):
  arm64/kvm: hyp: tlb: use __tlbi() helper

Punit Agrawal (8):
  KVM: Track the pid of the VM process
  KVM: Add event to trace tlb invalidations
  arm: KVM: Handle trappable TLB instructions
  arm64: KVM: Handle trappable TLB instructions
  kvm: arm/arm64: Add host pmu to support VM introspection
  kvm: host_pmu: Add support for tracking guest TLB operations
  arm: KVM: Enable support for host pmu
  arm64: KVM: Enable support for the host pmu

 arch/arm/include/asm/kvm_asm.h    |   2 +
 arch/arm/include/asm/kvm_host.h   |   9 ++
 arch/arm/kvm/Kconfig              |   4 +
 arch/arm/kvm/Makefile             |   1 +
 arch/arm/kvm/arm.c                |   2 +
 arch/arm/kvm/coproc.c             |  56 +++++++
 arch/arm/kvm/hyp/tlb.c            |  33 ++++
 arch/arm64/include/asm/kvm_asm.h  |   2 +
 arch/arm64/include/asm/kvm_host.h |   9 ++
 arch/arm64/kvm/Kconfig            |   4 +
 arch/arm64/kvm/Makefile           |   1 +
 arch/arm64/kvm/hyp/tlb.c          |  87 +++++++++-
 arch/arm64/kvm/sys_regs.c         |  83 ++++++++++
 include/linux/kvm_host.h          |   1 +
 include/trace/events/kvm.h        |  18 +++
 virt/kvm/arm/host_pmu.c           | 322 ++++++++++++++++++++++++++++++++++++++
 virt/kvm/kvm_main.c               |   2 +
 17 files changed, 630 insertions(+), 6 deletions(-)
 create mode 100644 virt/kvm/arm/host_pmu.c

-- 
2.11.0

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

end of thread, other threads:[~2017-01-23 11:21 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 11:38 [PATCH v3 0/9] Add support for monitoring guest TLB operations Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 1/9] arm64/kvm: hyp: tlb: use __tlbi() helper Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 2/9] KVM: Track the pid of the VM process Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 3/9] KVM: Add event to trace tlb invalidations Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 4/9] arm: KVM: Handle trappable TLB instructions Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 5/9] arm64: " Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 6/9] kvm: arm/arm64: Add host pmu to support VM introspection Punit Agrawal
2017-01-18 11:21   ` Marc Zyngier
2017-01-18 11:35     ` Mark Rutland
2017-01-18 13:01       ` Punit Agrawal
2017-01-18 13:18         ` Marc Zyngier
2017-01-18 14:51           ` Punit Agrawal
2017-01-18 15:17             ` Mark Rutland
2017-01-18 16:17               ` Punit Agrawal
2017-01-18 18:05                 ` Mark Rutland
2017-01-19 16:42                   ` Christoffer Dall
2017-01-23 11:21                     ` Punit Agrawal
2017-01-18 13:45         ` Will Deacon
2017-01-18 14:58           ` Punit Agrawal
2017-01-18 13:06     ` Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 7/9] kvm: host_pmu: Add support for tracking guest TLB operations Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 8/9] arm: KVM: Enable support for host pmu Punit Agrawal
2017-01-10 11:38 ` [PATCH v3 9/9] arm64: KVM: Enable support for the " Punit Agrawal

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).