Hi Wei, On 07/01/15 07:29, Wei Huang wrote: > arm64 uses its own copy of exit handler (arm64/kvm/handle_exit.c). > Currently this file doesn't hook up with tracepoints defined in > arm/kvm/trace.h file. As a result users might not see certain tracing > events (e.g. HVC & WFI) while using ftrace with arm64 KVM. This patch > fixes this issue by adding related tracepoints in arm64/kvm/handle_exit.c > file. > > Signed-off-by: Wei Huang <wei@xxxxxxxxxx> As I had an almost identical patch in my patch queue (which I obviously never managed to send out externally, as it seems): Acked-by: Andre Przywara <andre.przywara@xxxxxxx> Cheers, Andre. > --- > arch/arm64/include/asm/kvm_arm.h | 2 ++ > arch/arm64/include/asm/kvm_emulate.h | 5 +++++ > arch/arm64/kvm/handle_exit.c | 7 +++++++ > 3 files changed, 14 insertions(+) > > diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h > index 7fd3e27..e3e2350 100644 > --- a/arch/arm64/include/asm/kvm_arm.h > +++ b/arch/arm64/include/asm/kvm_arm.h > @@ -256,4 +256,6 @@ > > #define ESR_EL2_EC_WFI_ISS_WFE (1 << 0) > > +#define ESR_EL2_HVC_IMM_MASK ((1UL << 16) - 1) > + > #endif /* __ARM64_KVM_ARM_H__ */ > diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h > index 8127e45..a6fa2d2 100644 > --- a/arch/arm64/include/asm/kvm_emulate.h > +++ b/arch/arm64/include/asm/kvm_emulate.h > @@ -126,6 +126,11 @@ static inline phys_addr_t kvm_vcpu_get_fault_ipa(const struct kvm_vcpu *vcpu) > return ((phys_addr_t)vcpu->arch.fault.hpfar_el2 & HPFAR_MASK) << 8; > } > > +static inline u32 kvm_vcpu_hvc_get_imm(const struct kvm_vcpu *vcpu) > +{ > + return kvm_vcpu_get_hsr(vcpu) & ESR_EL2_HVC_IMM_MASK; > +} > + > static inline bool kvm_vcpu_dabt_isvalid(const struct kvm_vcpu *vcpu) > { > return !!(kvm_vcpu_get_hsr(vcpu) & ESR_EL2_ISV); > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c > index 34b8bd0..ccdb781 100644 > --- a/arch/arm64/kvm/handle_exit.c > +++ b/arch/arm64/kvm/handle_exit.c > @@ -26,12 +26,17 @@ > #include <asm/kvm_mmu.h> > #include <asm/kvm_psci.h> > > +#include "../../arm/kvm/trace.h" > + > typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *); > > static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run) > { > int ret; > > + trace_kvm_hvc(*vcpu_pc(vcpu), *vcpu_reg(vcpu, 0), > + kvm_vcpu_hvc_get_imm(vcpu)); > + > ret = kvm_psci_call(vcpu); > if (ret < 0) { > kvm_inject_undefined(vcpu); > @@ -61,6 +66,8 @@ static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run) > */ > static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) > { > + trace_kvm_wfi(*vcpu_pc(vcpu)); > + > if (kvm_vcpu_get_hsr(vcpu) & ESR_EL2_EC_WFI_ISS_WFE) > kvm_vcpu_on_spin(vcpu); > else > _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm