From: Zenghui Yu yuzenghui@huawei.com
euleros inclusion category: feature bugzilla: 46842 CVE: NA
--------------------------------
Add more trace log on guest entry/exit
Signed-off-by: Zenghui Yu yuzenghui@huawei.com Signed-off-by: Xiangyou Xie xiexiangyou@huawei.com Reviewed-by: Ying Fang fangying1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- virt/kvm/arm/arm.c | 10 +++++++ virt/kvm/arm/trace.h | 65 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+)
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index f2eec858458b..44fcec4b47b7 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -850,6 +850,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) * Enter the guest */ trace_kvm_entry(vcpu->vcpu_id, *vcpu_pc(vcpu)); + trace_kvm_entry_more(*vcpu_pc(vcpu), vcpu_read_elr_el1(vcpu), + *vcpu_cpsr(vcpu), + *vcpu_hcr(vcpu), kvm_vcpu_get_hsr(vcpu), + kvm_vcpu_get_hfar(vcpu), + vcpu->arch.fault.hpfar_el2); guest_enter_irqoff();
if (has_vhe()) { @@ -914,6 +919,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) */ guest_exit(); trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu)); + trace_kvm_exit_more(*vcpu_pc(vcpu), vcpu_read_elr_el1(vcpu), + *vcpu_cpsr(vcpu), + *vcpu_hcr(vcpu), kvm_vcpu_get_hsr(vcpu), + kvm_vcpu_get_hfar(vcpu), + vcpu->arch.fault.hpfar_el2);
/* 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 4aea348252f9..5b7ba18f3b67 100644 --- a/virt/kvm/arm/trace.h +++ b/virt/kvm/arm/trace.h @@ -281,6 +281,71 @@ TRACE_EVENT(kvm_pvsched_kick_vcpu, __entry->vcpu_id, __entry->target_vcpu_id) );
+TRACE_EVENT(kvm_entry_more, + TP_PROTO(unsigned long vcpu_pc, unsigned long elr_el1, + unsigned long cpsr, unsigned long hcr, + unsigned long hsr, unsigned long hxfar, + unsigned long long hpfar), + TP_ARGS(vcpu_pc, elr_el1, cpsr, hcr, hsr, hxfar, hpfar), + + TP_STRUCT__entry( + __field(unsigned long, vcpu_pc) + __field(unsigned long, elr_el1) + __field(unsigned long, cpsr) + __field(unsigned long, hcr) + __field(unsigned long, hsr) + __field(unsigned long, hxfar) + __field(unsigned long long, hpfar) + ), + + TP_fast_assign( + __entry->vcpu_pc = vcpu_pc; + __entry->elr_el1 = elr_el1; + __entry->cpsr = cpsr; + __entry->hcr = hcr; + __entry->hsr = hsr; + __entry->hxfar = hxfar; + __entry->hpfar = hpfar; + ), + + TP_printk("PC: 0x%08lx, ELR_EL1: 0x%08lx, CPSR: 0x%08lx, HCR: 0x%08lx, HSR: 0x%08lx, HXFAR: 0x%08lx, HPFAR: 0x%llx", + __entry->vcpu_pc, __entry->elr_el1, __entry->cpsr, + __entry->hcr, __entry->hsr, __entry->hxfar, __entry->hpfar) +); + +TRACE_EVENT(kvm_exit_more, + TP_PROTO(unsigned long vcpu_pc, unsigned long elr_el1, + unsigned long cpsr, unsigned long hcr, + unsigned long hsr, unsigned long hxfar, + unsigned long long hpfar), + TP_ARGS(vcpu_pc, elr_el1, cpsr, hcr, hsr, hxfar, hpfar), + + TP_STRUCT__entry( + __field(unsigned long, vcpu_pc) + __field(unsigned long, elr_el1) + __field(unsigned long, cpsr) + __field(unsigned long, hcr) + __field(unsigned long, hsr) + __field(unsigned long, hxfar) + __field(unsigned long long, hpfar) + ), + + TP_fast_assign( + __entry->vcpu_pc = vcpu_pc; + __entry->elr_el1 = elr_el1; + __entry->cpsr = cpsr; + __entry->hcr = hcr; + __entry->hsr = hsr; + __entry->hxfar = hxfar; + __entry->hpfar = hpfar; + ), + + TP_printk("PC: 0x%08lx, ELR_EL1: 0x%08lx, CPSR: 0x%08lx, HCR: 0x%08lx, HSR: 0x%08lx, HXFAR: 0x%08lx, HPFAR: 0x%llx", + __entry->vcpu_pc, __entry->elr_el1, __entry->cpsr, + __entry->hcr, __entry->hsr, __entry->hxfar, __entry->hpfar) +); + + #endif /* _TRACE_KVM_H */
#undef TRACE_INCLUDE_PATH