qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 1/1] virtio-rng: add some trace events
@ 2014-08-04 10:52 Amit Shah
  2014-08-05  4:45 ` Amos Kong
  2014-08-12 13:24 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Amit Shah @ 2014-08-04 10:52 UTC (permalink / raw)
  To: qemu list; +Cc: Amit Shah, Amos Kong, Stefan Hajnoczi

Add some trace events to virtio-rng for easier debugging

Signed-off-by: Amit Shah <amit.shah@redhat.com>

---
v2:
 - requested_size trace event now shows proper values
---
 hw/virtio/virtio-rng.c | 6 ++++++
 trace-events           | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 03fd04a..e85a979 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -16,6 +16,7 @@
 #include "hw/virtio/virtio-rng.h"
 #include "sysemu/rng.h"
 #include "qom/object_interfaces.h"
+#include "trace.h"
 
 static bool is_guest_ready(VirtIORNG *vrng)
 {
@@ -24,6 +25,7 @@ static bool is_guest_ready(VirtIORNG *vrng)
         && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
         return true;
     }
+    trace_virtio_rng_guest_not_ready(vrng);
     return false;
 }
 
@@ -62,6 +64,7 @@ static void chr_read(void *opaque, const void *buf, size_t size)
         offset += len;
 
         virtqueue_push(vrng->vq, &elem, len);
+        trace_virtio_rng_pushed(vrng, len);
     }
     virtio_notify(vdev, vrng->vq);
 }
@@ -81,6 +84,9 @@ static void virtio_rng_process(VirtIORNG *vrng)
         quota = MIN((uint64_t)vrng->quota_remaining, (uint64_t)UINT32_MAX);
     }
     size = get_request_size(vrng->vq, quota);
+
+    trace_virtio_rng_request(vrng, size, quota);
+
     size = MIN(vrng->quota_remaining, size);
     if (size) {
         rng_backend_request_entropy(vrng->rng, size, chr_read, vrng);
diff --git a/trace-events b/trace-events
index 11a17a8..99f39ac 100644
--- a/trace-events
+++ b/trace-events
@@ -41,6 +41,11 @@ 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/virtio-rng.c
+virtio_rng_guest_not_ready(void *rng) "rng %p: guest not ready"
+virtio_rng_pushed(void *rng, size_t len) "rng %p: %zd bytes pushed"
+virtio_rng_request(void *rng, size_t size, unsigned quota) "rng %p: %zd bytes requested, %u bytes quota left"
+
 # hw/char/virtio-serial-bus.c
 virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u"
 virtio_serial_throttle_port(unsigned int port, bool throttle) "port %u, throttle %d"
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] virtio-rng: add some trace events
  2014-08-04 10:52 [Qemu-devel] [PATCH v2 1/1] virtio-rng: add some trace events Amit Shah
@ 2014-08-05  4:45 ` Amos Kong
  2014-08-12 13:24 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Amos Kong @ 2014-08-05  4:45 UTC (permalink / raw)
  To: Amit Shah; +Cc: qemu list, Stefan Hajnoczi

On Mon, Aug 04, 2014 at 04:22:44PM +0530, Amit Shah wrote:
> Add some trace events to virtio-rng for easier debugging
> 
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> 
> ---
> v2:
>  - requested_size trace event now shows proper values


Reviewed-by: Amos Kong <akong@redhat.com>

> ---
>  hw/virtio/virtio-rng.c | 6 ++++++
>  trace-events           | 5 +++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
> index 03fd04a..e85a979 100644
> --- a/hw/virtio/virtio-rng.c
> +++ b/hw/virtio/virtio-rng.c
> @@ -16,6 +16,7 @@
>  #include "hw/virtio/virtio-rng.h"
>  #include "sysemu/rng.h"
>  #include "qom/object_interfaces.h"
> +#include "trace.h"
>  
>  static bool is_guest_ready(VirtIORNG *vrng)
>  {
> @@ -24,6 +25,7 @@ static bool is_guest_ready(VirtIORNG *vrng)
>          && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
>          return true;
>      }
> +    trace_virtio_rng_guest_not_ready(vrng);
>      return false;
>  }
>  
> @@ -62,6 +64,7 @@ static void chr_read(void *opaque, const void *buf, size_t size)
>          offset += len;
>  
>          virtqueue_push(vrng->vq, &elem, len);
> +        trace_virtio_rng_pushed(vrng, len);
>      }
>      virtio_notify(vdev, vrng->vq);
>  }
> @@ -81,6 +84,9 @@ static void virtio_rng_process(VirtIORNG *vrng)
>          quota = MIN((uint64_t)vrng->quota_remaining, (uint64_t)UINT32_MAX);
>      }
>      size = get_request_size(vrng->vq, quota);
> +
> +    trace_virtio_rng_request(vrng, size, quota);
> +
>      size = MIN(vrng->quota_remaining, size);
>      if (size) {
>          rng_backend_request_entropy(vrng->rng, size, chr_read, vrng);
> diff --git a/trace-events b/trace-events
> index 11a17a8..99f39ac 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -41,6 +41,11 @@ 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/virtio-rng.c
> +virtio_rng_guest_not_ready(void *rng) "rng %p: guest not ready"
> +virtio_rng_pushed(void *rng, size_t len) "rng %p: %zd bytes pushed"
> +virtio_rng_request(void *rng, size_t size, unsigned quota) "rng %p: %zd bytes requested, %u bytes quota left"
> +
>  # hw/char/virtio-serial-bus.c
>  virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u"
>  virtio_serial_throttle_port(unsigned int port, bool throttle) "port %u, throttle %d"
> -- 
> 1.9.3

-- 
			Amos.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] virtio-rng: add some trace events
  2014-08-04 10:52 [Qemu-devel] [PATCH v2 1/1] virtio-rng: add some trace events Amit Shah
  2014-08-05  4:45 ` Amos Kong
@ 2014-08-12 13:24 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-08-12 13:24 UTC (permalink / raw)
  To: Amit Shah; +Cc: Amos Kong, qemu list

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

On Mon, Aug 04, 2014 at 04:22:44PM +0530, Amit Shah wrote:
> Add some trace events to virtio-rng for easier debugging
> 
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> 
> ---
> v2:
>  - requested_size trace event now shows proper values
> ---
>  hw/virtio/virtio-rng.c | 6 ++++++
>  trace-events           | 5 +++++
>  2 files changed, 11 insertions(+)

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

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-12 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-04 10:52 [Qemu-devel] [PATCH v2 1/1] virtio-rng: add some trace events Amit Shah
2014-08-05  4:45 ` Amos Kong
2014-08-12 13:24 ` Stefan Hajnoczi

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).