ARM: KVM: add support for minimal host vs guest profiling
In order to be able to correctly profile what is happening on the
host, we need to be able to identify when we're running on the guest,
and log these events differently.
Perf offers a simple way to register callbacks into KVM. Mimic what
x86 does and enjoy being able to profile your KVM host.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 1497e18..7403f88 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -920,7 +920,10 @@
if (err)
goto out_free_mappings;
+ kvm_perf_init();
+
kvm_info("Hyp mode initialized successfully\n");
+
return 0;
out_free_vfp:
free_percpu(kvm_host_vfp_state);
@@ -964,6 +967,7 @@
/* NOP: Compiling as a module not supported */
void kvm_arch_exit(void)
{
+ kvm_perf_teardown();
}
static int arm_init(void)