ARM: KVM: extend WFI tracepoint to differentiate between wfi and wfe
authorAndre Przywara <andre.przywara@arm.com>
Mon, 12 Jan 2015 16:56:16 +0000 (16:56 +0000)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 15 Jan 2015 12:12:27 +0000 (13:12 +0100)
Currently the trace printk talks about "wfi" only, though the trace
point triggers both on wfi and wfe traps.
Add a parameter to differentiate between the two.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Wei Huang <wei@redhat.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arch/arm/kvm/handle_exit.c
arch/arm/kvm/trace.h

index a96a8043277c3de69cc460a5b2a3f83a36fc30ed..95f12b2ccdcb8172e4faa4f7148438ec27f08f1a 100644 (file)
@@ -87,11 +87,13 @@ static int handle_dabt_hyp(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) & HSR_WFI_IS_WFE)
+       if (kvm_vcpu_get_hsr(vcpu) & HSR_WFI_IS_WFE) {
+               trace_kvm_wfx(*vcpu_pc(vcpu), true);
                kvm_vcpu_on_spin(vcpu);
-       else
+       } else {
+               trace_kvm_wfx(*vcpu_pc(vcpu), false);
                kvm_vcpu_block(vcpu);
+       }
 
        kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
 
index b1d640f78623971337ad08072efdcc981c124c0f..f741449121f378cdf1012f889b1db4359b40682d 100644 (file)
@@ -140,19 +140,22 @@ TRACE_EVENT(kvm_emulate_cp15_imp,
                        __entry->CRm, __entry->Op2)
 );
 
-TRACE_EVENT(kvm_wfi,
-       TP_PROTO(unsigned long vcpu_pc),
-       TP_ARGS(vcpu_pc),
+TRACE_EVENT(kvm_wfx,
+       TP_PROTO(unsigned long vcpu_pc, bool is_wfe),
+       TP_ARGS(vcpu_pc, is_wfe),
 
        TP_STRUCT__entry(
                __field(        unsigned long,  vcpu_pc         )
+               __field(                 bool,  is_wfe          )
        ),
 
        TP_fast_assign(
                __entry->vcpu_pc                = vcpu_pc;
+               __entry->is_wfe                 = is_wfe;
        ),
 
-       TP_printk("guest executed wfi at: 0x%08lx", __entry->vcpu_pc)
+       TP_printk("guest executed wf%c at: 0x%08lx",
+               __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc)
 );
 
 TRACE_EVENT(kvm_unmap_hva,