With below command steps, PCIe-USB drvier also hangs even if
commit c548795abe0d("USB: add check to detect host controller
hardware removal") exists in latest kernel.
- hot-unplug the PCIe-USB card
- echo 1 > /sys/bus/pci/devices/<PCIe ID>/remove
The code hangs in function xhci_urb_dequeue() because it is not able
to get the spin lock xhci->lock. The root cause is that when PCIe-USB card
is hot-plugged, there is an exception("Internal error: synchronous external
abort") occurred in function xhci_urb_enqueue() that acquire the xhci->lock
during sending data. After exception is processed, the usb-storage kthread
is killed, and the code is not able to return to function xhci_urb_enqueue()
again, so the xhci->lock is not released and cause the device removing action
hangs in xhci_urb_dequeue().
Even if moving code of commit c548795abe0d to function xhci_pci_remove(),
it also doesn't resolve the deadlock issue, because in fact, there is an 
exception
("Internal error: synchronous external abort") occurred without PCIe card. The
code doesn't return back again.
Because the above steps are not correct operation for PCIe device, it should not
hot-unplug the PCIe-USB card directly before removing device from drvier level.
Moreover, it has better offer dedicated power to support PCIe hot-plug so that
avoid destroying PCIe hardware.
Based on above analysis, I think the action of faking interrupt request should 
be
removed, it does not need to resolve a unreasonable use case. Moreover, remove
the code of faking interrupt request also can avoid below calltrace in RT 
kernel.
Call trace:
 ......
 __might_resched+0x160/0x1c0
 rt_spin_lock+0x38/0xb0
 xhci_irq+0x44/0x16d0
 usb_hcd_irq+0x38/0x5c
 usb_hcd_pci_remove+0x84/0x14c
 xhci_pci_remove+0x78/0xc0
 pci_device_remove+0x44/0xcc
 device_remove+0x54/0x8c
 device_release_driver_internal+0x1ec/0x260
 device_release_driver+0x20/0x30
 pci_stop_bus_device+0x8c/0xcc
 pci_stop_and_remove_bus_device_locked+0x28/0x44
 ......
 el0t_64_sync_handler+0xf4/0x120
 el0t_64_sync+0x18c/0x190

Fixes: c548795abe0d ("USB: add check to detect host controller hardware 
removal")
Cc: sta...@vger.kernel.org
Signed-off-by: Meng Li <meng...@windriver.com>
---
 drivers/usb/core/hcd-pci.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 9b77f49b3560..3202583b0a40 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -322,14 +322,6 @@ void usb_hcd_pci_remove(struct pci_dev *dev)
        if (pci_dev_run_wake(dev))
                pm_runtime_get_noresume(&dev->dev);
 
-       /* Fake an interrupt request in order to give the driver a chance
-        * to test whether the controller hardware has been removed (e.g.,
-        * cardbus physical eject).
-        */
-       local_irq_disable();
-       usb_hcd_irq(0, hcd);
-       local_irq_enable();
-
        /* Note: dev_set_drvdata must be called while holding the rwsem */
        if (dev->class == CL_EHCI) {
                down_write(&companions_rwsem);
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13200): 
https://lists.yoctoproject.org/g/linux-yocto/message/13200
Mute This Topic: https://lists.yoctoproject.org/mt/102034460/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to