Please discard this patch, I need to do further research. Thanks, LImeng > -----Original Message----- > From: Li, Meng <Meng.Li@xxxxxxxxxxxxx> > Sent: Monday, November 13, 2023 11:01 AM > To: gregkh@xxxxxxxxxxxxxxxxxxx; mathias.nyman@xxxxxxxxxxxxxxx; > stern@xxxxxxxxxxxxxxxxxxx; Basavaraj.Natikar@xxxxxxx; linux- > usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx > Cc: Li, Meng <Meng.Li@xxxxxxxxxxxxx> > Subject: [PATCH] usb: hcd-pci: replace usb_hcd_irq() with > generic_handle_irq_safe() to avoid calltrace > > When running below to command to remove a PCIe-USB device, there is > below caltrace reported 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 > This issue is introduced by commit c548795abe0d("USB: add check to detect > host controller hardware removal"). Because in RT-kernel, spinlock that may > cause sleep is invoked under irq disabled status. Therefore, replace > usb_hcd_irq() function with > generic_handle_irq_safe() to avoid calltrace > > Fixes: c548795abe0d ("USB: add check to detect host controller hardware > removal") > Cc: stable@xxxxxxxxxxxxxxx > Signed-off-by: Meng Li <Meng.Li@xxxxxxxxxxxxx> > --- > drivers/usb/core/hcd-pci.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index > ee3156f49533..3b5f7dccbe6a 100644 > --- a/drivers/usb/core/hcd-pci.c > +++ b/drivers/usb/core/hcd-pci.c > @@ -325,9 +325,7 @@ void usb_hcd_pci_remove(struct pci_dev *dev) > * 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(); > + generic_handle_irq_safe(dev->irq); > > /* Note: dev_set_drvdata must be called while holding the rwsem */ > if (dev->class == CL_EHCI) { > -- > 2.34.1