All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX
@ 2011-11-17 13:04 Sasha Levin
  2011-11-17 13:04 ` [PATCH 2/4] kvm tools: Add '--no-dhcp' to disable kernel DHCP Sasha Levin
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Sasha Levin @ 2011-11-17 13:04 UTC (permalink / raw)
  To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin

Support the event index feature in the virtio spec.

The results are less notifications between the guest and host, and in
result faster operation of the virt queues.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/include/kvm/virtio.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
index c6c380d..cd24285 100644
--- a/tools/kvm/include/kvm/virtio.h
+++ b/tools/kvm/include/kvm/virtio.h
@@ -38,6 +38,8 @@ static inline bool virt_queue__available(struct virt_queue *vq)
 {
 	if (!vq->vring.avail)
 		return 0;
+
+	vring_avail_event(&vq->vring) = vq->last_avail_idx;
 	return vq->vring.avail->idx !=  vq->last_avail_idx;
 }
 
@@ -51,6 +53,11 @@ static inline void *guest_pfn_to_host(struct kvm *kvm, u32 pfn)
 	return guest_flat_to_host(kvm, (unsigned long)pfn << VIRTIO_PCI_QUEUE_ADDR_SHIFT);
 }
 
+static inline int virtio_queue__should_signal(struct virt_queue *vq)
+{
+	return vring_used_event(&vq->vring) <= vq->vring.used->idx;
+}
+
 struct vring_used_elem *virt_queue__set_used_elem(struct virt_queue *queue, u32 head, u32 len);
 
 u16 virt_queue__get_iov(struct virt_queue *queue, struct iovec iov[], u16 *out, u16 *in, struct kvm *kvm);
-- 
1.7.8.rc1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-11-17 13:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 13:04 [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Sasha Levin
2011-11-17 13:04 ` [PATCH 2/4] kvm tools: Add '--no-dhcp' to disable kernel DHCP Sasha Levin
2011-11-17 13:04 ` [PATCH 3/4] kvm tools: Support event idx in virtio-net Sasha Levin
2011-11-17 13:04 ` [PATCH 4/4] kvm tool: Add event idx support to virtio-blk Sasha Levin
2011-11-17 13:24 ` [PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX Pekka Enberg
2011-11-17 13:36   ` Sasha Levin
2011-11-17 13:44     ` Pekka Enberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.