• S
    Revert "virtio: turn vq->notification into a nested counter" · 332fa82d
    Stefan Hajnoczi 提交于
    This reverts commit aff8fd18.
    
    Both virtio-net and virtio-crypto do not balance
    virtio_queue_set_notification() enable and disable calls.  This makes
    the notifications_disabled counter unreliable and Doug Goldstein
    reported the following assertion failure:
    
      #3  0x00007ffff44d1c62 in __GI___assert_fail (
          assertion=assertion@entry=0x555555ae8e8a "vq->notification_disabled > 0",
          file=file@entry=0x555555ae89c0 "/home/doug/work/qemu/hw/virtio/virtio.c",
          line=line@entry=215,
          function=function@entry=0x555555ae9630 <__PRETTY_FUNCTION__.43707>
          "virtio_queue_set_notification") at assert.c:101
      #4  0x00005555557f25d6 in virtio_queue_set_notification (vq=0x55555666aa90,
          enable=enable@entry=1) at /home/doug/work/qemu/hw/virtio/virtio.c:215
      #5  0x00005555557dc311 in virtio_net_has_buffers (q=<optimized out>,
          q=<optimized out>, bufsize=102)
          at /home/doug/work/qemu/hw/net/virtio-net.c:1008
      #6  virtio_net_receive (nc=<optimized out>, buf=0x555557386b88 "", size=102)
          at /home/doug/work/qemu/hw/net/virtio-net.c:1148
      #7  0x00005555559cad33 in nc_sendv_compat (flags=<optimized out>, iovcnt=1,
          iov=0x7fffead746d0, nc=0x55555788b340) at net/net.c:705
      #8  qemu_deliver_packet_iov (sender=<optimized out>, flags=<optimized out>,
          iov=0x7fffead746d0, iovcnt=1, opaque=0x55555788b340) at net/net.c:732
      #9  0x00005555559cd929 in qemu_net_queue_deliver (size=<optimized out>,
          data=<optimized out>, flags=<optimized out>, sender=<optimized out>,
          queue=0x55555788b550) at net/queue.c:164
      #10 qemu_net_queue_flush (queue=0x55555788b550) at net/queue.c:261
    
    This patch is safe to revert since it's just an optimization for
    virtqueue polling.  The next patch will improve the situation again
    without resorting to nesting.
    Reported-by: NDoug Goldstein <cardoe@cardoe.com>
    Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
    Tested-by: NRichard Henderson <rth@twiddle.net>
    Tested-by: NLaszlo Ersek <lersek@redhat.com>
    Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
    332fa82d
virtio.c 64.6 KB