This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH]vtd: Fix for irq bind failure after PCI attaching

To: "Zhang, Fengzhe" <fengzhe.zhang@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH]vtd: Fix for irq bind failure after PCI attaching 32 times
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Wed, 26 Jan 2011 11:10:48 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 26 Jan 2011 03:10:13 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1A42CE6F5F474C41B63392A5F80372B231F6DFF6@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1A42CE6F5F474C41B63392A5F80372B231F6DFF6@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Wed, 26 Jan 2011, Zhang, Fengzhe wrote:
> vtd: Fix for irq bind failure after PCI attaching 32 times
> Originally when detaching a PCI device, pirq_to_emuirq and pirq_to_irq are 
> freed via hypercall do_physdev_op. Now in function pt_irq_destroy_bind_vtd, 
> duplicated logic is added to free pirq_to_emuirq, but not pirq_to_irq. This 
> causes do_physdev_op fail to free both emuirq and irq. After attaching a PCI 
> device for 32 times, irq resources run out. This patch removes the redundant 
> logic.
> Signed-off-by: Fengzhe Zhang <fengzhe.zhang@xxxxxxxxx>

It looks OK in principle, but if the theory is that we should always
call xc_physdev_unmap_pirq after xc_domain_unbind_pt_irq, I can find an
instance of xc_domain_unbind_pt_irq without any corresponding

Take a look at hw/pass-through.c:pt_reset_interrupt_and_io_mapping in

if (ptdev->msi_trans_en == 0 && ptdev->machine_irq)
    if (xc_domain_unbind_pt_irq(xc_handle, domid, ptdev->machine_irq,
                    PT_IRQ_TYPE_PCI, 0, e_device, e_intx, 0))
        PT_LOG("Error: Unbinding of interrupt failed!\n");

but there is no following xc_physdev_unmap_pirq if MSI and MSIX are

Xen-devel mailing list