From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"felipe.balbi@linux.intel.com" <felipe.balbi@linux.intel.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jameswei@google.com" <jameswei@google.com>,
"stable@kernel.org" <stable@kernel.org>
Subject: Re: [PATCH v1] usb: dwc3: gadget: Prevent irq storm when TH re-executes
Date: Tue, 28 Jan 2025 02:44:17 +0000 [thread overview]
Message-ID: <20250128024416.7i3i2vmw2ioy5huf@synopsys.com> (raw)
In-Reply-To: <20250124075911.811594-1-badhri@google.com>
On Fri, Jan 24, 2025, Badhri Jagan Sridharan wrote:
> While commit d325a1de49d6 ("usb: dwc3: gadget: Prevent losing events
> in event cache") makes sure that top half(TH) does not end up overwriting
> the cached events before processing them when the TH gets invoked more
> than one time, returning IRQ_HANDLED results in occasional irq storm
> where the TH hogs the CPU. The irq storm can be prevented if
> IRQ_WAKE_THREAD is returned.
>
> ftrace event stub during dwc3 irq storm:
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000866: irq_handler_exit: irq=14 ret=handled
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000872: irq_handler_entry: irq=504 name=dwc3
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000874: irq_handler_exit: irq=504 ret=handled
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000881: irq_handler_entry: irq=504 name=dwc3
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000883: irq_handler_exit: irq=504 ret=handled
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000889: irq_handler_entry: irq=504 name=dwc3
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000892: irq_handler_exit: irq=504 ret=handled
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000898: irq_handler_entry: irq=504 name=dwc3
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000901: irq_handler_exit: irq=504 ret=handled
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000907: irq_handler_entry: irq=504 name=dwc3
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000909: irq_handler_exit: irq=504 ret=handled
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000915: irq_handler_entry: irq=504 name=dwc3
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000918: irq_handler_exit: irq=504 ret=handled
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000924: irq_handler_entry: irq=504 name=dwc3
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000927: irq_handler_exit: irq=504 ret=handled
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000933: irq_handler_entry: irq=504 name=dwc3
> irq/504_dwc3-1111 ( 1111) [000] .... 70.000935: irq_handler_exit: irq=504 ret=handled
> ....
>
> Cc: stable@kernel.org
> Fixes: d325a1de49d6 ("usb: dwc3: gadget: Prevent losing events in event cache")
I don't think this should be Cc to stable, at least not the way it is
right now.
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> ---
> drivers/usb/dwc3/gadget.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index d27af65eb08a..376ab75adc4e 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -4519,7 +4519,7 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt)
> * losing events.
> */
> if (evt->flags & DWC3_EVENT_PENDING)
> - return IRQ_HANDLED;
> + return IRQ_WAKE_THREAD;
This looks like a workaround to the issue we have. Have you tried to
enable imod instead? It's the feature to help avoid these kind of issue.
Thanks,
Thinh
>
> count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
> count &= DWC3_GEVNTCOUNT_MASK;
>
> base-commit: 70cd0576aa39c55aabd227851cba0c601e811fb6
> --
> 2.48.1.262.g85cc9f2d1e-goog
>
next prev parent reply other threads:[~2025-01-28 2:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 7:59 Badhri Jagan Sridharan
2025-01-28 2:44 ` Thinh Nguyen [this message]
2025-01-29 8:30 ` Badhri Jagan Sridharan
2025-01-30 1:42 ` Thinh Nguyen
2025-01-31 10:39 ` Badhri Jagan Sridharan
2025-02-01 0:09 ` Thinh Nguyen
2025-02-02 3:59 ` Badhri Jagan Sridharan
2025-02-04 0:22 ` Thinh Nguyen
2025-02-05 8:32 ` Badhri Jagan Sridharan
2025-02-10 20:45 ` Badhri Jagan Sridharan
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=20250128024416.7i3i2vmw2ioy5huf@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=badhri@google.com \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jameswei@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@kernel.org \
/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
Powered by JetHome