Re: [patch 13/13] signal/timer/event fds v9 - KAIO eventfd supportexample ...

From: Avi Kivity
Date: Sun Apr 01 2007 - 11:07:27 EST


Davide Libenzi wrote:
This is an example about how to add eventfd support to the current KAIO code,
in order to enable KAIO to post readiness events to a pollable fd
(hence compatible with POSIX select/poll). The KAIO code simply signals
the eventfd fd when events are ready, and this triggers a POLLIN in the fd.
This patch uses a reserved for future use member of the struct iocb to pass
an eventfd file descriptor, that KAIO will use to post events every time
a request completes. At that point, an aio_getevents() will return the
completed result to a struct io_event.
I made a quick test program to verify the patch, and it runs fine here:

Index: linux-2.6.21-rc5.fds/include/linux/aio_abi.h
===================================================================
--- linux-2.6.21-rc5.fds.orig/include/linux/aio_abi.h 2007-03-31 12:45:30.000000000 -0700
+++ linux-2.6.21-rc5.fds/include/linux/aio_abi.h 2007-03-31 12:46:31.000000000 -0700
@@ -84,7 +84,11 @@
/* extra parameters */
__u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */
- __u64 aio_reserved3;
+ __u32 aio_reserved3;
+ /*
+ * If different from 0, this is an eventfd to deliver AIO results to
+ */
+ __u32 aio_resfd;
}; /* 64 bytes */

What is the motivation for adding aio_resfd to an individual iocb instead of the entire io context? It seems redundant, as you can already create multiple io contexts to wait on.

[also, minor nit: sys_eventfd() can legitimately return 0, but you're banning its use in aio. userspace could easily dup() and close(), but...]

--
error compiling committee.c: too many arguments to function

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/