qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ladi Prosek <lprosek@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Fernando Casas Schössow" <casasfernando@hotmail.com>
Subject: Re: [Qemu-devel] [PATCH] virtio: enhance virtio_error messages
Date: Wed, 12 Jul 2017 12:53:29 +0200	[thread overview]
Message-ID: <CABdb736PVDoxnOGoX5+eESUeKC20m4oL2+A0X=-dS7ZbnmZLVg@mail.gmail.com> (raw)
In-Reply-To: <20170712095556.GC6923@stefanha-x1.localdomain>

On Wed, Jul 12, 2017 at 11:55 AM, Stefan Hajnoczi <stefanha@redhat.com> 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 <lprosek@redhat.com>
>> ---
>>  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	other threads:[~2017-07-12 10:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12  8:05 [Qemu-devel] [PATCH] virtio: enhance virtio_error messages Ladi Prosek
2017-07-12  9:55 ` Stefan Hajnoczi
2017-07-12 10:53   ` Ladi Prosek [this message]

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='CABdb736PVDoxnOGoX5+eESUeKC20m4oL2+A0X=-dS7ZbnmZLVg@mail.gmail.com' \
    --to=lprosek@redhat.com \
    --cc=casasfernando@hotmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).