You need to sign in or sign up before continuing.
提交 faa03b39 编写于 作者: W Wonhyuk Yang 提交者: Paolo Bonzini

KVM: Add extra information in kvm_page_fault trace point

Currently, kvm_page_fault trace point provide fault_address and error
code. However it is not enough to find which cpu and instruction
cause kvm_page_faults. So add vcpu id and instruction pointer in
kvm_page_fault trace point.

Cc: Baik Song An <bsahn@etri.re.kr>
Cc: Hong Yeon Kim <kimhy@etri.re.kr>
Cc: Taeung Song <taeung@reallinux.co.kr>
Cc: linuxgeek@linuxgeek.io
Signed-off-by: NWonhyuk Yang <vvghjk1234@gmail.com>
Link: https://lore.kernel.org/r/20220510071001.87169-1-vvghjk1234@gmail.comSigned-off-by: NSean Christopherson <seanjc@google.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 b5cb32b1
...@@ -4302,7 +4302,7 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code, ...@@ -4302,7 +4302,7 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,
vcpu->arch.l1tf_flush_l1d = true; vcpu->arch.l1tf_flush_l1d = true;
if (!flags) { if (!flags) {
trace_kvm_page_fault(fault_address, error_code); trace_kvm_page_fault(vcpu, fault_address, error_code);
if (kvm_event_needs_reinjection(vcpu)) if (kvm_event_needs_reinjection(vcpu))
kvm_mmu_unprotect_page_virt(vcpu, fault_address); kvm_mmu_unprotect_page_virt(vcpu, fault_address);
......
...@@ -1975,7 +1975,7 @@ static int npf_interception(struct kvm_vcpu *vcpu) ...@@ -1975,7 +1975,7 @@ static int npf_interception(struct kvm_vcpu *vcpu)
u64 fault_address = svm->vmcb->control.exit_info_2; u64 fault_address = svm->vmcb->control.exit_info_2;
u64 error_code = svm->vmcb->control.exit_info_1; u64 error_code = svm->vmcb->control.exit_info_1;
trace_kvm_page_fault(fault_address, error_code); trace_kvm_page_fault(vcpu, fault_address, error_code);
return kvm_mmu_page_fault(vcpu, fault_address, error_code, return kvm_mmu_page_fault(vcpu, fault_address, error_code,
static_cpu_has(X86_FEATURE_DECODEASSISTS) ? static_cpu_has(X86_FEATURE_DECODEASSISTS) ?
svm->vmcb->control.insn_bytes : NULL, svm->vmcb->control.insn_bytes : NULL,
......
...@@ -394,20 +394,26 @@ TRACE_EVENT(kvm_inj_exception, ...@@ -394,20 +394,26 @@ TRACE_EVENT(kvm_inj_exception,
* Tracepoint for page fault. * Tracepoint for page fault.
*/ */
TRACE_EVENT(kvm_page_fault, TRACE_EVENT(kvm_page_fault,
TP_PROTO(unsigned long fault_address, unsigned int error_code), TP_PROTO(struct kvm_vcpu *vcpu, unsigned long fault_address,
TP_ARGS(fault_address, error_code), unsigned int error_code),
TP_ARGS(vcpu, fault_address, error_code),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( unsigned int, vcpu_id )
__field( unsigned long, guest_rip )
__field( unsigned long, fault_address ) __field( unsigned long, fault_address )
__field( unsigned int, error_code ) __field( unsigned int, error_code )
), ),
TP_fast_assign( TP_fast_assign(
__entry->vcpu_id = vcpu->vcpu_id;
__entry->guest_rip = kvm_rip_read(vcpu);
__entry->fault_address = fault_address; __entry->fault_address = fault_address;
__entry->error_code = error_code; __entry->error_code = error_code;
), ),
TP_printk("address %lx error_code %x", TP_printk("vcpu %u rip 0x%lx address 0x%lx error_code %x",
__entry->vcpu_id, __entry->guest_rip,
__entry->fault_address, __entry->error_code) __entry->fault_address, __entry->error_code)
); );
......
...@@ -5638,7 +5638,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu) ...@@ -5638,7 +5638,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, GUEST_INTR_STATE_NMI); vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, GUEST_INTR_STATE_NMI);
gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
trace_kvm_page_fault(gpa, exit_qualification); trace_kvm_page_fault(vcpu, gpa, exit_qualification);
/* Is it a read fault? */ /* Is it a read fault? */
error_code = (exit_qualification & EPT_VIOLATION_ACC_READ) error_code = (exit_qualification & EPT_VIOLATION_ACC_READ)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册