Skip to content

Commit b3e56f3

Browse files
enkerewpoKexyBiscuit
authored andcommitted
FROMGIT: LoongArch: KVM: Add tracepoints for CPUCFG and CSR emulation exits
This patch adds tracepoints to track KVM exits caused by CPUCFG and CSR emulation. Note that IOCSR emulation tracing is already covered by the generic trace_kvm_iocsr(). Reviewed-by: Bibo Mao <[email protected]> Signed-off-by: Yulong Han <[email protected]> Signed-off-by: Huacai Chen <[email protected]> (cherry picked from commit 36d09b9 https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git loongarch-next) Signed-off-by: Kexy Biscuit <[email protected]>
1 parent 0fcf49a commit b3e56f3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

arch/loongarch/kvm/exit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,11 @@ static int kvm_trap_handle_gspr(struct kvm_vcpu *vcpu)
289289
er = EMULATE_FAIL;
290290
switch (((inst.word >> 24) & 0xff)) {
291291
case 0x0: /* CPUCFG GSPR */
292+
trace_kvm_exit_cpucfg(vcpu, KVM_TRACE_EXIT_CPUCFG);
292293
er = kvm_emu_cpucfg(vcpu, inst);
293294
break;
294295
case 0x4: /* CSR{RD,WR,XCHG} GSPR */
296+
trace_kvm_exit_csr(vcpu, KVM_TRACE_EXIT_CSR);
295297
er = kvm_handle_csr(vcpu, inst);
296298
break;
297299
case 0x6: /* Cache, Idle and IOCSR GSPR */

arch/loongarch/kvm/trace.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ DEFINE_EVENT(kvm_transition, kvm_out,
4646
/* Further exit reasons */
4747
#define KVM_TRACE_EXIT_IDLE 64
4848
#define KVM_TRACE_EXIT_CACHE 65
49+
#define KVM_TRACE_EXIT_CPUCFG 66
50+
#define KVM_TRACE_EXIT_CSR 67
4951

5052
/* Tracepoints for VM exits */
5153
#define kvm_trace_symbol_exit_types \
5254
{ KVM_TRACE_EXIT_IDLE, "IDLE" }, \
53-
{ KVM_TRACE_EXIT_CACHE, "CACHE" }
55+
{ KVM_TRACE_EXIT_CACHE, "CACHE" }, \
56+
{ KVM_TRACE_EXIT_CPUCFG, "CPUCFG" }, \
57+
{ KVM_TRACE_EXIT_CSR, "CSR" }
5458

5559
DECLARE_EVENT_CLASS(kvm_exit,
5660
TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
@@ -82,6 +86,14 @@ DEFINE_EVENT(kvm_exit, kvm_exit_cache,
8286
TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
8387
TP_ARGS(vcpu, reason));
8488

89+
DEFINE_EVENT(kvm_exit, kvm_exit_cpucfg,
90+
TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
91+
TP_ARGS(vcpu, reason));
92+
93+
DEFINE_EVENT(kvm_exit, kvm_exit_csr,
94+
TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
95+
TP_ARGS(vcpu, reason));
96+
8597
DEFINE_EVENT(kvm_exit, kvm_exit,
8698
TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
8799
TP_ARGS(vcpu, reason));

0 commit comments

Comments
 (0)