diff options
author | Ladi Prosek <lprosek@redhat.com> | 2017-03-24 15:24:50 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-03-27 12:14:45 +0200 |
commit | 57094547dfea4ce784923b8abb53ac3ab4e3961a (patch) | |
tree | 439ffe430c2e91d781e8280bc56aeae8585eaf88 /include/hw/virtio/virtio-input.h | |
parent | 0f5a15e40ad1512c70d1323a73c7b073e32e17ee (diff) | |
download | qemu-57094547dfea4ce784923b8abb53ac3ab4e3961a.zip qemu-57094547dfea4ce784923b8abb53ac3ab4e3961a.tar.gz qemu-57094547dfea4ce784923b8abb53ac3ab4e3961a.tar.bz2 |
virtio-input: fix eventq batching
virtio_input_send buffers input events until it sees a SYNC. Then it
either sends or drops the entire batch, depending on whether eventq
has enough space available. The case to avoid here is partial sends
where only part of the batch would get to the guest.
Using virtqueue_get_avail_bytes to check the state of eventq was not
correct. The queue may have a smaller number of larger buffers
available so bytes may be enough but the batch would still not be
possible to send, leading to the "Huh? No vq elem available" error.
Instead of checking available bytes, this patch optimistically pops
buffers from the queue and puts them back in case it runs out of
space and the batch needs to be dropped.
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Message-id: 1490365490-4854-3-git-send-email-lprosek@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'include/hw/virtio/virtio-input.h')
-rw-r--r-- | include/hw/virtio/virtio-input.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h index 55db310..91df57e 100644 --- a/include/hw/virtio/virtio-input.h +++ b/include/hw/virtio/virtio-input.h @@ -62,7 +62,10 @@ struct VirtIOInput { VirtQueue *evt, *sts; char *serial; - virtio_input_event *queue; + struct { + virtio_input_event event; + VirtQueueElement *elem; + } *queue; uint32_t qindex, qsize; bool active; |