Add some trace events to virtio-rng for easier debugging Signed-off-by: Amit Shah <amit.s...@redhat.com> --- hw/virtio/virtio-rng.c | 5 +++++ trace-events | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 1356aca..84d4651 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; } @@ -61,6 +63,7 @@ static void chr_read(void *opaque, const void *buf, size_t size) 0, buf + offset, size - offset); offset += len; + trace_virtio_rng_bytes_pushed(vrng, len); virtqueue_push(vrng->vq, &elem, len); } virtio_notify(vdev, vrng->vq); @@ -82,6 +85,8 @@ static void virtio_rng_process(VirtIORNG *vrng) } size = get_request_size(vrng->vq, quota); size = MIN(vrng->quota_remaining, size); + + trace_virtio_rng_requested_size(vrng, size, quota); if (size) { rng_backend_request_entropy(vrng->rng, size, chr_read, vrng); } diff --git a/trace-events b/trace-events index 11a17a8..d4e7a8e 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_bytes_pushed(void *rng, size_t len) "rng %p: %zd bytes pushed" +virtio_rng_requested_size(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