From 2b8cbf0ba6dc4ff5cacb42c563b653b1a9b854ef Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 27 Dec 2010 16:47:58 -0200 Subject: [RHEL6 qemu-kvm PATCH 08/23] trace: Trace virtqueue operations RH-Author: Jes Sorensen Message-id: <1293468492-25473-7-git-send-email-Jes.Sorensen@redhat.com> Patchwork-id: 15289 O-Subject: [PATCH 06/20] trace: Trace virtqueue operations Bugzilla: 632722 RH-Acked-by: Markus Armbruster RH-Acked-by: Gleb Natapov RH-Acked-by: Marcelo Tosatti RH-Acked-by: Daniel P. Berrange From: Stefan Hajnoczi This patch adds trace events for virtqueue operations including adding/removing buffers, notifying the guest, and receiving a notify from the guest. Signed-off-by: Stefan Hajnoczi (cherry picked from commit 64979a4d611f0bd19031bbb9ecbd869e6d2ecb48) --- hw/virtio.c | 8 ++++++++ trace-events | 8 ++++++++ 2 files changed, 16 insertions(+), 0 deletions(-) Signed-off-by: Eduardo Habkost --- hw/virtio.c | 8 ++++++++ trace-events | 8 ++++++++ 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index f6ad42d..c8a0fc6 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -13,6 +13,7 @@ #include +#include "trace.h" #include "virtio.h" #include "sysemu.h" @@ -205,6 +206,8 @@ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem, unsigned int offset; int i; + trace_virtqueue_fill(vq, elem, len, idx); + offset = 0; for (i = 0; i < elem->in_num; i++) { size_t size = MIN(len - offset, elem->in_sg[i].iov_len); @@ -232,6 +235,7 @@ void virtqueue_flush(VirtQueue *vq, unsigned int count) { /* Make sure buffer is written before we update index. */ wmb(); + trace_virtqueue_flush(vq, count); vring_used_idx_increment(vq, count); vq->inuse -= count; } @@ -432,6 +436,7 @@ int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) vq->inuse++; + trace_virtqueue_pop(vq, elem, elem->in_num, elem->out_num); return elem->in_num + elem->out_num; } @@ -572,6 +577,7 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n) void virtio_queue_notify(VirtIODevice *vdev, int n) { if (n < VIRTIO_PCI_QUEUE_MAX && vdev->vq[n].vring.desc) { + trace_virtio_queue_notify(vdev, n, &vdev->vq[n]); vdev->vq[n].handle_output(vdev, &vdev->vq[n]); } } @@ -609,6 +615,7 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, void virtio_irq(VirtQueue *vq) { + trace_virtio_irq(vq); vq->vdev->isr |= 0x01; virtio_notify_vector(vq->vdev, vq->vector); } @@ -621,6 +628,7 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq) (vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx))) return; + trace_virtio_notify(vdev, vq); vdev->isr |= 0x01; virtio_notify_vector(vdev, vq->vector); } diff --git a/trace-events b/trace-events index de6479e..29580a5 100644 --- a/trace-events +++ b/trace-events @@ -38,6 +38,14 @@ disable qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu s disable qemu_valloc(size_t size, void *ptr) "size %zu ptr %p" disable qemu_vfree(void *ptr) "ptr %p" +# hw/virtio.c +disable virtqueue_fill(void *vq, const void *elem, unsigned int len, unsigned int idx) "vq %p elem %p len %u idx %u" +disable virtqueue_flush(void *vq, unsigned int count) "vq %p count %u" +disable virtqueue_pop(void *vq, void *elem, unsigned int in_num, unsigned int out_num) "vq %p elem %p in_num %u out_num %u" +disable virtio_queue_notify(void *vdev, int n, void *vq) "vdev %p n %d vq %p" +disable virtio_irq(void *vq) "vq %p" +disable virtio_notify(void *vdev, void *vq) "vdev %p vq %p" + # block.c disable multiwrite_cb(void *mcb, int ret) "mcb %p ret %d" disable bdrv_aio_multiwrite(void *mcb, int num_callbacks, int num_reqs) "mcb %p num_callbacks %d num_reqs %d" -- 1.7.3.2