On Tue, 15 May 2007, Gregory Haskins wrote: > >>> On Tue, May 15, 2007 at 3:45 AM, in message <[EMAIL PROTECTED]>, > Avi Kivity <[EMAIL PROTECTED]> wrote: > > Gregory Haskins wrote: > >> Signed- off- by: Gregory Haskins <[EMAIL PROTECTED]> > >> --- > >> > >> drivers/kvm/kvm.h | 1 + > >> drivers/kvm/kvm_main.c | 52 > >> ++++++++++++++++++++++++++++++++++++++++++------ > >> include/linux/kvm.h | 1 + > >> 3 files changed, 48 insertions(+), 6 deletions(- ) > >> > >> diff -- git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h > >> index 7b5d5e6..f5731c4 100644 > >> --- a/drivers/kvm/kvm.h > >> +++ b/drivers/kvm/kvm.h > >> @@ - 333,6 +333,7 @@ struct kvm_vcpu_irq { > >> int deferred; > >> struct task_struct *task; > >> int guest_mode; > >> + int eventfd; > >> > > > > Best to convert the fd to a filp when you install it. This avoids the > > conversion during runtime and allows you to do error checking earlier. > > That was my initial impression also, but then I realized there was a > problem with that: Eventfd doesnt appear to have any way to notify > other entities when the fd is closed. Therefore the filp could be left > dangling in this case. By using the fd instead, I can validate the > pointer each time I need it. Perhaps Davide will have a suggestion > here.
I don't know how critical is the path where you will be doing check. The eventfd_fget() is pretty fast, so if you're not looking at a performance critical path, I'd suggest that. Otherwise you can do an early eventfd_get, and keep the file*. If you have no the ways to know if the userspace disconnected, an atomic_read(&file->f_count)==1 will tell you that you're the only owner of the file* (that is, userspace closed the eventfd descriptor). I'd give preference to the former option though. Avi, as you may have read from lkml, Andrew prefers the eventfd symbols export to come through the kvm tree, since they do not want to export symbols that so far has no module users. - Davide ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel