mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Meng Li <Meng.Li@windriver.com>
To: gregkh@linuxfoundation.org, mathias.nyman@linux.intel.com,
	stern@rowland.harvard.edu, Basavaraj.Natikar@amd.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: meng.li@windriver.com
Subject: [PATCH] usb: hcd-pci: replace usb_hcd_irq() with generic_handle_irq_safe() to avoid calltrace
Date: Mon, 13 Nov 2023 11:00:41 +0800	[thread overview]
Message-ID: <20231113030041.3655742-1-Meng.Li@windriver.com> (raw)

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@vger.kernel.org
Signed-off-by: Meng Li <Meng.Li@windriver.com>
---
 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


             reply	other threads:[~2023-11-13  3:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13  3:00 Meng Li [this message]
2023-11-13 13:30 ` Li, Meng
2023-11-14 19:55 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231113030041.3655742-1-Meng.Li@windriver.com \
    --to=meng.li@windriver.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®