Re: [PATCH 6/7] KVM: x86: Use common definition for kvm_nested_vmexit tracepoint

From: Sean Christopherson
Date: Mon Jul 20 2020 - 20:27:19 EST


On Mon, Jul 20, 2020 at 06:52:15PM +0200, Vitaly Kuznetsov wrote:
> Sean Christopherson <sean.j.christopherson@xxxxxxxxx> writes:
> > +TRACE_EVENT_KVM_EXIT(kvm_nested_vmexit);
> >
> > /*
> > * Tracepoint for #VMEXIT reinjected to the guest
> > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> > index fc70644b916ca..f437d99f4db09 100644
> > --- a/arch/x86/kvm/vmx/nested.c
> > +++ b/arch/x86/kvm/vmx/nested.c
> > @@ -5912,10 +5912,7 @@ bool nested_vmx_reflect_vmexit(struct kvm_vcpu *vcpu)
> > exit_intr_info = vmx_get_intr_info(vcpu);
> > exit_qual = vmx_get_exit_qual(vcpu);
> >
> > - trace_kvm_nested_vmexit(vcpu, exit_reason, exit_qual,
> > - vmx->idt_vectoring_info, exit_intr_info,
> > - vmcs_read32(VM_EXIT_INTR_ERROR_CODE),
> > - KVM_ISA_VMX);
> > + trace_kvm_nested_vmexit(exit_reason, vcpu, KVM_ISA_VMX);
> >
> > /* If L0 (KVM) wants the exit, it trumps L1's desires. */
> > if (nested_vmx_l0_wants_exit(vcpu, exit_reason))
>
> With so many lines removed I'm almost in love with the patch! However,
> when testing on SVM (unrelated?) my trace log looks a bit ugly:
>
> <...>-315119 [010] 3733.092646: kvm_nested_vmexit: CAN'T FIND FIELD "rip"<CANT FIND FIELD exit_code>vcpu 0 reason npf rip 0x400433 info1 0x0000000200000006 info2 0x0000000000641000 intr_info 0x00000000 error_code 0x00000000
> <...>-315119 [010] 3733.092655: kvm_nested_vmexit: CAN'T FIND FIELD "rip"<CANT FIND FIELD exit_code>vcpu 0 reason npf rip 0x400433 info1 0x0000000100000014 info2 0x0000000000400000 intr_info 0x00000000 error_code 0x00000000
>
> ...
>
> but after staring at this for some time I still don't see where this
> comes from :-( ... but reverting this commit helps:

The CAN'T FIND FIELD blurb comes from tools/lib/traceevent/event-parse.c.

I assume you are using tooling of some form to generate the trace, i.e. the
issue doesn't show up in /sys/kernel/debug/tracing/trace. If that's the
case, this is more or less ABI breakage :-(

> qemu-system-x86-9928 [022] 379.260656: kvm_nested_vmexit: rip 400433 reason EXIT_NPF info1 200000006 info2 641000 int_info 0 int_info_err 0
> qemu-system-x86-9928 [022] 379.260666: kvm_nested_vmexit: rip 400433 reason EXIT_NPF info1 100000014 info2 400000 int_info 0 int_info_err 0
>
> --
> Vitaly
>