On Wed, 1 Dec 2010, Sarah Sharp wrote: > Hi Alan, > > Matthew Garret points out that the current xHCI code doesn't work so > well when the host is suspended and then the card is removed. The > xhci_suspend() method frees the MSI-X interrupts because the USB core > calls synchronize_irq() with the legacy interrupt in suspend_common() in > hcd-pci.c. The hotplug layer will attempt to deallocate the interrupts > the card had before suspend, which results in a double free. > > Is there a reason the USB PCI code calls synchronize_irq()? See commit 8de98402652c01839ae321be (USB: Fix USB suspend/resume crasher (#2)) by Ben Herrenschmidt -- 5 years ago! He's the best person to ask. My best guess is that this was done to avoid a race in which an IRQ is received before the suspend starts but is not delivered until after the controller is put into D3, at which point the ISR would get a bus exception when trying to read the controller's status register. Let me turn your question around: Is there a reason xhci_suspend() frees the MSI-X interrupts instead of just synchronizing them? Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html