diff options
-rw-r--r-- | arch/x86/kvm/i8259.c | 3 | ||||
-rw-r--r-- | arch/x86/kvm/lapic.c | 4 | ||||
-rw-r--r-- | arch/x86/kvm/trace.h | 85 | ||||
-rw-r--r-- | include/trace/events/kvm.h | 56 | ||||
-rw-r--r-- | virt/kvm/ioapic.c | 2 | ||||
-rw-r--r-- | virt/kvm/irq_comm.c | 2 |
6 files changed, 152 insertions, 0 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index 1d1bb75dc7bc..e4bcbddecb36 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "irq.h" | 30 | #include "irq.h" |
31 | 31 | ||
32 | #include <linux/kvm_host.h> | 32 | #include <linux/kvm_host.h> |
33 | #include "trace.h" | ||
33 | 34 | ||
34 | static void pic_lock(struct kvm_pic *s) | 35 | static void pic_lock(struct kvm_pic *s) |
35 | __acquires(&s->lock) | 36 | __acquires(&s->lock) |
@@ -190,6 +191,8 @@ int kvm_pic_set_irq(void *opaque, int irq, int level) | |||
190 | if (irq >= 0 && irq < PIC_NUM_PINS) { | 191 | if (irq >= 0 && irq < PIC_NUM_PINS) { |
191 | ret = pic_set_irq1(&s->pics[irq >> 3], irq & 7, level); | 192 | ret = pic_set_irq1(&s->pics[irq >> 3], irq & 7, level); |
192 | pic_update_irq(s); | 193 | pic_update_irq(s); |
194 | trace_kvm_pic_set_irq(irq >> 3, irq & 7, s->pics[irq >> 3].elcr, | ||
195 | s->pics[irq >> 3].imr, ret == 0); | ||
193 | } | 196 | } |
194 | pic_unlock(s); | 197 | pic_unlock(s); |
195 | 198 | ||
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 6c8460308548..5d697602048b 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -375,6 +375,8 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, | |||
375 | break; | 375 | break; |
376 | 376 | ||
377 | result = !apic_test_and_set_irr(vector, apic); | 377 | result = !apic_test_and_set_irr(vector, apic); |
378 | trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, | ||
379 | trig_mode, vector, result); | ||
378 | if (!result) { | 380 | if (!result) { |
379 | if (trig_mode) | 381 | if (trig_mode) |
380 | apic_debug("level trig mode repeatedly for " | 382 | apic_debug("level trig mode repeatedly for " |
@@ -493,6 +495,8 @@ static void apic_send_ipi(struct kvm_lapic *apic) | |||
493 | else | 495 | else |
494 | irq.dest_id = GET_APIC_DEST_FIELD(icr_high); | 496 | irq.dest_id = GET_APIC_DEST_FIELD(icr_high); |
495 | 497 | ||
498 | trace_kvm_apic_ipi(icr_low, irq.dest_id); | ||
499 | |||
496 | apic_debug("icr_high 0x%x, icr_low 0x%x, " | 500 | apic_debug("icr_high 0x%x, icr_low 0x%x, " |
497 | "short_hand 0x%x, dest 0x%x, trig_mode 0x%x, level 0x%x, " | 501 | "short_hand 0x%x, dest 0x%x, trig_mode 0x%x, level 0x%x, " |
498 | "dest_mode 0x%x, delivery_mode 0x%x, vector 0x%x\n", | 502 | "dest_mode 0x%x, delivery_mode 0x%x, vector 0x%x\n", |
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 6c2c87fa6e4f..0d480e77eacf 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h | |||
@@ -264,6 +264,91 @@ TRACE_EVENT(kvm_cr, | |||
264 | #define trace_kvm_cr_read(cr, val) trace_kvm_cr(0, cr, val) | 264 | #define trace_kvm_cr_read(cr, val) trace_kvm_cr(0, cr, val) |
265 | #define trace_kvm_cr_write(cr, val) trace_kvm_cr(1, cr, val) | 265 | #define trace_kvm_cr_write(cr, val) trace_kvm_cr(1, cr, val) |
266 | 266 | ||
267 | TRACE_EVENT(kvm_pic_set_irq, | ||
268 | TP_PROTO(__u8 chip, __u8 pin, __u8 elcr, __u8 imr, bool coalesced), | ||
269 | TP_ARGS(chip, pin, elcr, imr, coalesced), | ||
270 | |||
271 | TP_STRUCT__entry( | ||
272 | __field( __u8, chip ) | ||
273 | __field( __u8, pin ) | ||
274 | __field( __u8, elcr ) | ||
275 | __field( __u8, imr ) | ||
276 | __field( bool, coalesced ) | ||
277 | ), | ||
278 | |||
279 | TP_fast_assign( | ||
280 | __entry->chip = chip; | ||
281 | __entry->pin = pin; | ||
282 | __entry->elcr = elcr; | ||
283 | __entry->imr = imr; | ||
284 | __entry->coalesced = coalesced; | ||
285 | ), | ||
286 | |||
287 | TP_printk("chip %u pin %u (%s%s)%s", | ||
288 | __entry->chip, __entry->pin, | ||
289 | (__entry->elcr & (1 << __entry->pin)) ? "level":"edge", | ||
290 | (__entry->imr & (1 << __entry->pin)) ? "|masked":"", | ||
291 | __entry->coalesced ? " (coalesced)" : "") | ||
292 | ); | ||
293 | |||
294 | #define kvm_apic_dst_shorthand \ | ||
295 | {0x0, "dst"}, \ | ||
296 | {0x1, "self"}, \ | ||
297 | {0x2, "all"}, \ | ||
298 | {0x3, "all-but-self"} | ||
299 | |||
300 | TRACE_EVENT(kvm_apic_ipi, | ||
301 | TP_PROTO(__u32 icr_low, __u32 dest_id), | ||
302 | TP_ARGS(icr_low, dest_id), | ||
303 | |||
304 | TP_STRUCT__entry( | ||
305 | __field( __u32, icr_low ) | ||
306 | __field( __u32, dest_id ) | ||
307 | ), | ||
308 | |||
309 | TP_fast_assign( | ||
310 | __entry->icr_low = icr_low; | ||
311 | __entry->dest_id = dest_id; | ||
312 | ), | ||
313 | |||
314 | TP_printk("dst %x vec %u (%s|%s|%s|%s|%s)", | ||
315 | __entry->dest_id, (u8)__entry->icr_low, | ||
316 | __print_symbolic((__entry->icr_low >> 8 & 0x7), | ||
317 | kvm_deliver_mode), | ||
318 | (__entry->icr_low & (1<<11)) ? "logical" : "physical", | ||
319 | (__entry->icr_low & (1<<14)) ? "assert" : "de-assert", | ||
320 | (__entry->icr_low & (1<<15)) ? "level" : "edge", | ||
321 | __print_symbolic((__entry->icr_low >> 18 & 0x3), | ||
322 | kvm_apic_dst_shorthand)) | ||
323 | ); | ||
324 | |||
325 | TRACE_EVENT(kvm_apic_accept_irq, | ||
326 | TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec, bool coalesced), | ||
327 | TP_ARGS(apicid, dm, tm, vec, coalesced), | ||
328 | |||
329 | TP_STRUCT__entry( | ||
330 | __field( __u32, apicid ) | ||
331 | __field( __u16, dm ) | ||
332 | __field( __u8, tm ) | ||
333 | __field( __u8, vec ) | ||
334 | __field( bool, coalesced ) | ||
335 | ), | ||
336 | |||
337 | TP_fast_assign( | ||
338 | __entry->apicid = apicid; | ||
339 | __entry->dm = dm; | ||
340 | __entry->tm = tm; | ||
341 | __entry->vec = vec; | ||
342 | __entry->coalesced = coalesced; | ||
343 | ), | ||
344 | |||
345 | TP_printk("apicid %x vec %u (%s|%s)%s", | ||
346 | __entry->apicid, __entry->vec, | ||
347 | __print_symbolic((__entry->dm >> 8 & 0x7), kvm_deliver_mode), | ||
348 | __entry->tm ? "level" : "edge", | ||
349 | __entry->coalesced ? " (coalesced)" : "") | ||
350 | ); | ||
351 | |||
267 | #endif /* _TRACE_KVM_H */ | 352 | #endif /* _TRACE_KVM_H */ |
268 | 353 | ||
269 | /* This part must be outside protection */ | 354 | /* This part must be outside protection */ |
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h index 77022af48492..dbe108455275 100644 --- a/include/trace/events/kvm.h +++ b/include/trace/events/kvm.h | |||
@@ -28,6 +28,62 @@ TRACE_EVENT(kvm_set_irq, | |||
28 | __entry->gsi, __entry->level, __entry->irq_source_id) | 28 | __entry->gsi, __entry->level, __entry->irq_source_id) |
29 | ); | 29 | ); |
30 | 30 | ||
31 | #define kvm_deliver_mode \ | ||
32 | {0x0, "Fixed"}, \ | ||
33 | {0x1, "LowPrio"}, \ | ||
34 | {0x2, "SMI"}, \ | ||
35 | {0x3, "Res3"}, \ | ||
36 | {0x4, "NMI"}, \ | ||
37 | {0x5, "INIT"}, \ | ||
38 | {0x6, "SIPI"}, \ | ||
39 | {0x7, "ExtINT"} | ||
40 | |||
41 | TRACE_EVENT(kvm_ioapic_set_irq, | ||
42 | TP_PROTO(__u64 e, int pin, bool coalesced), | ||
43 | TP_ARGS(e, pin, coalesced), | ||
44 | |||
45 | TP_STRUCT__entry( | ||
46 | __field( __u64, e ) | ||
47 | __field( int, pin ) | ||
48 | __field( bool, coalesced ) | ||
49 | ), | ||
50 | |||
51 | TP_fast_assign( | ||
52 | __entry->e = e; | ||
53 | __entry->pin = pin; | ||
54 | __entry->coalesced = coalesced; | ||
55 | ), | ||
56 | |||
57 | TP_printk("pin %u dst %x vec=%u (%s|%s|%s%s)%s", | ||
58 | __entry->pin, (u8)(__entry->e >> 56), (u8)__entry->e, | ||
59 | __print_symbolic((__entry->e >> 8 & 0x7), kvm_deliver_mode), | ||
60 | (__entry->e & (1<<11)) ? "logical" : "physical", | ||
61 | (__entry->e & (1<<15)) ? "level" : "edge", | ||
62 | (__entry->e & (1<<16)) ? "|masked" : "", | ||
63 | __entry->coalesced ? " (coalesced)" : "") | ||
64 | ); | ||
65 | |||
66 | TRACE_EVENT(kvm_msi_set_irq, | ||
67 | TP_PROTO(__u64 address, __u64 data), | ||
68 | TP_ARGS(address, data), | ||
69 | |||
70 | TP_STRUCT__entry( | ||
71 | __field( __u64, address ) | ||
72 | __field( __u64, data ) | ||
73 | ), | ||
74 | |||
75 | TP_fast_assign( | ||
76 | __entry->address = address; | ||
77 | __entry->data = data; | ||
78 | ), | ||
79 | |||
80 | TP_printk("dst %u vec %x (%s|%s|%s%s)", | ||
81 | (u8)(__entry->address >> 12), (u8)__entry->data, | ||
82 | __print_symbolic((__entry->data >> 8 & 0x7), kvm_deliver_mode), | ||
83 | (__entry->address & (1<<2)) ? "logical" : "physical", | ||
84 | (__entry->data & (1<<15)) ? "level" : "edge", | ||
85 | (__entry->address & (1<<3)) ? "|rh" : "") | ||
86 | ); | ||
31 | 87 | ||
32 | #define kvm_irqchips \ | 88 | #define kvm_irqchips \ |
33 | {KVM_IRQCHIP_PIC_MASTER, "PIC master"}, \ | 89 | {KVM_IRQCHIP_PIC_MASTER, "PIC master"}, \ |
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 92496ff3d82d..b91fbb215447 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/processor.h> | 36 | #include <asm/processor.h> |
37 | #include <asm/page.h> | 37 | #include <asm/page.h> |
38 | #include <asm/current.h> | 38 | #include <asm/current.h> |
39 | #include <trace/events/kvm.h> | ||
39 | 40 | ||
40 | #include "ioapic.h" | 41 | #include "ioapic.h" |
41 | #include "lapic.h" | 42 | #include "lapic.h" |
@@ -193,6 +194,7 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level) | |||
193 | (!edge && !entry.fields.remote_irr)) | 194 | (!edge && !entry.fields.remote_irr)) |
194 | ret = ioapic_service(ioapic, irq); | 195 | ret = ioapic_service(ioapic, irq); |
195 | } | 196 | } |
197 | trace_kvm_ioapic_set_irq(entry.bits, irq, ret == 0); | ||
196 | } | 198 | } |
197 | return ret; | 199 | return ret; |
198 | } | 200 | } |
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c index a9d7fd1f1d6a..001663ff401a 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c | |||
@@ -100,6 +100,8 @@ static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, | |||
100 | { | 100 | { |
101 | struct kvm_lapic_irq irq; | 101 | struct kvm_lapic_irq irq; |
102 | 102 | ||
103 | trace_kvm_msi_set_irq(e->msi.address_lo, e->msi.data); | ||
104 | |||
103 | irq.dest_id = (e->msi.address_lo & | 105 | irq.dest_id = (e->msi.address_lo & |
104 | MSI_ADDR_DEST_ID_MASK) >> MSI_ADDR_DEST_ID_SHIFT; | 106 | MSI_ADDR_DEST_ID_MASK) >> MSI_ADDR_DEST_ID_SHIFT; |
105 | irq.vector = (e->msi.data & | 107 | irq.vector = (e->msi.data & |