On 02/13/2015 12:22 AM, Alex Bennée wrote: > > Wei Huang <wei@xxxxxxxxxx> writes: > >> This patch extends trace_kvm_exit() to include KVM exit reasons >> (i.e. EC of HSR). The tracing function then dumps both exit reason >> and PC of vCPU, shown as the following. Tracing tools can use this >> new exit_reason field to better understand the behavior of guest VMs. >> >> 886.301252: kvm_exit: HSR_EC: 0x0024, PC: >> 0xfffffe0000506b28 > > Ah I also have a similar patch but I've also added LR and CONTEXTIDR to > the record. The first helps when PC is in a widely used helper function > and the second gives you an idea of what userspace process the guest is > currently dealing with. > Sounds useful to me. You can either create a separate patch; or ask Paolo to merge yours with existing one and put your name as signed-off-by. > If people are interested I can clean it up and submit (I have a bunch of > TRACE_EVENTs I've been adding while debugging migration). I can help review the patches... > >> >> Signed-off-by: Wei Huang <wei@xxxxxxxxxx> >> --- >> arch/arm/kvm/arm.c | 2 +- >> arch/arm/kvm/trace.h | 10 +++++++--- >> 2 files changed, 8 insertions(+), 4 deletions(-) >> >> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c >> index 0b0d58a..4a00131 100644 >> --- a/arch/arm/kvm/arm.c >> +++ b/arch/arm/kvm/arm.c >> @@ -533,7 +533,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) >> >> vcpu->mode = OUTSIDE_GUEST_MODE; >> kvm_guest_exit(); >> - trace_kvm_exit(*vcpu_pc(vcpu)); >> + trace_kvm_exit(kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu)); >> /* >> * We may have taken a host interrupt in HYP mode (ie >> * while executing the guest). This interrupt is still >> diff --git a/arch/arm/kvm/trace.h b/arch/arm/kvm/trace.h >> index 5665a16..b7427d4 100644 >> --- a/arch/arm/kvm/trace.h >> +++ b/arch/arm/kvm/trace.h >> @@ -25,18 +25,22 @@ TRACE_EVENT(kvm_entry, >> ); >> >> TRACE_EVENT(kvm_exit, >> - TP_PROTO(unsigned long vcpu_pc), >> - TP_ARGS(vcpu_pc), >> + TP_PROTO(unsigned int exit_reason, unsigned long vcpu_pc), >> + TP_ARGS(exit_reason, vcpu_pc), >> >> TP_STRUCT__entry( >> + __field( unsigned int, exit_reason ) >> __field( unsigned long, vcpu_pc ) >> ), >> >> TP_fast_assign( >> + __entry->exit_reason = exit_reason; >> __entry->vcpu_pc = vcpu_pc; >> ), >> >> - TP_printk("PC: 0x%08lx", __entry->vcpu_pc) >> + TP_printk("HSR_EC: 0x%04x, PC: 0x%08lx", >> + __entry->exit_reason, >> + __entry->vcpu_pc) >> ); >> >> TRACE_EVENT(kvm_guest_fault, > _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm