Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-23 Thread Gregory Haskins
Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > >> And note that multiple works can run on irqfd >> in parallel. >> >> > > They can? I thought work-queue items were guaranteed to only schedule > once? If what you say is true, its broken, I agree, and Ill need to > revisit. Let

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Michael S. Tsirkin
On Mon, Jun 22, 2009 at 11:41:53AM -0700, Davide Libenzi wrote: > > Absolutely. But IMO documentation in the form of "fields A B C are > > protected by lock X" in a single place near field declaration is better > > than "we take lock X here to protect against race with user thread using > > fields

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Davide Libenzi
On Mon, 22 Jun 2009, Michael S. Tsirkin wrote: > On Mon, Jun 22, 2009 at 11:11:12AM -0700, Davide Libenzi wrote: > > On Mon, 22 Jun 2009, Michael S. Tsirkin wrote: > > > > > Not really, it's impossible to document all races one have thought > > > about and avoided. > > > > Well, when some new co

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Michael S. Tsirkin
On Mon, Jun 22, 2009 at 11:11:12AM -0700, Davide Libenzi wrote: > On Mon, 22 Jun 2009, Michael S. Tsirkin wrote: > > > Not really, it's impossible to document all races one have thought > > about and avoided. > > Well, when some new code has non-trivial locking/racing logics, you better > docume

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Michael S. Tsirkin
On Mon, Jun 22, 2009 at 02:03:59PM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Mon, Jun 22, 2009 at 01:31:29PM -0400, Gregory Haskins wrote: > > > >> Michael S. Tsirkin wrote: > >> > >>> On Mon, Jun 22, 2009 at 12:05:57PM -0400, Gregory Haskins wrote: > >>> > >>>

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Davide Libenzi
On Mon, 22 Jun 2009, Michael S. Tsirkin wrote: > Not really, it's impossible to document all races one have thought > about and avoided. Well, when some new code has non-trivial locking/racing logics, you better document it as clearly as possible, akpm announced time ago. - Davide -- To unsu

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Mon, Jun 22, 2009 at 01:31:29PM -0400, Gregory Haskins wrote: > >> Michael S. Tsirkin wrote: >> >>> On Mon, Jun 22, 2009 at 12:05:57PM -0400, Gregory Haskins wrote: >>> >>> This patch fixes all known races in irqfd, and paves the way to restore

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Michael S. Tsirkin
On Mon, Jun 22, 2009 at 01:31:29PM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Mon, Jun 22, 2009 at 12:05:57PM -0400, Gregory Haskins wrote: > > > >> This patch fixes all known races in irqfd, and paves the way to restore > >> DEASSIGN support. For details of the eventfd ra

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Mon, Jun 22, 2009 at 12:05:57PM -0400, Gregory Haskins wrote: > >> This patch fixes all known races in irqfd, and paves the way to restore >> DEASSIGN support. For details of the eventfd races, please see the patch >> presumably commited immediately prior to this

Re: [KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Michael S. Tsirkin
On Mon, Jun 22, 2009 at 12:05:57PM -0400, Gregory Haskins wrote: > This patch fixes all known races in irqfd, and paves the way to restore > DEASSIGN support. For details of the eventfd races, please see the patch > presumably commited immediately prior to this one. > > In a nutshell, we use even

[KVM PATCH v3 3/3] KVM: Fix races in irqfd using new eventfd_kref_get interface

2009-06-22 Thread Gregory Haskins
This patch fixes all known races in irqfd, and paves the way to restore DEASSIGN support. For details of the eventfd races, please see the patch presumably commited immediately prior to this one. In a nutshell, we use eventfd_kref_get/put() to properly manage the lifetime of the underlying eventf