arm/arm64: KVM: Add tracepoints for vgic and timer
authorChristoffer Dall <christoffer.dall@linaro.org>
Sun, 30 Aug 2015 11:57:20 +0000 (13:57 +0200)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 22 Oct 2015 21:01:48 +0000 (23:01 +0200)
The VGIC and timer code for KVM arm/arm64 doesn't have any tracepoints
or tracepoint infrastructure defined.  Rewriting some of the timer code
handling showed me how much we need this, so let's add these simple
trace points once and for all and we can easily expand with additional
trace points in these files as we go along.

Cc: Wei Huang <wei@redhat.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/arm/arch_timer.c
virt/kvm/arm/trace.h [new file with mode: 0644]
virt/kvm/arm/vgic.c

index 523816d8c4028d7bd41f07044c888ec4933bc7b8..21a0ab2d891949768d25ff45796f189bad0881e5 100644 (file)
@@ -28,6 +28,8 @@
 #include <kvm/arm_vgic.h>
 #include <kvm/arm_arch_timer.h>
 
+#include "trace.h"
+
 static struct timecounter *timecounter;
 static struct workqueue_struct *wqueue;
 static unsigned int host_vtimer_irq;
@@ -129,6 +131,8 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level)
        BUG_ON(!vgic_initialized(vcpu->kvm));
 
        timer->irq.level = new_level;
+       trace_kvm_timer_update_irq(vcpu->vcpu_id, timer->map->virt_irq,
+                                  timer->irq.level);
        ret = kvm_vgic_inject_mapped_irq(vcpu->kvm, vcpu->vcpu_id,
                                         timer->map,
                                         timer->irq.level);
diff --git a/virt/kvm/arm/trace.h b/virt/kvm/arm/trace.h
new file mode 100644 (file)
index 0000000..37d8b98
--- /dev/null
@@ -0,0 +1,63 @@
+#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_KVM_H
+
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM kvm
+
+/*
+ * Tracepoints for vgic
+ */
+TRACE_EVENT(vgic_update_irq_pending,
+       TP_PROTO(unsigned long vcpu_id, __u32 irq, bool level),
+       TP_ARGS(vcpu_id, irq, level),
+
+       TP_STRUCT__entry(
+               __field(        unsigned long,  vcpu_id )
+               __field(        __u32,          irq     )
+               __field(        bool,           level   )
+       ),
+
+       TP_fast_assign(
+               __entry->vcpu_id        = vcpu_id;
+               __entry->irq            = irq;
+               __entry->level          = level;
+       ),
+
+       TP_printk("VCPU: %ld, IRQ %d, level: %d",
+                 __entry->vcpu_id, __entry->irq, __entry->level)
+);
+
+/*
+ * Tracepoints for arch_timer
+ */
+TRACE_EVENT(kvm_timer_update_irq,
+       TP_PROTO(unsigned long vcpu_id, __u32 irq, int level),
+       TP_ARGS(vcpu_id, irq, level),
+
+       TP_STRUCT__entry(
+               __field(        unsigned long,  vcpu_id )
+               __field(        __u32,          irq     )
+               __field(        int,            level   )
+       ),
+
+       TP_fast_assign(
+               __entry->vcpu_id        = vcpu_id;
+               __entry->irq            = irq;
+               __entry->level          = level;
+       ),
+
+       TP_printk("VCPU: %ld, IRQ %d, level %d",
+                 __entry->vcpu_id, __entry->irq, __entry->level)
+);
+
+#endif /* _TRACE_KVM_H */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH ../../../virt/kvm/arm
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE trace
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
index 84abc6f38c1d2d5b2b289c4dc5f7d796cf2707fd..d4669eb29b77f7a177371bd031621925488b8551 100644 (file)
@@ -34,6 +34,9 @@
 #include <asm/kvm.h>
 #include <kvm/iodev.h>
 
+#define CREATE_TRACE_POINTS
+#include "trace.h"
+
 /*
  * How the whole thing works (courtesy of Christoffer Dall):
  *
@@ -1574,6 +1577,8 @@ static int vgic_update_irq_pending(struct kvm *kvm, int cpuid,
        int enabled;
        bool ret = true, can_inject = true;
 
+       trace_vgic_update_irq_pending(cpuid, irq_num, level);
+
        if (irq_num >= min(kvm->arch.vgic.nr_irqs, 1020))
                return -EINVAL;
 
This page took 0.028201 seconds and 5 git commands to generate.