Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 148003
b: refs/heads/master
c: b60da13
h: refs/heads/master
i:
  148001: 09efe65
  147999: 69879e5
v: v3
  • Loading branch information
Rusty Russell committed Jun 12, 2009
1 parent 4818d00 commit d94090b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a8962e21bc505c714fc2508494d4c7dd3fe2d29
refs/heads/master: b60da13fc7bbf99d3c68578bd3fbcf66e1cb5f41
15 changes: 15 additions & 0 deletions trunk/Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ static struct termios orig_term;
* threads and so we need to make sure that changes visible to the Guest happen
* in precise order. */
#define wmb() __asm__ __volatile__("" : : : "memory")
#define mb() __asm__ __volatile__("" : : : "memory")

/* Convert an iovec element to the given type.
*
Expand Down Expand Up @@ -593,9 +594,23 @@ static unsigned wait_for_vq_desc(struct virtqueue *vq,
/* OK, tell Guest about progress up to now. */
trigger_irq(vq);

/* OK, now we need to know about added descriptors. */
vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;

/* They could have slipped one in as we were doing that: make
* sure it's written, then check again. */
mb();
if (last_avail != vq->vring.avail->idx) {
vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
break;
}

/* Nothing new? Wait for eventfd to tell us they refilled. */
if (read(vq->eventfd, &event, sizeof(event)) != sizeof(event))
errx(1, "Event read failed?");

/* We don't need to be notified again. */
vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
}

/* Check it isn't doing very strange things with descriptor numbers. */
Expand Down

0 comments on commit d94090b

Please sign in to comment.