From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Ladi Prosek <lprosek@redhat.com>
Subject: [PATCH] KVM: nVMX: add tracepoint for vmwrite
Date: Sat, 5 Nov 2016 00:18:56 +0100 [thread overview]
Message-ID: <1478301536-12555-1-git-send-email-pbonzini@redhat.com> (raw)
Both the field and the value are in registers, so they are not clear from
existing tracepoints.
Cc: Ladi Prosek <lprosek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kvm/trace.h | 23 +++++++++++++++++++++++
arch/x86/kvm/vmx.c | 2 ++
2 files changed, 25 insertions(+)
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 0a6cc6754ec5..b3d4dec78ae2 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -723,6 +723,29 @@ TRACE_EVENT(kvm_skinit,
flags; \
})
+/*
+ * Tracepoint for nested #vmexit because of vmwrite
+ */
+TRACE_EVENT(kvm_vmwrite,
+ TP_PROTO(__u64 vmptr, __u16 field, __u64 value),
+ TP_ARGS(vmptr, field, value),
+
+ TP_STRUCT__entry(
+ __field( __u64, vmptr )
+ __field( __u16, field )
+ __field( __u64, value )
+ ),
+
+ TP_fast_assign(
+ __entry->vmptr = vmptr;
+ __entry->field = field;
+ __entry->value = value;
+ ),
+
+ TP_printk("vmcs: 0x%016llx field: 0x%04x value: 0x%llx",
+ __entry->vmptr, __entry->field, __entry->value)
+);
+
TRACE_EVENT(kvm_emulate_insn,
TP_PROTO(struct kvm_vcpu *vcpu, __u8 failed),
TP_ARGS(vcpu, failed),
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 5382b82462fc..e7d01d7d350b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7474,6 +7474,7 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
{
unsigned long field;
gva_t gva;
+ struct vcpu_vmx *vmx = to_vmx(vcpu);
unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
/* The value to write might be 32 or 64 bits, depending on L1's long
@@ -7512,6 +7513,7 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
return 1;
}
+ trace_kvm_vmwrite(vmx->nested.current_vmptr, field, field_value);
if (vmcs12_write_any(vcpu, field, field_value) < 0) {
nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
skip_emulated_instruction(vcpu);
--
2.7.4
next reply other threads:[~2016-11-04 23:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 23:18 Paolo Bonzini [this message]
2016-11-05 10:48 ` [PATCH] KVM: nVMX: add tracepoint for vmwrite kbuild test robot
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=1478301536-12555-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lprosek@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).