WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [RFC PATCH linux-2.6.18-xen] pciback: clean up (MSI-X ve

To: "Laszlo Ersek" <lersek@xxxxxxxxxx>
Subject: Re: [Xen-devel] [RFC PATCH linux-2.6.18-xen] pciback: clean up (MSI-X vec, entrynr) list when resetting PCI device
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Wed, 01 Jun 2011 13:56:41 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 01 Jun 2011 06:00:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4DE60EF8.5060902@xxxxxxxxxx>
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: <4DE60EF8.5060902@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> On 01.06.11 at 12:05, Laszlo Ersek <lersek@xxxxxxxxxx> wrote:
> Hi,
> 
> this is more of an RFC than a patch now for linux-2.6.18-xen. Describing the 
> situation captured in RHBZ#688673, in a nutshell:
> 
> - let's say we have an Intel 82576 card (igb),
> - the card exports virtual functions (igbvf),
> - one virtual function is passed through to a PV guest,
> - the igbvf driver, co-operating with pcifront, pciback, and the hypervisor, 
> sets up three MSI-X vectors for the virtual function PCI device,
> - when the domU is shut down, the MSI-X vectors are "leaked" in dom0, because 
> nobody ever reaches dom0's pci_disable_msix() / msi_remove_pci_irq_vectors() 
> during shutdown,
> - therefore configuration of the VF during the next boot of such a guest 
> doesn't succeed (dom0 thinks, based on its stale list, that MSI-X vectors are 
> already allocated/mapped for the device)
> 
>   dom0 (msix_capability_init(), output beautified a bit):
>     msix entry 0 for dev 01:10:0 are not freed before acquire again.
>     msix entry 1 for dev 01:10:0 are not freed before acquire again.
>     msix entry 2 for dev 01:10:0 are not freed before acquire again.
> 
>   guest:
>       Determining IP information for eth1...
>       Failed to obtain physical IRQ 255
>       Failed to obtain physical IRQ 254
>       Failed to obtain physical IRQ 253
> 
> - if the device or the full igbvf module is removed before shutdown in the 
> guest (in case the boot was successful to begin with!), then 
> pci_disable_msix() is called and everything works fine; the next boot / ifup 
> succeeds.
> 
> I backported c/s 1070 to the RHEL-5 kernel, but it was not enough -- this is 
> not an abrupt termination (destroy), but a contolled shutdown. Here's what I 
> suspect happens (in RHEL-5) when device_shutdown() walks the list of devices 
> in the PV domU and calls the appropriate shutdown hook for igbvf:
> 
> domU: igbvf_shutdown()
>         igbvf_suspend()
>           pci_disable_device()
>             pcibios_disable_device()
>               pcibios_disable_resources()
>                 pci_write_config_word(
>                     dev, PCI_COMMAND,
>                     orig & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)
>                 )
>                   ...
>                     pcifront_bus_write()
>                       do_pci_op(XEN_PCI_OP_conf_write)
> dom0:                   pciback_do_op()
>                           pciback_config_write()
>                             conf_space_write()
>                               command_write() [via PCI_COMMAND funcptr]
>                                 pci_disable_device()
>                                   disable_msi_mode()
>                                     dev->msix_enabled = 0;
> 
> The final assignment above precludes c/s 1070 from doing the job.

That seems to be a problem in the PCI subsystem, in that
disable_msi_mode() is being used from pci_disable_device() (instead
of pci_disable_msi{,x}()), and does not seem to be done in a similarly
bad way in newer kernels. So I wonder whether you shouldn't fix
pci_disable_device() instead, or alternatively move the vector
de-allocation (and then for MSI and MSI-X) into disable_msi_mode().

While the approach you take covers the guest shutdown/restart
case, what if the guest called its pci_disable_device() at runtime,
expecting to be able to call pci_enable_{device,msi,msix}() on it
again later on? Your newly added function would also be called here,
but in this situation you would have to call into the hypervisor (as
the domain is still alive), i.e. you could as well call
msi_remove_pci_irq_vectors().

Additionally, while covering the MSI-X case, I don't see how the
similar already-mapped case would be cleanly handled for MSI.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>