From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3SCS-00040s-Hs for qemu-devel@nongnu.org; Tue, 13 Sep 2011 08:34:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3SCO-0008Qq-An for qemu-devel@nongnu.org; Tue, 13 Sep 2011 08:34:52 -0400 Received: from mtagate3.uk.ibm.com ([194.196.100.163]:49995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3SCO-0008Qm-3i for qemu-devel@nongnu.org; Tue, 13 Sep 2011 08:34:48 -0400 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p8DCYlEM026364 for ; Tue, 13 Sep 2011 12:34:47 GMT Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8DCYllg2187322 for ; Tue, 13 Sep 2011 13:34:47 +0100 Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8DCYgdl032273 for ; Tue, 13 Sep 2011 06:34:43 -0600 From: Stefan Hajnoczi Date: Tue, 13 Sep 2011 13:34:37 +0100 Message-Id: <1315917277-20670-5-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1315917277-20670-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1315917277-20670-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 4/4] trace: add virtio_set_status() trace event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , William Cohen , Stefan Hajnoczi The virtio device lifecycle can be observed by looking at the sequence of set status operations. This is especially important for catching the reset operation (status value 0), which resets the device and all virtqueues. Signed-off-by: Stefan Hajnoczi --- hw/virtio.c | 10 ++++++++++ hw/virtio.h | 9 +-------- trace-events | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index 13aa0fa..946d911 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -498,6 +498,16 @@ void virtio_update_irq(VirtIODevice *vdev) virtio_notify_vector(vdev, VIRTIO_NO_VECTOR); } +void virtio_set_status(VirtIODevice *vdev, uint8_t val) +{ + trace_virtio_set_status(vdev, val); + + if (vdev->set_status) { + vdev->set_status(vdev, val); + } + vdev->status = val; +} + void virtio_reset(void *opaque) { VirtIODevice *vdev = opaque; diff --git a/hw/virtio.h b/hw/virtio.h index c129264..666e381 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -135,14 +135,6 @@ struct VirtIODevice VMChangeStateEntry *vmstate; }; -static inline void virtio_set_status(VirtIODevice *vdev, uint8_t val) -{ - if (vdev->set_status) { - vdev->set_status(vdev, val); - } - vdev->status = val; -} - VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, void (*handle_output)(VirtIODevice *, VirtQueue *)); @@ -190,6 +182,7 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n); void virtio_queue_notify(VirtIODevice *vdev, int n); uint16_t virtio_queue_vector(VirtIODevice *vdev, int n); void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector); +void virtio_set_status(VirtIODevice *vdev, uint8_t val); void virtio_reset(void *opaque); void virtio_update_irq(VirtIODevice *vdev); diff --git a/trace-events b/trace-events index 9a59525..99edc97 100644 --- a/trace-events +++ b/trace-events @@ -42,6 +42,7 @@ virtqueue_pop(void *vq, void *elem, unsigned int in_num, unsigned int out_num) " virtio_queue_notify(void *vdev, int n, void *vq) "vdev %p n %d vq %p" virtio_irq(void *vq) "vq %p" virtio_notify(void *vdev, void *vq) "vdev %p vq %p" +virtio_set_status(void *vdev, uint8_t val) "vdev %p val %u" # hw/virtio-serial-bus.c virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u" -- 1.7.5.4