All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1 v2] KVM: nVMX: nSVM: Show guest mode in kvm_{entry,exit} tracepoints
@ 2021-08-20  3:05 Krish Sadhukhan
  2021-08-20  3:05 ` [PATCH v2 1/1] " Krish Sadhukhan
  0 siblings, 1 reply; 2+ messages in thread
From: Krish Sadhukhan @ 2021-08-20  3:05 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, jmattson, seanjc, vkuznets, wanpengli, joro

v1 -> v2:
	1. The tracepoints will print "nested" if the VCPU is running
	   a nested guest.
	2. The commit message has been modified to reflect the change.


[PATCH v2 1/1] KVM: nVMX: nSVM: Show guest mode in kvm_{entry,exit}

 arch/x86/kvm/trace.h | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Krish Sadhukhan (1):
      KVM: nVMX: nSVM: Show guest mode in kvm_{entry,exit} tracepoints


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v2 1/1] KVM: nVMX: nSVM: Show guest mode in kvm_{entry,exit} tracepoints
  2021-08-20  3:05 [PATCH 0/1 v2] KVM: nVMX: nSVM: Show guest mode in kvm_{entry,exit} tracepoints Krish Sadhukhan
@ 2021-08-20  3:05 ` Krish Sadhukhan
  0 siblings, 0 replies; 2+ messages in thread
From: Krish Sadhukhan @ 2021-08-20  3:05 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, jmattson, seanjc, vkuznets, wanpengli, joro

From debugging point of view, KVM entry and exit tracepoints are important
in that they indicate when a guest starts and exits. When L1 runs L2, there
is no way we can determine from KVM tracing when L1 starts/exits and when
L2 starts/exits as there is no marker in place today in those tracepoints.
Therefore, showing guest mode in the entry and exit tracepoints
will make debugging much easier.
With this patch KVM entry and exit tracepoints will show "nested" if the
vCPU is running a nested guest.

Signed-off-by: Krish Sdhukhan <krish.sadhukhan@oracle.com>
---
 arch/x86/kvm/trace.h | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 03ebe368333e..091415870ae2 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -21,14 +21,17 @@ TRACE_EVENT(kvm_entry,
 	TP_STRUCT__entry(
 		__field(	unsigned int,	vcpu_id		)
 		__field(	unsigned long,	rip		)
+		__field(        bool,           nested		)
 	),
 
 	TP_fast_assign(
 		__entry->vcpu_id        = vcpu->vcpu_id;
 		__entry->rip		= kvm_rip_read(vcpu);
+		__entry->nested		= is_guest_mode(vcpu);
 	),
 
-	TP_printk("vcpu %u, rip 0x%lx", __entry->vcpu_id, __entry->rip)
+	TP_printk("vcpu %u, rip 0x%lx%s", __entry->vcpu_id,
+		  __entry->rip, __entry->nested ? ", (nested)" : "")
 );
 
 /*
@@ -300,6 +303,7 @@ TRACE_EVENT(name,							     \
 		__field(	u32,	        intr_info	)	     \
 		__field(	u32,	        error_code	)	     \
 		__field(	unsigned int,	vcpu_id         )	     \
+		__field(        bool,           nested		)	     \
 	),								     \
 									     \
 	TP_fast_assign(							     \
@@ -310,15 +314,17 @@ TRACE_EVENT(name,							     \
 		static_call(kvm_x86_get_exit_info)(vcpu, &__entry->info1,    \
 					  &__entry->info2,		     \
 					  &__entry->intr_info,		     \
-					  &__entry->error_code);	     \
+					  &__entry->error_code),	     \
+		  __entry->nested	= is_guest_mode(vcpu);		     \
 	),								     \
 									     \
 	TP_printk("vcpu %u reason %s%s%s rip 0x%lx info1 0x%016llx "	     \
-		  "info2 0x%016llx intr_info 0x%08x error_code 0x%08x",	     \
-		  __entry->vcpu_id,					     \
+		  "info2 0x%016llx intr_info 0x%08x error_code 0x%08x "	     \
+		  "%s", __entry->vcpu_id,				     \
 		  kvm_print_exit_reason(__entry->exit_reason, __entry->isa), \
 		  __entry->guest_rip, __entry->info1, __entry->info2,	     \
-		  __entry->intr_info, __entry->error_code)		     \
+		  __entry->intr_info, __entry->error_code,                   \
+		  __entry->nested ? "(nested)" : "")      		     \
 )
 
 /*
-- 
2.18.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-20  3:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20  3:05 [PATCH 0/1 v2] KVM: nVMX: nSVM: Show guest mode in kvm_{entry,exit} tracepoints Krish Sadhukhan
2021-08-20  3:05 ` [PATCH v2 1/1] " Krish Sadhukhan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.