All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "James Hogan" <james.hogan@imgtec.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Ralf Baechle" <ralf@linux-mips.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	kvm@vger.kernel.org, linux-mips@linux-mips.org
Subject: [PATCH 4/8] MIPS: KVM: Add kvm_asid_change trace event
Date: Tue, 14 Jun 2016 09:40:13 +0100	[thread overview]
Message-ID: <1465893617-5774-5-git-send-email-james.hogan@imgtec.com> (raw)
In-Reply-To: <1465893617-5774-1-git-send-email-james.hogan@imgtec.com>

Add a trace event for guest ASID changes, replacing the existing
kvm_debug call.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
---
 arch/mips/kvm/emulate.c |  7 +++----
 arch/mips/kvm/trace.h   | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
index fce08bda9ebc..ee0e61d2b6fb 100644
--- a/arch/mips/kvm/emulate.c
+++ b/arch/mips/kvm/emulate.c
@@ -1082,11 +1082,10 @@ enum emulation_result kvm_mips_emulate_CP0(u32 inst, u32 *opc, u32 cause,
 				if ((KSEGX(vcpu->arch.gprs[rt]) != CKSEG0) &&
 				    ((kvm_read_c0_guest_entryhi(cop0) &
 				      KVM_ENTRYHI_ASID) != nasid)) {
-					kvm_debug("MTCz, change ASID from %#lx to %#lx\n",
+					trace_kvm_asid_change(vcpu,
 						kvm_read_c0_guest_entryhi(cop0)
-						& KVM_ENTRYHI_ASID,
-						vcpu->arch.gprs[rt]
-						& KVM_ENTRYHI_ASID);
+							& KVM_ENTRYHI_ASID,
+						nasid);
 
 					/* Blow away the shadow host TLBs */
 					kvm_mips_flush_host_tlb(1);
diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h
index 9a1212e09435..1d67d9e0f340 100644
--- a/arch/mips/kvm/trace.h
+++ b/arch/mips/kvm/trace.h
@@ -122,6 +122,28 @@ TRACE_EVENT(kvm_aux,
 		      __entry->pc)
 );
 
+TRACE_EVENT(kvm_asid_change,
+	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int old_asid,
+		     unsigned int new_asid),
+	    TP_ARGS(vcpu, old_asid, new_asid),
+	    TP_STRUCT__entry(
+			__field(unsigned long, pc)
+			__field(u8, old_asid)
+			__field(u8, new_asid)
+	    ),
+
+	    TP_fast_assign(
+			__entry->pc = vcpu->arch.pc;
+			__entry->old_asid = old_asid;
+			__entry->new_asid = new_asid;
+	    ),
+
+	    TP_printk("PC: 0x%08lx old: 0x%02x new: 0x%02x",
+		      __entry->pc,
+		      __entry->old_asid,
+		      __entry->new_asid)
+);
+
 #endif /* _TRACE_KVM_H */
 
 /* This part must be outside protection */
-- 
2.4.10

  parent reply	other threads:[~2016-06-14 10:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14  8:40 [PATCH 0/8] MIPS: KVM: Debug & trace event improvements James Hogan
2016-06-14  8:40 ` [PATCH 1/8] MIPS: KVM: Generalise fpu_inuse for other state James Hogan
2016-06-14  8:40 ` [PATCH 2/8] MIPS: KVM: Add kvm_aux trace event James Hogan
2016-06-14  8:55   ` James Hogan
2016-06-14  9:15     ` Paolo Bonzini
2016-06-14  9:17       ` James Hogan
2016-06-14  8:40 ` [PATCH 3/8] MIPS: KVM: Clean up kvm_exit " James Hogan
2016-06-17 14:10   ` Steven Rostedt
2016-06-17 14:47     ` James Hogan
2016-06-17 15:35       ` Steven Rostedt
2016-06-14  8:40 ` James Hogan [this message]
2016-06-14  8:40 ` [PATCH 5/8] MIPS: KVM: Add guest mode switch trace events James Hogan
2016-06-17 14:08   ` Steven Rostedt
2016-06-17 14:29     ` Paolo Bonzini
2016-06-17 14:58       ` James Hogan
2016-06-17 15:35         ` Steven Rostedt
2016-06-14  8:40 ` [PATCH 6/8] MIPS: KVM: Trace guest register access emulation James Hogan
2016-06-14  8:40 ` [PATCH 7/8] MIPS: KVM: Dump guest tlbs if kvm_get_inst() fails James Hogan
2016-06-14  8:40 ` [PATCH 8/8] MIPS: KVM: Print unknown load/store encodings James Hogan

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=1465893617-5774-5-git-send-email-james.hogan@imgtec.com \
    --to=james.hogan@imgtec.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=ralf@linux-mips.org \
    --cc=rkrcmar@redhat.com \
    --cc=rostedt@goodmis.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 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.