kvm: nVMX: add tracepoint for kvm:kvm_nested_vmrun
PATCH 1/1 kvm: nVMX: add tracepoint for kvm:kvm_nested_vmrun
From: David Matlack <[email protected]>
This tracepoint is called by nested SVM during emulated VMRUN. Call also during emulated VMLAUNCH and VMRESUME in nested VMX.
Attempt to use analagous VMCS fields to the VMCB fields that are reported in the SVM case:
"int_ctl": 32-bit field of the VMCB that the CPU uses to deliver virtual interrupts. The analagous VMCS field is the 16-bit "guest interrupt status".
"event_inj": 32-bit field of VMCB that is used to inject events (exceptions and interrupts) into the guest. The analagous VMCS field is the "VM-entry interruption-information field".
"npt": 1 when the VCPU has enabled nested paging. The analagous VMCS field is the enable-EPT execution control.
--- arch/x86/kvm/vmx/nested.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kvm/vmx/nested.c +7 -0
@@ -3367,6 +3367,13 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, };u32 failed_index; +trace_kvm_nested_vmrun ( +kvm_rip_read (vcpu), vmx->nested.current_vmptr, + vmcs12->guest_rip, + vmcs12->guest_intr_status, + vmcs12->vm_entry_intr_info_field, + vmcs12->secondary_vm_exec_control &SECONDARY_EXEC_ENABLE_EPT ); +kvm_service_local_tlb_flush_requests (vcpu); evaluate_pending_interrupts = exec_controls_get(vmx) &
base-commit: 922d4578cfd017da67f545bfd07331bda86f795d
Signature · 1 line
2.37.0.rc0.161.g10f37bed90-goog
Sean Christopherson
maintainerQuoted 31 lines · Mingwei Zhang
From: David Matlack <[email protected]>
This tracepoint is called by nested SVM during emulated VMRUN. Call also during emulated VMLAUNCH and VMRESUME in nested VMX.
Attempt to use analagous VMCS fields to the VMCB fields that are reported in the SVM case:
"
int_ctl": 32-bit field of the VMCB that the CPU uses to deliver virtual interrupts. The analagous VMCS field is the 16-bit "guest interrupt status"."
event_inj": 32-bit field of VMCB that is used to inject events (exceptions and interrupts) into the guest. The analagous VMCS field is the "VM-entry interruption-information field"."npt": 1 when the VCPU has enabled nested paging. The analagous VMCS field is the enable-EPT execution control.
Signed-off-by David Matlack <[email protected]>[Move the code into the nested_vmx_enter_non_root_mode().]Signed-off-by Mingwei Zhang <[email protected]>--- arch/x86/kvm/vmx/nested.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/x86/kvm/vmx/nested.c +0
-0
arch/x86/kvm/vmx/nested.c enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, · line 3372
Quoted 6 lines
arch/x86/kvm/vmx/nested.c +3
-0@@ -3367,6 +3367,13 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, };u32 failed_index; + trace_kvm_nested_vmrun( + kvm_rip_read(vcpu), vmx->nested.current_vmptr, + vmcs12->guest_rip,
Be consistent; either put each parameter on it's own line or wrap only when necessary.
arch/x86/kvm/vmx/nested.c enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, · line 3376
Quoted 4 lines
arch/x86/kvm/vmx/nested.c +4
-0+ vmcs12->guest_intr_status, + vmcs12->vm_entry_intr_info_field, + vmcs12->secondary_vm_exec_control & SECONDARY_EXEC_ENABLE_EPT); +
Align the parameters to the opening '(', that "rule" trumps the 80 char soft limit.
trace_kvm_nested_vmrun(kvm_rip_read(vcpu), vmx->nested.current_vmptr, vmcs12->guest_rip, vmcs12->guest_intr_status, vmcs12->vm_entry_intr_info_field, vmcs12->secondary_vm_exec_control & SECONDARY_EXEC_ENABLE_EPT);
And if we're going to add nVMX, we should clean up the tracepoint output. E.g. pass in KVM_ISA_{SVM,VMX} to different VMCB vs. VMCS and npt vs. ept (and maybe print nNPT and nEPT to make it obvious it's the vmcs12 setting?). The "nrip" field is wrong even for SVM; the tracepoint prints the L2 rip, not the next_rip field in vmcs12. Maybe "L2 rip"?
Quoted 9 lines
Quoted 9 lines
arch/x86/kvm/vmx/nested.c +0
-0@@ -3367,6 +3367,13 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, };u32 failed_index;
Quoted 6 lines
arch/x86/kvm/vmx/nested.c enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, · line 3372
Quoted 3 lines
arch/x86/kvm/vmx/nested.c +3
-0+ trace_kvm_nested_vmrun( + kvm_rip_read(vcpu), vmx->nested.current_vmptr, + vmcs12->guest_rip,Be consistent; either put each parameter on it's own line or wrap only when necessary.
will do.
Quoted 7 lines
arch/x86/kvm/vmx/nested.c enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, · line 3376
Quoted 5 lines
arch/x86/kvm/vmx/nested.c +4
-0+ vmcs12->guest_intr_status, + vmcs12->vm_entry_intr_info_field, + vmcs12->secondary_vm_exec_control & SECONDARY_EXEC_ENABLE_EPT); +Align the parameters to the opening '(', that "rule" trumps the 80 char soft limit.
will do.
Quoted 8 lines
trace_kvm_nested_vmrun(kvm_rip_read(vcpu),
vmx->nested.current_vmptr,
vmcs12->guest_rip,
vmcs12->guest_intr_status,
vmcs12->vm_entry_intr_info_field,
vmcs12->secondary_vm_exec_control & SECONDARY_EXEC_ENABLE_EPT);Quoted 5 lines
And if we're going to add nVMX, we should clean up the tracepoint output. E.g. pass in KVM_ISA_{SVM,VMX} to different VMCB vs. VMCS and npt vs. ept (and maybe print nNPT and nEPT to make it obvious it's the vmcs12 setting?). The "nrip" field is wrong even for SVM; the tracepoint prints the L2 rip, not the
next_ripfield in vmcs12. Maybe "L2 rip"?
I can change the 'nrip' to 'nested rip', since it may not necessarily the 'L2 rip'.
For the others, will do.