On 07/05/2012 06:16 PM, Paolo Bonzini wrote: > This is broken; since the eventfd is used in nonblocking mode there > is a race between reading and writing. > > diff --git a/event_notifier.c b/event_notifier.c > index 2b210f4..c339bfe 100644 > --- a/event_notifier.c > +++ b/event_notifier.c > @@ -51,18 +51,3 @@ int event_notifier_test_and_clear(EventNotifier *e) > int r = read(e->fd, &value, sizeof(value)); > return r == sizeof(value); > } > - > -int event_notifier_test(EventNotifier *e) > -{ > - uint64_t value; > - int r = read(e->fd, &value, sizeof(value)); > - if (r == sizeof(value)) { > - /* restore previous value. */ > - int s = write(e->fd, &value, sizeof(value)); > - /* never blocks because we use EFD_SEMAPHORE. > - * If we didn't we'd get EAGAIN on overflow > - * and we'd have to write code to ignore it. */ > - assert(s == sizeof(value)); > - } > - return r == sizeof(value); > -} I don't see the race. Mind explaining? It does however require than a poller be extra careful when reading; and the function is silly anyway. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html