qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] virtio-net sporadic error with QNX 7.0 guest: virtio-ne


From: Michael S. Tsirkin
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

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



reply via email to

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