diff options
Diffstat (limited to 'Documentation/lguest/lguest.c')
-rw-r--r-- | Documentation/lguest/lguest.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 64110797044a..bb5e3c28d9d6 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -172,6 +172,7 @@ static struct termios orig_term; | |||
172 | * threads and so we need to make sure that changes visible to the Guest happen | 172 | * threads and so we need to make sure that changes visible to the Guest happen |
173 | * in precise order. */ | 173 | * in precise order. */ |
174 | #define wmb() __asm__ __volatile__("" : : : "memory") | 174 | #define wmb() __asm__ __volatile__("" : : : "memory") |
175 | #define mb() __asm__ __volatile__("" : : : "memory") | ||
175 | 176 | ||
176 | /* Convert an iovec element to the given type. | 177 | /* Convert an iovec element to the given type. |
177 | * | 178 | * |
@@ -593,9 +594,23 @@ static unsigned wait_for_vq_desc(struct virtqueue *vq, | |||
593 | /* OK, tell Guest about progress up to now. */ | 594 | /* OK, tell Guest about progress up to now. */ |
594 | trigger_irq(vq); | 595 | trigger_irq(vq); |
595 | 596 | ||
597 | /* OK, now we need to know about added descriptors. */ | ||
598 | vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY; | ||
599 | |||
600 | /* They could have slipped one in as we were doing that: make | ||
601 | * sure it's written, then check again. */ | ||
602 | mb(); | ||
603 | if (last_avail != vq->vring.avail->idx) { | ||
604 | vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY; | ||
605 | break; | ||
606 | } | ||
607 | |||
596 | /* Nothing new? Wait for eventfd to tell us they refilled. */ | 608 | /* Nothing new? Wait for eventfd to tell us they refilled. */ |
597 | if (read(vq->eventfd, &event, sizeof(event)) != sizeof(event)) | 609 | if (read(vq->eventfd, &event, sizeof(event)) != sizeof(event)) |
598 | errx(1, "Event read failed?"); | 610 | errx(1, "Event read failed?"); |
611 | |||
612 | /* We don't need to be notified again. */ | ||
613 | vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY; | ||
599 | } | 614 | } |
600 | 615 | ||
601 | /* Check it isn't doing very strange things with descriptor numbers. */ | 616 | /* Check it isn't doing very strange things with descriptor numbers. */ |