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

Vitaly Kuznetsov
2020-07-21T13:59:18Z

Sean Christopherson <sean.j.christopherson@intel.com> writes:

> On Mon, Jul 20, 2020 at 06:52:15PM +0200, Vitaly Kuznetsov wrote:
>> Sean Christopherson <sean.j.christopherson@intel.com> 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 :-(
>

Right you are,

the tool is called 'trace-cmd record -e kvm ...' / 'trace-cmd report'
but I always thought it's not any different from looking at
/sys/kernel/debug/tracing/trace directly. Apparently I was wrong. 'cat
/sys/kernel/debug/tracing/trace' seems to be OK, e.g.:

qemu-system-x86-20263 [006] .... 75982.292657: kvm_nested_vmexit: vcpu 0 reason hypercall rip 0x40122f info1 0x0000000000000000 info2 0x0000000000000000 intr_info 0x00000000 error_code 0x00000000

--
Vitaly