arch/loongarch/kvm/trace.h

Source file repositories/reference/linux-study-clean/arch/loongarch/kvm/trace.h

File Facts

System
Linux kernel
Corpus path
arch/loongarch/kvm/trace.h
Extension
.h
Size
5519 bytes
Lines
222
Domain
Architecture Layer
Bucket
arch/loongarch
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_KVM_H

#include <linux/tracepoint.h>
#include <asm/kvm_csr.h>

#undef	TRACE_SYSTEM
#define TRACE_SYSTEM	kvm

/*
 * Tracepoints for VM enters
 */
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("vcpu %u PC: 0x%08lx", __entry->vcpu_id, __entry->pc)
);

DEFINE_EVENT(kvm_transition, kvm_enter,
	     TP_PROTO(struct kvm_vcpu *vcpu),
	     TP_ARGS(vcpu));

DEFINE_EVENT(kvm_transition, kvm_reenter,
	     TP_PROTO(struct kvm_vcpu *vcpu),
	     TP_ARGS(vcpu));

DEFINE_EVENT(kvm_transition, kvm_out,
	     TP_PROTO(struct kvm_vcpu *vcpu),
	     TP_ARGS(vcpu));

/* Further exit reasons */
#define KVM_TRACE_EXIT_IDLE		64
#define KVM_TRACE_EXIT_CACHE		65
#define KVM_TRACE_EXIT_CPUCFG		66
#define KVM_TRACE_EXIT_CSR		67

/* Tracepoints for VM exits */
#define kvm_trace_symbol_exit_types			\
	{ KVM_TRACE_EXIT_IDLE,		"IDLE" },	\
	{ KVM_TRACE_EXIT_CACHE,		"CACHE" },	\
	{ KVM_TRACE_EXIT_CPUCFG,	"CPUCFG" },	\
	{ KVM_TRACE_EXIT_CSR,		"CSR" }

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("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,
	     TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
	     TP_ARGS(vcpu, reason));

DEFINE_EVENT(kvm_exit, kvm_exit_cache,
	     TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
	     TP_ARGS(vcpu, reason));

DEFINE_EVENT(kvm_exit, kvm_exit_cpucfg,
	     TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
	     TP_ARGS(vcpu, reason));

DEFINE_EVENT(kvm_exit, kvm_exit_csr,
	     TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
	     TP_ARGS(vcpu, reason));

Annotation

Implementation Notes