Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1515523 > unrolled thread
| Started by | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| First post | 2016-11-05 09:50 +0100 |
| Last post | 2016-11-07 15:00 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2] KVM: nVMX: add tracepoint for vmwrite Paolo Bonzini <pbonzini@redhat.com> - 2016-11-05 09:50 +0100
Re: [PATCH v2] KVM: nVMX: add tracepoint for vmwrite Ladi Prosek <lprosek@redhat.com> - 2016-11-07 15:00 +0100
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Date | 2016-11-05 09:50 +0100 |
| Subject | [PATCH v2] KVM: nVMX: add tracepoint for vmwrite |
| Message-ID | <sA4PL-5CQ-1@gated-at.bofh.it> |
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 ++
arch/x86/kvm/x86.c | 1 +
3 files changed, 26 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);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7e30c720d0c5..2be66e90f297 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -8495,3 +8495,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_pml_full);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_pi_irte_update);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_unaccelerated_access);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_incomplete_ipi);
+EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmwrite);
--
2.7.4
[toc] | [next] | [standalone]
| From | Ladi Prosek <lprosek@redhat.com> |
|---|---|
| Date | 2016-11-07 15:00 +0100 |
| Message-ID | <sASCX-3R8-39@gated-at.bofh.it> |
| In reply to | #1515523 |
On Sat, Nov 5, 2016 at 9:44 AM, Paolo Bonzini <pbonzini@redhat.com> wrote: > 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 ++ > arch/x86/kvm/x86.c | 1 + > 3 files changed, 26 insertions(+) Works for me, thanks! Tested-by: Ladi Prosek <lprosek@redhat.com>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web