qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Claudio <claudio.fontana@gliwa.com>
Cc: Jason Wang <jasowang@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] virtio-net sporadic error with QNX 7.0 guest: virtio-net ctrl missing headers
Date: Wed, 12 Sep 2018 08:37:23 -0400	[thread overview]
Message-ID: <20180912082250-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <905c68e0-531a-d915-4033-474bda42a643@gliwa.com>

On Wed, Sep 12, 2018 at 10:01:34AM +0200, Claudio wrote:
> Hello Michael, Jason and all,
> 
> I am currently using latest mainline QEMU on x86_64 to run a QNX 7 guest.
> 
> QNX 7 is not free software anymore unfortunately, with the
> the last open source versions in the 6.x range.
> 
> I am using the official virtio-net guest driver from QNX 7.
> 
> During initialization I sporadically get this error message:
> 
> $ qemu-system-x86_64 -machine pc,accel=kvm,kernel_irqchip=on -smp 2 -m 2048 -display none -nodefconfig -nodefaults -chardev stdio,mux=on,id=char0 -serial chardev:char0 -monitor none -mon chardev=char0,mode=readline -netdev user,id=user0,hostfwd=udp::9004-:9004 -device virtio-net,netdev=user0 qnx.img
> 
> virtio-net ctrl missing headers

This means a control buffer is sent either without the input element
or without an output element, or with a single byte output element.

> and following that my host->guest UDP port forwarding does not work, that is,
> the qemu process shows up as listening on the interface, but no packets appear in the guest.
> 
> This error during initialization does not appear every time I launch QEMU.
> It appears to be more or less random.
> 
> Whenever the error does not appear, the interface works as expected, and port forwarding works.
> 
> Latest commit is 
> 
> 19b599f7664b ("Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-08-27-v2'")
> 
> Thanks a lot for any advice!
> 
> Ciao,
> 
> Claudio

If it's easy to reproduce, you can try printing out all commands.
E.g.:

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index f154756e85..34251273a9 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -987,6 +987,10 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
         if (!elem) {
             break;
         }
+        fprintf(stderr, "%s: in %d/%d, out %d/%d\n",
+                elem->in_num, iov_size(elem->in_sg, elem->in_num),
+                elem->out_num, iov_size(elem->out_sg, elem->out_num));
+
         if (iov_size(elem->in_sg, elem->in_num) < sizeof(status) ||
             iov_size(elem->out_sg, elem->out_num) < sizeof(ctrl)) {
             virtio_error(vdev, "virtio-net ctrl missing headers");
@@ -1014,6 +1018,9 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
         } else if (ctrl.class == VIRTIO_NET_CTRL_GUEST_OFFLOADS) {
             status = virtio_net_handle_offloads(n, ctrl.cmd, iov, iov_cnt);
         }
+        fprintf(stderr, "%s: class 0x%x cmd 0x%x cnt %d status 0x%x\n",
+                ctrl.class, ctrl.cmd, iov_cnt, status);
+
 
         s = iov_from_buf(elem->in_sg, elem->in_num, 0, &status, sizeof(status));
         assert(s == sizeof(status));


You can also try replacing virtio_error with fprintf - that will
avoid wedging the device on an error and let you proceed
with debugging.

-- 
MST

  parent reply	other threads:[~2018-09-12 12:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12  8:01 [Qemu-devel] virtio-net sporadic error with QNX 7.0 guest: virtio-net ctrl missing headers Claudio
2018-09-12  8:22 ` Jason Wang
2018-09-12 12:37 ` Michael S. Tsirkin [this message]
2018-09-12 15:16   ` Claudio
2018-09-12 15:31     ` Michael S. Tsirkin
2018-09-12 17:12       ` Claudio
2018-09-12 17:26         ` Michael S. Tsirkin

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=20180912082250-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=claudio.fontana@gliwa.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).