virtio: cache used_idx in a VirtQueue field
commitb796fcd1bf2978aed15748db04e054f34789e9eb
authorVincenzo Maffione <v.maffione@gmail.com>
Sun, 31 Jan 2016 10:29:04 +0000 (31 11:29 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Sat, 6 Feb 2016 18:44:08 +0000 (6 20:44 +0200)
tree93261b84a89e31a55a29472ab256b32b066e0a5c
parentaa570d6fb6bd0402f27f151a76fb1762e26231ac
virtio: cache used_idx in a VirtQueue field

Accessing used_idx in the VQ requires an expensive access to
guest physical memory. Before this patch, 3 accesses are normally
done for each pop/push/notify call. However, since the used_idx is
only written by us, we can track it in our internal data structure.

Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com>
Message-Id: <3d062ec54e9a7bf9fb325c1fd693564951f2b319.1450218353.git.v.maffione@gmail.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio.c