mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:38:03 +00:00
LoongArch: KVM: Add mmio trace events support
Add mmio trace events support, currently generic mmio events KVM_TRACE_MMIO_WRITE/xxx_READ/xx_READ_UNSATISFIED are added here. Also vcpu id field is added for all kvm trace events, since perf KVM tool parses vcpu id information for kvm entry event. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
163e9fc695
commit
7b7e584f90
@ -9,6 +9,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/preempt.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <trace/events/kvm.h>
|
||||
#include <asm/fpu.h>
|
||||
#include <asm/inst.h>
|
||||
#include <asm/loongarch.h>
|
||||
@ -441,6 +442,8 @@ int kvm_emu_mmio_read(struct kvm_vcpu *vcpu, larch_inst inst)
|
||||
vcpu->arch.io_gpr = rd;
|
||||
run->mmio.is_write = 0;
|
||||
vcpu->mmio_is_write = 0;
|
||||
trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, run->mmio.len,
|
||||
run->mmio.phys_addr, NULL);
|
||||
} else {
|
||||
kvm_err("Read not supported Inst=0x%08x @%lx BadVaddr:%#lx\n",
|
||||
inst.word, vcpu->arch.pc, vcpu->arch.badv);
|
||||
@ -487,6 +490,9 @@ int kvm_complete_mmio_read(struct kvm_vcpu *vcpu, struct kvm_run *run)
|
||||
break;
|
||||
}
|
||||
|
||||
trace_kvm_mmio(KVM_TRACE_MMIO_READ, run->mmio.len,
|
||||
run->mmio.phys_addr, run->mmio.data);
|
||||
|
||||
return er;
|
||||
}
|
||||
|
||||
@ -588,6 +594,8 @@ int kvm_emu_mmio_write(struct kvm_vcpu *vcpu, larch_inst inst)
|
||||
run->mmio.is_write = 1;
|
||||
vcpu->mmio_needed = 1;
|
||||
vcpu->mmio_is_write = 1;
|
||||
trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, run->mmio.len,
|
||||
run->mmio.phys_addr, data);
|
||||
} else {
|
||||
vcpu->arch.pc = curr_pc;
|
||||
kvm_err("Write not supported Inst=0x%08x @%lx BadVaddr:%#lx\n",
|
||||
|
@ -19,14 +19,16 @@ DECLARE_EVENT_CLASS(kvm_transition,
|
||||
TP_PROTO(struct kvm_vcpu *vcpu),
|
||||
TP_ARGS(vcpu),
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned int, vcpu_id)
|
||||
__field(unsigned long, pc)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->vcpu_id = vcpu->vcpu_id;
|
||||
__entry->pc = vcpu->arch.pc;
|
||||
),
|
||||
|
||||
TP_printk("PC: 0x%08lx", __entry->pc)
|
||||
TP_printk("vcpu %u PC: 0x%08lx", __entry->vcpu_id, __entry->pc)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(kvm_transition, kvm_enter,
|
||||
@ -54,19 +56,22 @@ DECLARE_EVENT_CLASS(kvm_exit,
|
||||
TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
|
||||
TP_ARGS(vcpu, reason),
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned int, vcpu_id)
|
||||
__field(unsigned long, pc)
|
||||
__field(unsigned int, reason)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->vcpu_id = vcpu->vcpu_id;
|
||||
__entry->pc = vcpu->arch.pc;
|
||||
__entry->reason = reason;
|
||||
),
|
||||
|
||||
TP_printk("[%s]PC: 0x%08lx",
|
||||
__print_symbolic(__entry->reason,
|
||||
kvm_trace_symbol_exit_types),
|
||||
__entry->pc)
|
||||
TP_printk("vcpu %u [%s] PC: 0x%08lx",
|
||||
__entry->vcpu_id,
|
||||
__print_symbolic(__entry->reason,
|
||||
kvm_trace_symbol_exit_types),
|
||||
__entry->pc)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(kvm_exit, kvm_exit_idle,
|
||||
@ -85,14 +90,17 @@ TRACE_EVENT(kvm_exit_gspr,
|
||||
TP_PROTO(struct kvm_vcpu *vcpu, unsigned int inst_word),
|
||||
TP_ARGS(vcpu, inst_word),
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned int, vcpu_id)
|
||||
__field(unsigned int, inst_word)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->vcpu_id = vcpu->vcpu_id;
|
||||
__entry->inst_word = inst_word;
|
||||
),
|
||||
|
||||
TP_printk("Inst word: 0x%08x", __entry->inst_word)
|
||||
TP_printk("vcpu %u Inst word: 0x%08x", __entry->vcpu_id,
|
||||
__entry->inst_word)
|
||||
);
|
||||
|
||||
#define KVM_TRACE_AUX_SAVE 0
|
||||
|
Loading…
Reference in New Issue
Block a user