Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-19 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Thu, Jun 18, 2009 at 12:29:31PM -0400, Gregory Haskins wrote: > >> Michael S. Tsirkin wrote: >> >>> On Thu, Jun 18, 2009 at 10:03:36AM -0400, Gregory Haskins wrote: >>> >>> Michael S. Tsirkin wrote: > On Thu, Jun 18,

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-19 Thread Michael S. Tsirkin
On Thu, Jun 18, 2009 at 12:29:31PM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Thu, Jun 18, 2009 at 10:03:36AM -0400, Gregory Haskins wrote: > > > >> Michael S. Tsirkin wrote: > >> > >>> On Thu, Jun 18, 2009 at 08:00:39AM -0400, Gregory Haskins wrote: > >>> > >>>

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-18 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Thu, Jun 18, 2009 at 10:03:36AM -0400, Gregory Haskins wrote: > >> Michael S. Tsirkin wrote: >> >>> On Thu, Jun 18, 2009 at 08:00:39AM -0400, Gregory Haskins wrote: >>> >>> Michael S. Tsirkin wrote: > BTW, Gregor

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-18 Thread Michael S. Tsirkin
On Thu, Jun 18, 2009 at 10:03:36AM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Thu, Jun 18, 2009 at 08:00:39AM -0400, Gregory Haskins wrote: > > > >> Michael S. Tsirkin wrote: > >> > >> > >>> BTW, Gregory, this can be used to fix the race in the design: create a > >>> t

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-18 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Thu, Jun 18, 2009 at 08:00:39AM -0400, Gregory Haskins wrote: > >> Michael S. Tsirkin wrote: >> >> >>> BTW, Gregory, this can be used to fix the race in the design: create a >>> thread and let it drop the module reference with module_put_and_exit. >>> >>>

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-18 Thread Michael S. Tsirkin
On Thu, Jun 18, 2009 at 08:00:39AM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Thu, Jun 18, 2009 at 02:46:30PM +0930, Rusty Russell wrote: > > > >> On Mon, 15 Jun 2009 10:24:39 pm Michael S. Tsirkin wrote: > >> > >>> On Mon, Jun 15, 2009 at 08:08:18AM -0400, Gregory Has

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-18 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Thu, Jun 18, 2009 at 02:46:30PM +0930, Rusty Russell wrote: > >> On Mon, 15 Jun 2009 10:24:39 pm Michael S. Tsirkin wrote: >> >>> On Mon, Jun 15, 2009 at 08:08:18AM -0400, Gregory Haskins wrote: >>> Hmm. I understand what you are saying conceptual

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-17 Thread Michael S. Tsirkin
On Thu, Jun 18, 2009 at 02:46:30PM +0930, Rusty Russell wrote: > On Mon, 15 Jun 2009 10:24:39 pm Michael S. Tsirkin wrote: > > On Mon, Jun 15, 2009 at 08:08:18AM -0400, Gregory Haskins wrote: > > > Hmm. I understand what you are saying conceptually (i.e. the .text > > > could get yanked before we

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-17 Thread Rusty Russell
On Mon, 15 Jun 2009 10:24:39 pm Michael S. Tsirkin wrote: > On Mon, Jun 15, 2009 at 08:08:18AM -0400, Gregory Haskins wrote: > > Hmm. I understand what you are saying conceptually (i.e. the .text > > could get yanked before we hit the next line of code, in this case the > > "return 0"). However,

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-15 Thread Michael S. Tsirkin
On Mon, Jun 15, 2009 at 08:08:18AM -0400, Gregory Haskins wrote: > >> @@ -123,6 +124,7 @@ irqfd_wakeup(wait_queue_t *wait, unsigned mode, int > >> sync, void > >> *key) > >> > >> cleanup_srcu_struct(&irqfd->srcu); > >> kfree(irqfd); > >> + module_put

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-15 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Sun, Jun 14, 2009 at 11:39:21PM -0400, Gregory Haskins wrote: > >> Michael S. Tsirkin wrote: >> >>> On Sun, Jun 14, 2009 at 08:53:11AM -0400, Gregory Haskins wrote: >>> >>> Michael S. Tsirkin wrote: > On Thu, Jun 04,

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-15 Thread Michael S. Tsirkin
On Sun, Jun 14, 2009 at 11:39:21PM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Sun, Jun 14, 2009 at 08:53:11AM -0400, Gregory Haskins wrote: > > > >> Michael S. Tsirkin wrote: > >> > >>> On Thu, Jun 04, 2009 at 08:48:12AM -0400, Gregory Haskins wrote: > >>> > >>>

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-14 Thread Gregory Haskins
[ restoring poor Davide's proper email address. Sorry for the constant fat-fingering of your addr, Davide! ] Michael S. Tsirkin wrote: > On Sun, Jun 14, 2009 at 08:53:11AM -0400, Gregory Haskins wrote: > >> Michael S. Tsirkin wrote: >> >>> On Thu, Jun 04, 2009 at 08:48:12AM -0400, Gregory

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-14 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Sun, Jun 14, 2009 at 08:53:11AM -0400, Gregory Haskins wrote: > >> Michael S. Tsirkin wrote: >> >>> On Thu, Jun 04, 2009 at 08:48:12AM -0400, Gregory Haskins wrote: >>> >>> +static void +irqfd_disconnect(struct _irqfd *irqfd) +{ +

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-14 Thread Michael S. Tsirkin
On Sun, Jun 14, 2009 at 08:53:11AM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Thu, Jun 04, 2009 at 08:48:12AM -0400, Gregory Haskins wrote: > > > >> +static void > >> +irqfd_disconnect(struct _irqfd *irqfd) > >> +{ > >> + struct kvm *kvm; > >> + > >> + mutex_lock(&irqfd->

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-14 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Thu, Jun 04, 2009 at 08:48:12AM -0400, Gregory Haskins wrote: > >> +static void >> +irqfd_disconnect(struct _irqfd *irqfd) >> +{ >> +struct kvm *kvm; >> + >> +mutex_lock(&irqfd->lock); >> + >> +kvm = rcu_dereference(irqfd->kvm); >> +rcu_assign_point

Re: [KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-14 Thread Michael S. Tsirkin
On Thu, Jun 04, 2009 at 08:48:12AM -0400, Gregory Haskins wrote: > +static void > +irqfd_disconnect(struct _irqfd *irqfd) > +{ > + struct kvm *kvm; > + > + mutex_lock(&irqfd->lock); > + > + kvm = rcu_dereference(irqfd->kvm); > + rcu_assign_pointer(irqfd->kvm, NULL); > + > + mute

[KVM PATCH v2 2/2] kvm: use POLLHUP to close an irqfd instead of an explicit ioctl

2009-06-04 Thread Gregory Haskins
Assigning an irqfd object to a kvm object creates a relationship that we currently manage by having the kvm oject acquire/hold a file* reference to the underlying eventfd. The lifetime of these objects is properly maintained by decoupling the two objects whenever the irqfd is closed or kvm is clos