From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: liudingyuan <liudingyuan@huawei.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"greg@kroah.com" <greg@kroah.com>,
"patchwork-bot@kernel.org" <patchwork-bot@kernel.org>,
"mricon@kernel.org" <mricon@kernel.org>
Cc: "Fangjian (Jay)" <f.fangjian@huawei.com>,
Kangfenglong <kangfenglong@huawei.com>,
yangxingui <yangxingui@huawei.com>,
"fengsheng (A)" <fengsheng5@huawei.com>,
lingmingqiang <lingmingqiang@huawei.com>,
liulongfang <liulongfang@huawei.com>,
zhonghaoquan <zhonghaoquan@hisilicon.com>,
"yanzhili (A)" <yanzhili7@huawei.com>,
"huyihua (A)" <huyihua4@huawei.com>,
"Zengtao (B)" <prime.zeng@hisilicon.com>,
"shenjian (K)" <shenjian15@huawei.com>,
liuyonglong <liuyonglong@huawei.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>
Subject: Re: [PROBLEM] usb: xhci_bus_resume cause irq lost issue
Date: Fri, 7 Mar 2025 18:20:43 +0200 [thread overview]
Message-ID: <d12c09e6-79f6-4490-ae24-a5c8f30c94a8@linux.intel.com> (raw)
In-Reply-To: <520cb5bb27b640e588f898ac60a52c0a@huawei.com>
On 6.3.2025 16.29, liudingyuan wrote:
>
> I compiled a new kernel based on the fix code you provided below and conducted some preliminary tests.> In the repeated unregister/register tests of the xHCI controller that previously caused issues, both the driver and USB-related functionalities are now working normally.
> (Moreover, this fix code, in theory, should completely resolve the issues we encountered in our USB3-USB2 device-only scenario.)
>
> Based on the logic mentioned in analysis, we currently may not have implemented a better solution to avoid disabling interrupts during the USB2 resume process. I would like to ask if we need to
> be concerned about the issue of interrupt loss caused by disabling interrupts in other scenarios where resume and enumeration processes or transfer operations might conflict?
>
> For example, when a user inserts a device during the USB2/USB3 port resume, or when the USB3 controller is only connected to a USB3 devices, and the USB2 port enters this resume flow due to auto-suspend?
> (However, it seems that the probability of these two scenarios is very low, as we have not yet been able to reproduce errors under these conditions.)
>
> This fix indeed helps us avoid the current issue, so I would like to ask if it is possible to push this modification as a patch to the mainline code?
> If possible, we also plan to conduct a comprehensive test of USB functionality based on this modification to further validate it.
>
>
> Considering that the fix cannot completely avoid all possible scenarios where interrupts might be lost due to the hardware IE (Interrupt Enable) being turned off.
> I would like to ask whether the hardware design is reasonable in the following case:
> when a hardware edge-triggered interrupt is lost due to IE being disabled, and the subsequent interrupts cannot be triggered because the software didn't
> clear the EHB (Event Handler Busy) bit.
>
I think we can avoid this situation by disabling the primary interrupter instead of all interrupts.
Meaning we would clear the 'Interrupt enable (IE)' bit:1 in Interrupter Management Register (IMAN)
instead of the 'Interrupter Enable' (INTE) bit:2 in USBCMD register.
This way EHB and IP shouldn't be set at all, and thus not prevent future interrupts.
In practice this just means calling xhci_disable_interrupter() xhci_enable_interrupter()
instead of clearing and setting CMD_EIE bit.
I'll write a patch for this next week
Grateful if you could run the more comprehensive test before I queue it for
upstream (mainline)
Thanks
Mathias
next prev parent reply other threads:[~2025-03-07 16:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 14:29 [PROBLEM] usb: xhci_bus_resume cause irq lost issue liudingyuan
2025-03-07 16:20 ` Mathias Nyman [this message]
2025-03-10 15:11 ` [RFT PATCH] xhci: Limit time spent with interrupts disabled during bus resume Mathias Nyman
[not found] <ea84165273814a41ae7187a008c4144b@huawei.com>
2025-03-05 10:07 ` [PROBLEM] usb: xhci_bus_resume cause irq lost issue liudingyuan
2025-03-05 15:49 ` Mathias Nyman
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=d12c09e6-79f6-4490-ae24-a5c8f30c94a8@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=f.fangjian@huawei.com \
--cc=fengsheng5@huawei.com \
--cc=greg@kroah.com \
--cc=huyihua4@huawei.com \
--cc=jonathan.cameron@huawei.com \
--cc=kangfenglong@huawei.com \
--cc=lingmingqiang@huawei.com \
--cc=linux-usb@vger.kernel.org \
--cc=liudingyuan@huawei.com \
--cc=liulongfang@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=mricon@kernel.org \
--cc=patchwork-bot@kernel.org \
--cc=prime.zeng@hisilicon.com \
--cc=shenjian15@huawei.com \
--cc=yangxingui@huawei.com \
--cc=yanzhili7@huawei.com \
--cc=zhonghaoquan@hisilicon.com \
/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