qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] virtio: enhance virtio_error messages


From: Ladi Prosek
Subject: Re: [Qemu-devel] [PATCH] virtio: enhance virtio_error messages
Date: Wed, 12 Jul 2017 12:53:29 +0200

On Wed, Jul 12, 2017 at 11:55 AM, Stefan Hajnoczi <address@hidden> wrote:
> 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.

Makes sense, will do!

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

I had tried this and couldn't get a good id for all devices. Maybe
it's a problem specific to scsi and serial, I'll look into it.

      dev: virtio-scsi-pci, id "vscsi"
        bus: virtio-bus
          dev: virtio-scsi-device, id ""

Thanks!
Ladi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]