diff mbox series

[1/2] KVM: VMX: Invoke kvm_exit tracepoint on VM-Exit due to failed VM-Enter

Message ID 20200508235348.19427-2-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series KVM: VMX: Fix and a cleanup for VM-Exit tracing | expand

Commit Message

Sean Christopherson May 8, 2020, 11:53 p.m. UTC
Restore the pre-fastpath behavior of tracing all VM-Exits, including
those due to failed VM-Enter.

Fixes: 032e5dcbcb443 ("KVM: VMX: Introduce generic fastpath handler")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/vmx/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini May 9, 2020, 12:54 p.m. UTC | #1
On 09/05/20 01:53, Sean Christopherson wrote:
> Restore the pre-fastpath behavior of tracing all VM-Exits, including
> those due to failed VM-Enter.
> 
> Fixes: 032e5dcbcb443 ("KVM: VMX: Introduce generic fastpath handler")
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  arch/x86/kvm/vmx/vmx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Squashed, thanks.  Though is it really the right "Fixes"?

Paolo
Sean Christopherson May 11, 2020, 5:08 p.m. UTC | #2
On Sat, May 09, 2020 at 02:54:42PM +0200, Paolo Bonzini wrote:
> On 09/05/20 01:53, Sean Christopherson wrote:
> > Restore the pre-fastpath behavior of tracing all VM-Exits, including
> > those due to failed VM-Enter.
> > 
> > Fixes: 032e5dcbcb443 ("KVM: VMX: Introduce generic fastpath handler")
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > ---
> >  arch/x86/kvm/vmx/vmx.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Squashed, thanks.  Though is it really the right "Fixes"?

Pretty sure, that's the commit that moved trace_kvm_exit() from
vmx_handle_exit() to vmx_vcpu_run().  Prior to that, all fastpaths still
flowed through vmx_handle_exit().
Paolo Bonzini May 11, 2020, 5:29 p.m. UTC | #3
On 11/05/20 19:08, Sean Christopherson wrote:
> On Sat, May 09, 2020 at 02:54:42PM +0200, Paolo Bonzini wrote:
>> On 09/05/20 01:53, Sean Christopherson wrote:
>>> Restore the pre-fastpath behavior of tracing all VM-Exits, including
>>> those due to failed VM-Enter.
>>>
>>> Fixes: 032e5dcbcb443 ("KVM: VMX: Introduce generic fastpath handler")
>>> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
>>> ---
>>>  arch/x86/kvm/vmx/vmx.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> Squashed, thanks.  Though is it really the right "Fixes"?
> 
> Pretty sure, that's the commit that moved trace_kvm_exit() from
> vmx_handle_exit() to vmx_vcpu_run().  Prior to that, all fastpaths still
> flowed through vmx_handle_exit().
> 

Indeed, fast path was never handled in vcpu_enter_guest.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index bc5e5cf1d4cc8..a6d108bfc7132 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6801,6 +6801,8 @@  static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
 	if (unlikely((u16)vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY))
 		kvm_machine_check();
 
+	trace_kvm_exit(vmx->exit_reason, vcpu, KVM_ISA_VMX);
+
 	if (unlikely(vmx->exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY))
 		return EXIT_FASTPATH_NONE;
 
@@ -6810,8 +6812,6 @@  static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
 	vmx_recover_nmi_blocking(vmx);
 	vmx_complete_interrupts(vmx);
 
-	trace_kvm_exit(vmx->exit_reason, vcpu, KVM_ISA_VMX);
-
 	if (is_guest_mode(vcpu))
 		return EXIT_FASTPATH_NONE;