diff options
author | Feng (Eric) Liu <eric.e.liu@intel.com> | 2008-04-10 15:31:10 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-27 05:01:19 -0400 |
commit | 2714d1d3d6be882b97cd0125140fccf9976a460a (patch) | |
tree | 57b654cafff076ae95b62b7763113b1ef8511eb5 /include/linux/kvm.h | |
parent | 53371b5098543ab09dcb0c7ce31da887dbe58c62 (diff) |
KVM: Add trace markers
Trace markers allow userspace to trace execution of a virtual machine
in order to monitor its performance.
Signed-off-by: Feng (Eric) Liu <eric.e.liu@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'include/linux/kvm.h')
-rw-r--r-- | include/linux/kvm.h | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index f04bb426618f..d302d63517e4 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -14,6 +14,12 @@ | |||
14 | 14 | ||
15 | #define KVM_API_VERSION 12 | 15 | #define KVM_API_VERSION 12 |
16 | 16 | ||
17 | /* for KVM_TRACE_ENABLE */ | ||
18 | struct kvm_user_trace_setup { | ||
19 | __u32 buf_size; /* sub_buffer size of each per-cpu */ | ||
20 | __u32 buf_nr; /* the number of sub_buffers of each per-cpu */ | ||
21 | }; | ||
22 | |||
17 | /* for KVM_CREATE_MEMORY_REGION */ | 23 | /* for KVM_CREATE_MEMORY_REGION */ |
18 | struct kvm_memory_region { | 24 | struct kvm_memory_region { |
19 | __u32 slot; | 25 | __u32 slot; |
@@ -242,6 +248,42 @@ struct kvm_s390_interrupt { | |||
242 | __u64 parm64; | 248 | __u64 parm64; |
243 | }; | 249 | }; |
244 | 250 | ||
251 | #define KVM_TRC_SHIFT 16 | ||
252 | /* | ||
253 | * kvm trace categories | ||
254 | */ | ||
255 | #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) | ||
256 | #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) /* only 12 bits */ | ||
257 | |||
258 | /* | ||
259 | * kvm trace action | ||
260 | */ | ||
261 | #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) | ||
262 | #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) | ||
263 | #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) | ||
264 | |||
265 | #define KVM_TRC_HEAD_SIZE 12 | ||
266 | #define KVM_TRC_CYCLE_SIZE 8 | ||
267 | #define KVM_TRC_EXTRA_MAX 7 | ||
268 | |||
269 | /* This structure represents a single trace buffer record. */ | ||
270 | struct kvm_trace_rec { | ||
271 | __u32 event:28; | ||
272 | __u32 extra_u32:3; | ||
273 | __u32 cycle_in:1; | ||
274 | __u32 pid; | ||
275 | __u32 vcpu_id; | ||
276 | union { | ||
277 | struct { | ||
278 | __u32 cycle_lo, cycle_hi; | ||
279 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; | ||
280 | } cycle; | ||
281 | struct { | ||
282 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; | ||
283 | } nocycle; | ||
284 | } u; | ||
285 | }; | ||
286 | |||
245 | #define KVMIO 0xAE | 287 | #define KVMIO 0xAE |
246 | 288 | ||
247 | /* | 289 | /* |
@@ -262,7 +304,12 @@ struct kvm_s390_interrupt { | |||
262 | */ | 304 | */ |
263 | #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ | 305 | #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ |
264 | #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) | 306 | #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) |
265 | 307 | /* | |
308 | * ioctls for kvm trace | ||
309 | */ | ||
310 | #define KVM_TRACE_ENABLE _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) | ||
311 | #define KVM_TRACE_PAUSE _IO(KVMIO, 0x07) | ||
312 | #define KVM_TRACE_DISABLE _IO(KVMIO, 0x08) | ||
266 | /* | 313 | /* |
267 | * Extension capability list. | 314 | * Extension capability list. |
268 | */ | 315 | */ |