Re: [patch] eventfd - revised interface and cleanups (2nd rev)

Davide Libenzi
2009-06-23T19:55:24Z

On Tue, 23 Jun 2009, Andrew Morton wrote:

> On Tue, 23 Jun 2009 12:25:36 -0700 (PDT)
> Davide Libenzi <davidel@xmailserver.org> wrote:
>
> > The following patch changes the eventfd interface to de-couple the eventfd
> > memory context, from the file pointer instance.
> > Without such change, there is no clean way to racely free handle the
> > POLLHUP event sent when the last instance of the file* goes away.
> > Also, now the internal eventfd APIs are using the eventfd context instead
> > of the file*.
> > Another cleanup this patch does, is making AIO select EVENTFD, instead of
> > adding a bunch of empty function stubs inside eventfd.h in order to
> > handle the (AIO && !EVENTFD) case.
> >
>
> If we really want to squeeze this into 2.6.31 then it would be helpful
> to have justification in the changelog, please. I see that some KVM
> feature needs it, but what and why and why now, etc?

The patch in -next added the ability to have waiters to be notified when
the last instance of the file* is dropped (that is, on ->release).
But it is not possible for waiters to handle the POLLHUP event in a
racy-free way, unless the eventfd memory context is de-coupled from the
file*.
The next patches from gregory will use eventfd (and the POLLHUP handling)
to implement the IRQfd code inside KVM.

> What's going on here?

The POLLHUP patch in -next is not sufficent. I based the patch over
mainline, but if you guys want I can rebase it over -next.

- Davide