From: Sean Christopherson <seanjc@google.com>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
Paolo Bonzini <pbonzini@redhat.com>,
x86@kernel.org, Wanpeng Li <wanpengli@tencent.com>,
linux-kernel@vger.kernel.org, Jim Mattson <jmattson@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>, Joerg Roedel <joro@8bytes.org>
Subject: Re: [PATCH 2/2] KVM: nVMX: trace nested vm entry
Date: Thu, 21 Jan 2021 14:27:03 -0800 [thread overview]
Message-ID: <YAn/t7TWP0xmVEHs@google.com> (raw)
In-Reply-To: <20210121171043.946761-3-mlevitsk@redhat.com>
On Thu, Jan 21, 2021, Maxim Levitsky wrote:
> This is very helpful to debug nested VMX issues.
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
> arch/x86/kvm/trace.h | 30 ++++++++++++++++++++++++++++++
> arch/x86/kvm/vmx/nested.c | 5 +++++
> arch/x86/kvm/x86.c | 3 ++-
> 3 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> index 2de30c20bc264..ec75efdac3560 100644
> --- a/arch/x86/kvm/trace.h
> +++ b/arch/x86/kvm/trace.h
> @@ -554,6 +554,36 @@ TRACE_EVENT(kvm_nested_vmrun,
> __entry->npt ? "on" : "off")
> );
>
> +
> +/*
> + * Tracepoint for nested VMLAUNCH/VMRESUME
> + */
> +TRACE_EVENT(kvm_nested_vmenter,
> + TP_PROTO(__u64 rip, __u64 vmcs, __u64 nested_rip,
> + __u32 entry_intr_info),
> + TP_ARGS(rip, vmcs, nested_rip, entry_intr_info),
> +
> + TP_STRUCT__entry(
> + __field( __u64, rip )
> + __field( __u64, vmcs )
> + __field( __u64, nested_rip )
> + __field( __u32, entry_intr_info )
> + ),
> +
> + TP_fast_assign(
> + __entry->rip = rip;
> + __entry->vmcs = vmcs;
> + __entry->nested_rip = nested_rip;
> + __entry->entry_intr_info = entry_intr_info;
> + ),
> +
> + TP_printk("rip: 0x%016llx vmcs: 0x%016llx nrip: 0x%016llx "
> + "entry_intr_info: 0x%08x",
> + __entry->rip, __entry->vmcs, __entry->nested_rip,
> + __entry->entry_intr_info)
I still don't see why VMX can't share this with SVM. "npt' can easily be "tdp",
differentiating between VMCB and VMCS can be down with ISA, and VMX can give 0
for int_ctl (or throw in something else interesting/relevant).
trace_kvm_nested_vmenter(kvm_rip_read(vcpu),
vmx->nested.current_vmptr,
vmcs12->guest_rip,
0,
vmcs12->vm_entry_intr_info_field,
nested_cpu_has_ept(vmcs12),
KVM_ISA_VMX);
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 2de30c20bc26..90f7cdb31fc1 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -522,12 +522,12 @@ TRACE_EVENT(kvm_pv_eoi,
);
/*
- * Tracepoint for nested VMRUN
+ * Tracepoint for nested VM-Enter. Note, vmcb==vmcs on VMX.
*/
-TRACE_EVENT(kvm_nested_vmrun,
+TRACE_EVENT(kvm_nested_vmenter,
TP_PROTO(__u64 rip, __u64 vmcb, __u64 nested_rip, __u32 int_ctl,
- __u32 event_inj, bool npt),
- TP_ARGS(rip, vmcb, nested_rip, int_ctl, event_inj, npt),
+ __u32 event_inj, bool tdp, __u32 isa),
+ TP_ARGS(rip, vmcb, nested_rip, int_ctl, event_inj, tdp, isa),
TP_STRUCT__entry(
__field( __u64, rip )
@@ -535,7 +535,8 @@ TRACE_EVENT(kvm_nested_vmrun,
__field( __u64, nested_rip )
__field( __u32, int_ctl )
__field( __u32, event_inj )
- __field( bool, npt )
+ __field( bool, tdp )
+ __field( __u32, isa )
),
TP_fast_assign(
@@ -544,14 +545,16 @@ TRACE_EVENT(kvm_nested_vmrun,
__entry->nested_rip = nested_rip;
__entry->int_ctl = int_ctl;
__entry->event_inj = event_inj;
- __entry->npt = npt;
+ __entry->tdp = tdp;
+ __entry->isa = isa;
),
- TP_printk("rip: 0x%016llx vmcb: 0x%016llx nrip: 0x%016llx int_ctl: 0x%08x "
- "event_inj: 0x%08x npt: %s",
- __entry->rip, __entry->vmcb, __entry->nested_rip,
+ TP_printk("rip: 0x%016llx %s: 0x%016llx nrip: 0x%016llx int_ctl: 0x%08x "
+ "event_inj: 0x%08x tdp: %s",
+ __entry->rip, __entry->isa == KVM_ISA_VMX ? "vmcs" : "vmcb",
+ __entry->vmcb, __entry->nested_rip,
__entry->int_ctl, __entry->event_inj,
- __entry->npt ? "on" : "off")
+ __entry->tdp ? "on" : "off")
);
TRACE_EVENT(kvm_nested_intercepts,
next prev parent reply other threads:[~2021-01-21 22:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-21 17:10 [PATCH 0/2] VMX: few tracing improvements Maxim Levitsky
2021-01-21 17:10 ` [PATCH 1/2] KVM: nSVM: move nested vmrun tracepoint to enter_svm_guest_mode Maxim Levitsky
2021-01-21 17:10 ` [PATCH 2/2] KVM: nVMX: trace nested vm entry Maxim Levitsky
2021-01-21 22:27 ` Sean Christopherson [this message]
2021-01-25 13:22 ` Thoughts on sharing KVM tracepoints [was:Re: [PATCH 2/2] KVM: nVMX: trace nested vm entry] Maxim Levitsky
2021-01-25 21:01 ` Sean Christopherson
2021-01-27 10:35 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YAn/t7TWP0xmVEHs@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox