[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] virtio: enhance virtio_error messages
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] virtio: enhance virtio_error messages |
Date: |
Wed, 12 Jul 2017 10:55:56 +0100 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Wed, Jul 12, 2017 at 10:05:38AM +0200, Ladi Prosek wrote:
> Output like "Virtqueue size exceeded" is not much useful in identifying the
> culprit. This commit adds virtio device name and queue index to all error
> messages in virtio.c to improve debuggability.
>
> Signed-off-by: Ladi Prosek <address@hidden>
> ---
> hw/virtio/virtio.c | 74
> +++++++++++++++++++++++++++++++++---------------------
> 1 file changed, 46 insertions(+), 28 deletions(-)
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 464947f..5040f26 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -143,7 +143,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev,
> int n)
> len = address_space_cache_init(&new->desc, vdev->dma_as,
> addr, size, false);
> if (len < size) {
> - virtio_error(vdev, "Cannot map desc");
> + virtio_error(vdev, "%s queue %u: Cannot map desc", vdev->name, n);
Good idea!
Please build the identifying information into virtio_error() to avoid
code duplication.
It probably makes sense to add a virtqueue_error(VirtIOQueue *vq, fmt,
...) function. That way the virtqueue number printing doesn't need to
be duplicated.
vdev->name specifies the device type ("virtio-net", "virtio-9p") but
does not uniquely identify the device instance. If a guest has multiple
virtio-net devices then the error message will not identify the device
instance. I think you can use DEVICE(vdev)->id instead to get the
unique -device virtio-net-pci,id=vnet0 identifier.
signature.asc
Description: PGP signature