FIXME: remeasure
lguest: suppress notifications in example Launcher

The Guest only really needs to tell us about activity when we're going
to listen to the eventfd: normally, we don't want to know.

So if there are no available buffers, turn on notifications, re-check,
then wait for the Guest to notify us via the eventfd, then turn
notifications off again.

Guest -> Host benchmarks, GSO disabled:
Before:
	time tcpblast -o -s 65536 -c 1k                   0.935 0.840 1.017
	time tcpblast -o -s 65536 -c 1k > /dev/null       0.707 1.092 1.635
	netperf -t UDP_RR (rate/sec)                      17479 17842 17710
	netperf -t TCP_STREAM (Mbit/sec)                  37.06 30.53 37.28
	kernel compile (allnoconfig, seconds)             121 117 117

After:
	time tcpblast -o -s 65536 -c 1k                   1.002 1.146 1.106
	time tcpblast -o -s 65536 -c 1k > /dev/null       0.710 0.714 0.710
	netperf -t UDP_RR (rate/sec)                      22006 17899 17400
	netperf -t TCP_STREAM (Mbit/sec)                  37.07 35.98 37.10
	kernel compile (allnoconfig, seconds)             121 117 117
---
 Documentation/lguest/lguest.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -174,6 +174,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.
  *
@@ -600,9 +601,23 @@ static unsigned wait_for_vq_desc(struct 
 		/* 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. */
