From: Ying Fang <Ying Fang>
euleros inclusion category: bugfix
-------------------------------------------------
The filter name 'exit_reason' is only applicable to x86, however kvm_stat use this trace fileld to filter Guest trap info. It will fail to call ioctl(fd, SET_FILTER, fileld_name) on a different architecture other than x86.
This patch makes arm64 use 'esr_ec' as the trace fileld of kvm_exit tracepoint, so that kvm_stat will work.
Signed-off-by: Ying Fang fangying1@huawei.com Reviewed-by: Hailiang Zhang zhang.zhanghailiang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- virt/kvm/arm/arm.c | 2 +- virt/kvm/arm/trace.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index a54c221..d1fef36 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -853,7 +853,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) * guest time. */ guest_exit(); - trace_kvm_exit(vcpu->vcpu_id, ret, *vcpu_pc(vcpu)); + trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu));
/* Exit types that need handling before we can be preempted */ handle_exit_early(vcpu, run, ret); diff --git a/virt/kvm/arm/trace.h b/virt/kvm/arm/trace.h index e32fee7..674fda1 100644 --- a/virt/kvm/arm/trace.h +++ b/virt/kvm/arm/trace.h @@ -28,24 +28,24 @@ );
TRACE_EVENT(kvm_exit, - TP_PROTO(unsigned int vcpu_id, int ret, unsigned long vcpu_pc), - TP_ARGS(vcpu_id, ret, vcpu_pc), + TP_PROTO(int ret, unsigned int esr_ec, unsigned long vcpu_pc), + TP_ARGS(ret, esr_ec, vcpu_pc),
TP_STRUCT__entry( - __field( unsigned int, vcpu_id ) __field( int, ret ) + __field( unsigned int, esr_ec ) __field( unsigned long, vcpu_pc ) ),
TP_fast_assign( - __entry->vcpu_id = vcpu_id; __entry->ret = ARM_EXCEPTION_CODE(ret); + __entry->esr_ec = ARM_EXCEPTION_IS_TRAP(ret) ? esr_ec : 0; __entry->vcpu_pc = vcpu_pc; ), - - TP_printk("VCPU %u: exit_type=%s, PC=0x%08lx", - __entry->vcpu_id, + TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx", __print_symbolic(__entry->ret, kvm_arm_exception_type), + __entry->esr_ec, + __print_symbolic(__entry->esr_ec, kvm_arm_exception_class), __entry->vcpu_pc) );