Linux Perf
kvm-stat.c File Reference
#include <errno.h>
#include "../../util/kvm-stat.h"
#include <asm/svm.h>
#include <asm/vmx.h>
#include <asm/kvm.h>
Include dependency graph for kvm-stat.c:

Go to the source code of this file.

Macros

#define KVM_TRACE_MMIO_READ_UNSATISFIED   0
 
#define KVM_TRACE_MMIO_READ   1
 
#define KVM_TRACE_MMIO_WRITE   2
 

Functions

 define_exit_reasons_table (vmx_exit_reasons, VMX_EXIT_REASONS)
 
 define_exit_reasons_table (svm_exit_reasons, SVM_EXIT_REASONS)
 
static void mmio_event_get_key (struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
 
static bool mmio_event_begin (struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
 
static bool mmio_event_end (struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
 
static void mmio_event_decode_key (struct perf_kvm_stat *kvm __maybe_unused, struct event_key *key, char *decode)
 
static void ioport_event_get_key (struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
 
static bool ioport_event_begin (struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
 
static bool ioport_event_end (struct perf_evsel *evsel, struct perf_sample *sample __maybe_unused, struct event_key *key __maybe_unused)
 
static void ioport_event_decode_key (struct perf_kvm_stat *kvm __maybe_unused, struct event_key *key, char *decode)
 
int cpu_isa_init (struct perf_kvm_stat *kvm, const char *cpuid)
 

Variables

static struct kvm_events_ops exit_events
 
const char * vcpu_id_str = "vcpu_id"
 
const int decode_str_len = 20
 
const char * kvm_exit_reason = "exit_reason"
 
const char * kvm_entry_trace = "kvm:kvm_entry"
 
const char * kvm_exit_trace = "kvm:kvm_exit"
 
static struct kvm_events_ops mmio_events
 
static struct kvm_events_ops ioport_events
 
const char * kvm_events_tp []
 
struct kvm_reg_events_ops kvm_reg_events_ops []
 
const char *const kvm_skip_events []
 

Macro Definition Documentation

◆ KVM_TRACE_MMIO_READ

#define KVM_TRACE_MMIO_READ   1

Definition at line 37 of file kvm-stat.c.

◆ KVM_TRACE_MMIO_READ_UNSATISFIED

#define KVM_TRACE_MMIO_READ_UNSATISFIED   0

Definition at line 36 of file kvm-stat.c.

◆ KVM_TRACE_MMIO_WRITE

#define KVM_TRACE_MMIO_WRITE   2

Definition at line 38 of file kvm-stat.c.

Function Documentation

◆ cpu_isa_init()

int cpu_isa_init ( struct perf_kvm_stat kvm,
const char *  cpuid 
)

Definition at line 154 of file kvm-stat.c.

◆ define_exit_reasons_table() [1/2]

define_exit_reasons_table ( vmx_exit_reasons  ,
VMX_EXIT_REASONS   
)

◆ define_exit_reasons_table() [2/2]

define_exit_reasons_table ( svm_exit_reasons  ,
SVM_EXIT_REASONS   
)

◆ ioport_event_begin()

static bool ioport_event_begin ( struct perf_evsel evsel,
struct perf_sample sample,
struct event_key key 
)
static

Definition at line 99 of file kvm-stat.c.

Here is the call graph for this function:

◆ ioport_event_decode_key()

static void ioport_event_decode_key ( struct perf_kvm_stat *kvm  __maybe_unused,
struct event_key key,
char *  decode 
)
static

Definition at line 118 of file kvm-stat.c.

◆ ioport_event_end()

static bool ioport_event_end ( struct perf_evsel evsel,
struct perf_sample *sample  __maybe_unused,
struct event_key *key  __maybe_unused 
)
static

Definition at line 111 of file kvm-stat.c.

Here is the call graph for this function:

◆ ioport_event_get_key()

static void ioport_event_get_key ( struct perf_evsel evsel,
struct perf_sample sample,
struct event_key key 
)
static

Definition at line 91 of file kvm-stat.c.

Here is the call graph for this function:

◆ mmio_event_begin()

static bool mmio_event_begin ( struct perf_evsel evsel,
struct perf_sample sample,
struct event_key key 
)
static

Definition at line 40 of file kvm-stat.c.

Here is the call graph for this function:

◆ mmio_event_decode_key()

static void mmio_event_decode_key ( struct perf_kvm_stat *kvm  __maybe_unused,
struct event_key key,
char *  decode 
)
static

Definition at line 74 of file kvm-stat.c.

◆ mmio_event_end()

static bool mmio_event_end ( struct perf_evsel evsel,
struct perf_sample sample,
struct event_key key 
)
static

Definition at line 57 of file kvm-stat.c.

Here is the call graph for this function:

◆ mmio_event_get_key()

static void mmio_event_get_key ( struct perf_evsel evsel,
struct perf_sample sample,
struct event_key key 
)
static

Definition at line 29 of file kvm-stat.c.

Here is the call graph for this function:

Variable Documentation

◆ decode_str_len

const int decode_str_len = 20

Definition at line 19 of file kvm-stat.c.

◆ exit_events

struct kvm_events_ops exit_events
static
Initial value:
= {
.is_begin_event = exit_event_begin,
.is_end_event = exit_event_end,
.decode_key = exit_event_decode_key,
.name = "VM-EXIT"
}
bool exit_event_begin(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
void exit_event_decode_key(struct perf_kvm_stat *kvm, struct event_key *key, char *decode)
bool exit_event_end(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)

Definition at line 11 of file kvm-stat.c.

◆ ioport_events

struct kvm_events_ops ioport_events
static
Initial value:
= {
.is_begin_event = ioport_event_begin,
.is_end_event = ioport_event_end,
.decode_key = ioport_event_decode_key,
.name = "IO Port Access"
}
static bool ioport_event_end(struct perf_evsel *evsel, struct perf_sample *sample __maybe_unused, struct event_key *key __maybe_unused)
Definition: kvm-stat.c:111
static void ioport_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, struct event_key *key, char *decode)
Definition: kvm-stat.c:118
static bool ioport_event_begin(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
Definition: kvm-stat.c:99

Definition at line 127 of file kvm-stat.c.

◆ kvm_entry_trace

const char* kvm_entry_trace = "kvm:kvm_entry"

Definition at line 21 of file kvm-stat.c.

◆ kvm_events_tp

const char* kvm_events_tp[]
Initial value:
= {
"kvm:kvm_entry",
"kvm:kvm_exit",
"kvm:kvm_mmio",
"kvm:kvm_pio",
NULL,
}

Definition at line 134 of file kvm-stat.c.

◆ kvm_exit_reason

const char* kvm_exit_reason = "exit_reason"

Definition at line 20 of file kvm-stat.c.

◆ kvm_exit_trace

const char* kvm_exit_trace = "kvm:kvm_exit"

Definition at line 22 of file kvm-stat.c.

◆ kvm_reg_events_ops

Initial value:
= {
{ .name = "vmexit", .ops = &exit_events },
{ .name = "mmio", .ops = &mmio_events },
{ .name = "ioport", .ops = &ioport_events },
{ NULL, NULL },
}
static struct kvm_events_ops ioport_events
Definition: kvm-stat.c:127
static struct kvm_events_ops mmio_events
Definition: kvm-stat.c:83
static struct kvm_events_ops exit_events
Definition: kvm-stat.c:11
const char * name
Definition: kvm-stat.h:62

Definition at line 142 of file kvm-stat.c.

◆ kvm_skip_events

const char* const kvm_skip_events[]
Initial value:
= {
"HLT",
NULL,
}

Definition at line 149 of file kvm-stat.c.

◆ mmio_events

struct kvm_events_ops mmio_events
static
Initial value:
= {
.is_begin_event = mmio_event_begin,
.is_end_event = mmio_event_end,
.decode_key = mmio_event_decode_key,
.name = "MMIO Access"
}
static bool mmio_event_begin(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
Definition: kvm-stat.c:40
static void mmio_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, struct event_key *key, char *decode)
Definition: kvm-stat.c:74
static bool mmio_event_end(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key)
Definition: kvm-stat.c:57

Definition at line 83 of file kvm-stat.c.

◆ vcpu_id_str

const char* vcpu_id_str = "vcpu_id"

Definition at line 18 of file kvm-stat.c.