qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
	William Cohen <wcohen@redhat.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 4/4] trace: add virtio_set_status() trace event
Date: Tue, 13 Sep 2011 13:34:37 +0100	[thread overview]
Message-ID: <1315917277-20670-5-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
In-Reply-To: <1315917277-20670-1-git-send-email-stefanha@linux.vnet.ibm.com>

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 <stefanha@linux.vnet.ibm.com>
---
 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

  parent reply	other threads:[~2011-09-13 12:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13 12:34 [Qemu-devel] [PATCH 0/4] Remove trailing double quote limitation and add virtio_set_status trace event Stefan Hajnoczi
2011-09-13 12:34 ` [Qemu-devel] [PATCH 1/4] trace: remove newline from grlib_irqmp_check_irqs format string Stefan Hajnoczi
2011-09-13 12:34 ` [Qemu-devel] [PATCH 2/4] trace: allow PRI*64 at beginning and ending of " Stefan Hajnoczi
2011-09-13 12:34 ` [Qemu-devel] [PATCH 3/4] trace: remove trailing double quotes after PRI*64 Stefan Hajnoczi
2011-09-13 12:34 ` Stefan Hajnoczi [this message]
2011-09-17 18:49 ` [Qemu-devel] [PATCH 0/4] Remove trailing double quote limitation and add virtio_set_status trace event Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315917277-20670-5-git-send-email-stefanha@linux.vnet.ibm.com \
    --to=stefanha@linux.vnet.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wcohen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).