From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amit Shah Subject: Re: PCI-passthrough: interrupt work structure per device Date: Fri, 30 May 2008 07:45:35 +0530 Message-ID: <200805300745.36336.amit.shah@qumranet.com> References: <1212084577.21998.28.camel@muff> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: "Ben-Ami Yassour" , "Kay, Allen M" , "Muli Ben-Yehuda" , kvm@vger.kernel.org To: "Mark McLoughlin" Return-path: Received: from mis011.exch011.intermedia.net ([64.78.21.10]:31895 "EHLO mis011.exch011.intermedia.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751324AbYE3CNE (ORCPT ); Thu, 29 May 2008 22:13:04 -0400 In-Reply-To: <1212084577.21998.28.camel@muff> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Thursday 29 May 2008 23:39:37 Mark McLoughlin wrote: > > @@ -184,16 +190,27 @@ out: > > static irqreturn_t kvm_pci_pt_dev_intr(int irq, void *dev_id) > > { > > struct kvm *kvm = (struct kvm *) dev_id; > > + struct kvm_pci_pt_dev_list *pci_pt_dev; > > > > if (!test_bit(irq, pt_irq_handled)) > > return IRQ_NONE; > > > > - kvm->arch.pci_pt_int_work.irq = irq; > > - kvm->arch.pci_pt_int_work.kvm = kvm; > > - kvm->arch.pci_pt_int_work.source = 0; > > + read_lock(&kvm_pci_pt_lock); > > + pci_pt_dev = kvm_find_pci_pt_dev(&kvm->arch.pci_pt_dev_head, NULL, > > + irq, KVM_PT_SOURCE_IRQ); > > + if (!pci_pt_dev) { > > + read_unlock(&kvm_pci_pt_lock); > > + return IRQ_NONE; > > + } > > + > > + pci_pt_dev->pt_dev.int_work.irq = irq; > > + pci_pt_dev->pt_dev.int_work.kvm = kvm; > > + pci_pt_dev->pt_dev.int_work.source = 0; > > > > kvm_get_kvm(kvm); > > Won't we leak this reference if we get another interrupt before the > workqueue is scheduled? Currently, we disable the interrupt line till the ack is done. We don't support shared interrupts yet, so this will work till we have the shared interrupt support ready. Amit.