Re: [kvm-devel] [PATCH/RFC 1/2] anon-inodes: Remove fd_install() from anon_inode_getfd()

2008-02-28 Thread Davide Libenzi
On Thu, 28 Feb 2008, Roland Dreier wrote: > > If we let the caller call fd_install(), then it may be messed up WRT > > cleanup (fd, file, inode). > > Yes, that is a tiny bit tricky (need to call put_unused_fd() if you > don't install the fd). > > > How about removing the inode pointer handou

Re: [kvm-devel] [PATCH/RFC 1/2] anon-inodes: Remove fd_install() from anon_inode_getfd()

2008-02-28 Thread Davide Libenzi
On Wed, 27 Feb 2008, Roland Dreier wrote: > > > http://git.kernel.org/?p=linux/kernel/git/viro/vfs-2.6.git;a=commit;h=49be4f8114e6ff0efdab10ebba2493fb67bc3034 > > Actually, looking closer at the kvm changes here, I think that > create_vcpu_fd() needs the same treatment as kvm_dev_ioctl_create_v

Re: [kvm-devel] [PATCH/RFC 1/2] anon-inodes: Remove fd_install() from anon_inode_getfd()

2008-02-27 Thread Davide Libenzi
On Wed, 27 Feb 2008, Roland Dreier wrote: > > > The anonymous inodes interface anon_inode_getfd() calls fd_install() > > > for the newly created fd, which does not work for some use cases where > > > the caller must do futher initialization before exposing the file to > > > userspace. This is

Re: [kvm-devel] [PATCH/RFC 1/2] anon-inodes: Remove fd_install() from anon_inode_getfd()

2008-02-27 Thread Davide Libenzi
[CC-ing Al too] On Wed, 27 Feb 2008, Roland Dreier wrote: > The anonymous inodes interface anon_inode_getfd() calls fd_install() > for the newly created fd, which does not work for some use cases where > the caller must do futher initialization before exposing the file to > userspace. This is a

Re: [kvm-devel] [PATCH 5/9] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-17 Thread Davide Libenzi
On Thu, 17 May 2007, Davide Libenzi wrote: > /* Your eventfd create/setup function (modulo error checks) */ > void setup_eventfd(struct your_ctx *c) { > int fd; > > c->rcb.proc = rcb_callback; > fd = eventfd_create(0, &c->rcb); >

Re: [kvm-devel] [PATCH 5/9] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-17 Thread Davide Libenzi
On Thu, 17 May 2007, Avi Kivity wrote: > Davide Libenzi wrote: > > On Wed, 16 May 2007, Avi Kivity wrote: > > > > > > > IMO doing eventfd_fget() asap is best. I much prefer refcounted pointers > > > to > > > handles in the kernel: it's e

Re: [kvm-devel] [PATCH 5/9] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-16 Thread Davide Libenzi
On Wed, 16 May 2007, Avi Kivity wrote: > IMO doing eventfd_fget() asap is best. I much prefer refcounted pointers to > handles in the kernel: it's easier to see what things point to, and there is > to context needed for dereferencing. There are concerns (from Al and Christoph) about file lifetim

Re: [kvm-devel] [PATCH 5/9] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-15 Thread Davide Libenzi
On Tue, 15 May 2007, Christoph Hellwig wrote: > On Tue, May 15, 2007 at 12:18:17PM -0400, Gregory Haskins wrote: > > >>> On Tue, May 15, 2007 at 11:40 AM, in message > > <[EMAIL PROTECTED]>, Davide Libenzi > > <[EMAIL PROTECTED]> wrote: > > > &g

Re: [kvm-devel] [PATCH 5/9] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-15 Thread Davide Libenzi
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 + > >>

Re: [kvm-devel] [PATCH 05/10] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-14 Thread Davide Libenzi
On Mon, 14 May 2007, Gregory Haskins wrote: > Thanks Davide, > That is very helpful. Is there any reason why we can't export > eventfd_signal() and eventfd_fget() to modules? I'll push a patch for that. - Davide - T

Re: [kvm-devel] [PATCH 05/10] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-14 Thread Davide Libenzi
On Mon, 14 May 2007, Gregory Haskins wrote: > >>> On Mon, May 14, 2007 at 1:23 PM, in message <[EMAIL PROTECTED]>, > Avi Kivity <[EMAIL PROTECTED]> wrote: > > > >> Do you close the signaled fd after receiving the signal/event? If you > >> don't close it, eventfd will always return ready (POLLIN

Re: [kvm-devel] [PATCH 05/10] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-14 Thread Davide Libenzi
On Mon, 14 May 2007, Avi Kivity wrote: > Davide Libenzi wrote: > > On Mon, 14 May 2007, Avi Kivity wrote: > > > > > > > Gregory Haskins wrote: > > > > > > > > Is having a read() (or a write()) actually necessary? > > > >

Re: [kvm-devel] [PATCH 05/10] KVM: Adds ability to signal userspace using a file-descriptor

2007-05-14 Thread Davide Libenzi
On Mon, 14 May 2007, Avi Kivity wrote: > Gregory Haskins wrote: > > > > > > Is having a read() (or a write()) actually necessary? > > > > > > > Based on what I know: yes. It could be a case of ignorance, however ;) > > > > Heres why I think its necessary: You need poll to simply tell you