提交 ebf9a5a9 编写于 作者: R Rusty Russell

lguest: remove invalid interrupt forcing logic.

20887611 (lguest: notify on empty) introduced
lguest support for the VIRTIO_F_NOTIFY_ON_EMPTY flag, but in fact it turned on
interrupts all the time.

Because we always process one buffer at a time, the inflight count is always 0
when call trigger_irq and so we always ignore VRING_AVAIL_F_NO_INTERRUPT from
the Guest.

It should be looking to see if there are more buffers in the Guest's queue:
if it's empty, then we force an interrupt.

This makes little difference, since we usually have an empty queue; but
that's the subject of another patch.
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 a6c372de
...@@ -172,9 +172,6 @@ struct virtqueue ...@@ -172,9 +172,6 @@ struct virtqueue
/* The routine to call when the Guest pings us, or timeout. */ /* The routine to call when the Guest pings us, or timeout. */
void (*handle_output)(struct virtqueue *me, bool timeout); void (*handle_output)(struct virtqueue *me, bool timeout);
/* Outstanding buffers */
unsigned int inflight;
/* Is this blocked awaiting a timer? */ /* Is this blocked awaiting a timer? */
bool blocked; bool blocked;
}; };
...@@ -699,7 +696,6 @@ static unsigned get_vq_desc(struct virtqueue *vq, ...@@ -699,7 +696,6 @@ static unsigned get_vq_desc(struct virtqueue *vq,
errx(1, "Looped descriptor"); errx(1, "Looped descriptor");
} while ((i = next_desc(vq, i)) != vq->vring.num); } while ((i = next_desc(vq, i)) != vq->vring.num);
vq->inflight++;
return head; return head;
} }
...@@ -717,7 +713,6 @@ static void add_used(struct virtqueue *vq, unsigned int head, int len) ...@@ -717,7 +713,6 @@ static void add_used(struct virtqueue *vq, unsigned int head, int len)
/* Make sure buffer is written before we update index. */ /* Make sure buffer is written before we update index. */
wmb(); wmb();
vq->vring.used->idx++; vq->vring.used->idx++;
vq->inflight--;
} }
/* This actually sends the interrupt for this virtqueue */ /* This actually sends the interrupt for this virtqueue */
...@@ -727,7 +722,7 @@ static void trigger_irq(struct virtqueue *vq) ...@@ -727,7 +722,7 @@ static void trigger_irq(struct virtqueue *vq)
/* If they don't want an interrupt, don't send one, unless empty. */ /* If they don't want an interrupt, don't send one, unless empty. */
if ((vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) if ((vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
&& vq->inflight) && lg_last_avail(vq) != vq->vring.avail->idx)
return; return;
/* Send the Guest an interrupt tell them we used something up. */ /* Send the Guest an interrupt tell them we used something up. */
...@@ -1171,7 +1166,6 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, ...@@ -1171,7 +1166,6 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
vq->next = NULL; vq->next = NULL;
vq->last_avail_idx = 0; vq->last_avail_idx = 0;
vq->dev = dev; vq->dev = dev;
vq->inflight = 0;
vq->blocked = false; vq->blocked = false;
/* Initialize the configuration. */ /* Initialize the configuration. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册