From: "Peter Chen (CIX)" <peter.chen@kernel.org>
To: Ralph Siemsen <ralph.siemsen@linaro.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Pawel Laszczak <pawell@cadence.com>,
Roger Quadros <rogerq@kernel.org>,
Aswath Govindraju <a-govindraju@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
stable@vger.kernel.org
Subject: Re: [PATCH v2] usb: cdns3: Fix deadlock when using NCM gadget
Date: Wed, 19 Mar 2025 09:27:47 +0800 [thread overview]
Message-ID: <Z9odk4aHd76nXxZ-@nchen-desktop> (raw)
In-Reply-To: <20250318-rfs-cdns3-deadlock-v2-1-bfd9cfcee732@linaro.org>
On 25-03-18 11:09:32, Ralph Siemsen wrote:
> The cdns3 driver has the same NCM deadlock as fixed in cdnsp by commit
> 58f2fcb3a845 ("usb: cdnsp: Fix deadlock issue during using NCM gadget").
>
> Under PREEMPT_RT the deadlock can be readily triggered by heavy network
> traffic, for example using "iperf --bidir" over NCM ethernet link.
>
> The deadlock occurs because the threaded interrupt handler gets
> preempted by a softirq, but both are protected by the same spinlock.
> Prevent deadlock by disabling softirq during threaded irq handler.
>
> cc: stable@vger.kernel.org
> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Acked-by: Peter Chen <peter.chen@kernel.org>
> ---
> v2 changes:
> - move the fix up the call stack, as per discussion at
> https://lore.kernel.org/linux-rt-devel/20250226082931.-XRIDa6D@linutronix.de/
> ---
> drivers/usb/cdns3/cdns3-gadget.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index fd1beb10bba72..19101ff1cf1bd 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -1963,6 +1963,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)
> unsigned int bit;
> unsigned long reg;
>
> + local_bh_disable();
> spin_lock_irqsave(&priv_dev->lock, flags);
>
> reg = readl(&priv_dev->regs->usb_ists);
> @@ -2004,6 +2005,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)
> irqend:
> writel(~0, &priv_dev->regs->ep_ien);
> spin_unlock_irqrestore(&priv_dev->lock, flags);
> + local_bh_enable();
>
> return ret;
> }
>
> ---
> base-commit: 4701f33a10702d5fc577c32434eb62adde0a1ae1
> change-id: 20250312-rfs-cdns3-deadlock-697df5cad3ce
>
> Best regards,
> --
> Ralph Siemsen <ralph.siemsen@linaro.org>
>
--
Best regards,
Peter
next prev parent reply other threads:[~2025-03-19 1:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 15:09 [PATCH v2] usb: cdns3: Fix deadlock when using NCM gadget Ralph Siemsen
2025-03-19 1:27 ` Peter Chen (CIX) [this message]
2025-03-19 5:56 ` Sebastian Andrzej Siewior
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=Z9odk4aHd76nXxZ-@nchen-desktop \
--to=peter.chen@kernel.org \
--cc=a-govindraju@ti.com \
--cc=bigeasy@linutronix.de \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=linux-usb@vger.kernel.org \
--cc=pawell@cadence.com \
--cc=ralph.siemsen@linaro.org \
--cc=rogerq@kernel.org \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/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