Skip to contentSkip to conversation

Add some tracepoints for clarification of the cause of troubles

PATCH Applied Kazuya Saito 3 participants 5 messages Mar 29, 2013 – Apr 8, 2013 KVM

lore
Share & tools
lore
#0 lore raw

v2 cover Add some tracepoints for clarification of the cause of troubles

This series adds tracepoints for helping us clarify the cause of troubles. Virtualization on Linux is composed of some components such as qemu, kvm, libvirt, and so on. So it is very important to clarify firstly and swiftly the cause of troubles is on what component of them. Although qemu has useful information of this because it stands among kvm, libvirt and guest, it doesn't output the information by trace or log system.
These patches add tracepoints which lead to reduce the time of the clarification. We'd like to add the tracepoints as the first set because, based on our experience, we've found out they must be useful for an investigation in the future. Without those tracepoints, we had a really hard time investigating a problem since the problem's reproducibility was quite low and there was no clue in the dump of qemu.

Changes from v1:
Add arg to kvm_ioctl, kvm_vm_ioctl, kvm_vcpu_ioctl tracepoints. Add cpu_index to kvm_vcpu_ioctl, kvm_run_exit tracepoints.

Kazuya Saito (2):
kvm-all: add kvm_ioctl, kvm_vm_ioctl, kvm_vcpu_ioctl tracepoints
kvm-all: add kvm_run_exit tracepoint

 kvm-all.c    |    5 +++++
 trace-events |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
#1 lore raw

PATCH v2 1/2 kvm-all: add kvm_ioctl, kvm_vm_ioctl, kvm_vcpu_ioctl tracepoints

This patch adds tracepoints at ioctl to kvm. Tracing these ioctl is useful for clarification whether the cause of troubles is qemu or kvm.

---
 kvm-all.c    |    4 ++++
 trace-events |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)
kvm-all.c +4 -0
index 9b433d3..fdb099c 100644
@@ -33,6 +33,7 @@
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 #include "qemu/event_notifier.h"
+#include "trace.h"
 
 /* This check must be after config-host.h is included */
 #ifdef CONFIG_EVENTFD
@@ -1634,6 +1635,7 @@ int kvm_ioctl(KVMState *s, int type, ...)
     arg = va_arg(ap, void *);
     va_end(ap);
 
+    trace_kvm_ioctl(type, arg);
     ret = ioctl(s->fd, type, arg);
     if (ret == -1) {
         ret = -errno;
@@ -1651,6 +1653,7 @@ int kvm_vm_ioctl(KVMState *s, int type, ...)
     arg = va_arg(ap, void *);
     va_end(ap);
 
+    trace_kvm_vm_ioctl(type, arg);
     ret = ioctl(s->vmfd, type, arg);
     if (ret == -1) {
         ret = -errno;
@@ -1668,6 +1671,7 @@ int kvm_vcpu_ioctl(CPUState *cpu, int type, ...)
     arg = va_arg(ap, void *);
     va_end(ap);
 
+    trace_kvm_vcpu_ioctl(cpu->cpu_index, type, arg);
     ret = ioctl(cpu->kvm_fd, type, arg);
     if (ret == -1) {
         ret = -errno;
trace-events +5 -0
index 7f34112..3023744 100644
@@ -1101,3 +1101,8 @@ virtio_ccw_new_device(int cssid, int ssid, int schid, int devno, const char *dev
 
 # migration.c
 migrate_set_state(int new_state) "new state %d"
+
+# kvm-all.c
+kvm_ioctl(int type, void *arg) "type %d, arg %p"
+kvm_vm_ioctl(int type, void *arg) "type %d, arg %p"
+kvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type %d, arg %p"
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/2 kvm-all: add kvm_run_exit tracepoint

In reply to Kazuya Saito

This patch enable us to know exit reason of KVM_RUN. It will help us know where the trouble is caused.

---
 kvm-all.c    |    1 +
 trace-events |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)
kvm-all.c +1 -0
index fdb099c..325f5e7 100644
@@ -1574,6 +1574,7 @@ int kvm_cpu_exec(CPUArchState *env)
             abort();
         }
 
+        trace_kvm_run_exit(cpu->cpu_index, run->exit_reason);
         switch (run->exit_reason) {
         case KVM_EXIT_IO:
             DPRINTF("handle_io\n");
trace-events +2 -0
index 3023744..8fd6e80 100644
@@ -1106,3 +1106,5 @@ migrate_set_state(int new_state) "new state %d"
 kvm_ioctl(int type, void *arg) "type %d, arg %p"
 kvm_vm_ioctl(int type, void *arg) "type %d, arg %p"
 kvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type %d, arg %p"
+kvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
+
Signature · 1 line
1.7.1
maintainer Reviewed-by on the v2 series
#3 lore raw
In reply to Kazuya Saito

Il 29/03/2013 05:24, Kazuya Saito ha scritto:

Quoted 19 lines

This series adds tracepoints for helping us clarify the cause of troubles. Virtualization on Linux is composed of some components such as qemu, kvm, libvirt, and so on. So it is very important to clarify firstly and swiftly the cause of troubles is on what component of them. Although qemu has useful information of this because it stands among kvm, libvirt and guest, it doesn't output the information by trace or log system.
These patches add tracepoints which lead to reduce the time of the clarification. We'd like to add the tracepoints as the first set because, based on our experience, we've found out they must be useful for an investigation in the future. Without those tracepoints, we had a really hard time investigating a problem since the problem's reproducibility was quite low and there was no clue in the dump of qemu.

Changes from v1:
Add arg to kvm_ioctl, kvm_vm_ioctl, kvm_vcpu_ioctl tracepoints. Add cpu_index to kvm_vcpu_ioctl, kvm_run_exit tracepoints.

Quoted 7 lines

Kazuya Saito (2):
kvm-all: add kvm_ioctl, kvm_vm_ioctl, kvm_vcpu_ioctl tracepoints
kvm-all: add kvm_run_exit tracepoint

 kvm-all.c    |    5 +++++
 trace-events |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

Series:

Paolo

#4 lore raw
In reply to Kazuya Saito
Quoted 19 lines · Kazuya Saito

This series adds tracepoints for helping us clarify the cause of troubles. Virtualization on Linux is composed of some components such as qemu, kvm, libvirt, and so on. So it is very important to clarify firstly and swiftly the cause of troubles is on what component of them. Although qemu has useful information of this because it stands among kvm, libvirt and guest, it doesn't output the information by trace or log system.
These patches add tracepoints which lead to reduce the time of the clarification. We'd like to add the tracepoints as the first set because, based on our experience, we've found out they must be useful for an investigation in the future. Without those tracepoints, we had a really hard time investigating a problem since the problem's reproducibility was quite low and there was no clue in the dump of qemu.

Changes from v1:
Add arg to kvm_ioctl, kvm_vm_ioctl, kvm_vcpu_ioctl tracepoints. Add cpu_index to kvm_vcpu_ioctl, kvm_run_exit tracepoints.

Quoted 10 lines

Kazuya Saito (2):
kvm-all: add kvm_ioctl, kvm_vm_ioctl, kvm_vcpu_ioctl tracepoints
kvm-all: add kvm_run_exit tracepoint

 kvm-all.c    |    5 +++++
 trace-events |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan