linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linyu Yuan <quic_linyyuan@quicinc.com>
To: JaeHun Jung <jh0801.jung@samsung.com>,
	Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: "open list:USB XHCI DRIVER" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Seungchull Suh <sc.suh@samsung.com>,
	Daehwan Jung <dh10.jung@samsung.com>
Subject: Re: [PATCH] usb: dwc3: Clear DWC3_EVENT_PENDING when count is 0
Date: Thu, 5 Jan 2023 11:35:17 +0800	[thread overview]
Message-ID: <c4e01a0a-1c98-3103-2b91-2fe0ba8c3118@quicinc.com> (raw)
In-Reply-To: <af32e2f5-de45-38af-2b4f-47c1ac21ea9e@quicinc.com>


On 1/5/2023 11:29 AM, Linyu Yuan wrote:
> On 1/2/2023 1:08 PM, JaeHun Jung wrote:
>> Sometimes very rarely, The count is 0 and the DWC3 flag is set has 
>> status.
>> It must not have these status. Because, It can make happen interrupt 
>> storming
>> status.
>
> could you help explain without clear the flag, how interrupt storming 
> happen ?
>
> as your change didn't touch any hardware register, i don't know how it 
> fix storming.
>
> storming from software layer ?
>
>> So, It have to clean up DWC3_EVENT_PENDING flags set when count is 0.
>> It means "There are no interrupts to handle.".
>>
>> (struct dwc3_event_buffer *) ev_buf = 0xFFFFFF883DBF1180 (
>>     (void *) buf = 0xFFFFFFC00DBDD000 = end+0x337D000,
>>     (void *) cache = 0xFFFFFF8839F54080,
>>     (unsigned int) length = 0x1000,
>>     (unsigned int) lpos = 0x0,
>>     (unsigned int) count = 0x0,
>>     (unsigned int) flags = 0x00000001,
>>     (dma_addr_t) dma = 0x00000008BD7D7000,
>>     (struct dwc3 *) dwc = 0xFFFFFF8839CBC880,
>>     (u64) android_kabi_reserved1 = 0x0),
>>
>> (time = 47557628930999, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628931268, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628932383, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628932652, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628933768, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628934037, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628935152, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628935460, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628936575, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628936845, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628937960, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628938229, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628939345, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628939652, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628940768, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628941037, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628942152, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628942422, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628943537, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628943806, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628944922, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628945229, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628946345, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628946614, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>> (time = 47557628947729, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 1),
>> (time = 47557628947999, irq = 165, fn = dwc3_interrupt, latency = 0, 
>> en = 3),
>>
>> Signed-off-by: JaeHun Jung <jh0801.jung@samsung.com>
>> ---
>>   drivers/usb/dwc3/gadget.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
>> index 789976567f9f..5d2d5a9b9915 100644
>> --- a/drivers/usb/dwc3/gadget.c
>> +++ b/drivers/usb/dwc3/gadget.c
>> @@ -4355,8 +4355,11 @@ static irqreturn_t dwc3_check_event_buf(struct 
>> dwc3_event_buffer *evt)
>>        * irq event handler completes before caching new event to prevent
>>        * losing events.
>>        */
>> -    if (evt->flags & DWC3_EVENT_PENDING)
>> +    if (evt->flags & DWC3_EVENT_PENDING) {
>> +        if (!evt->count)
>> +            evt->flags &= ~DWC3_EVENT_PENDING;
>>           return IRQ_HANDLED;
>> +    }
>>         count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
>>       count &= DWC3_GEVNTCOUNT_MASK;
>
> how about below change ?
>
>         count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
>         count &= DWC3_GEVNTCOUNT_MASK;
> -       if (!count)
> +       if (!count) {
> +               evt->flags &= ~DWC3_EVENT_PENDING;
>                 return IRQ_NONE;
> +       }
ignore my suggestion, add Thinh to comment.
>
>         evt->count = count;
>         evt->flags |= DWC3_EVENT_PENDING;
>

  reply	other threads:[~2023-01-05  3:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230102050839epcas2p4b9d09d926f9a14c3b8e8df2574d334c3@epcas2p4.samsung.com>
2023-01-02  5:08 ` [PATCH] usb: dwc3: Clear DWC3_EVENT_PENDING when count is 0 JaeHun Jung
2023-01-03 15:48   ` Felipe Balbi
2023-01-05  3:29   ` Linyu Yuan
2023-01-05  3:35     ` Linyu Yuan [this message]
2023-01-05  9:54       ` 정재훈
2023-01-06  3:13         ` Linyu Yuan
2023-01-09 18:28           ` Thinh Nguyen
2023-01-10  1:56             ` Linyu Yuan
2023-01-10  2:53               ` Thinh Nguyen
2023-01-10  3:05                 ` Linyu Yuan
2023-01-10  3:13                   ` Linyu Yuan
2023-01-10  7:38                     ` Linyu Yuan
2023-01-11  0:00                       ` Thinh Nguyen
2023-01-11  1:45                         ` Linyu Yuan
2023-01-11  2:27                           ` Thinh Nguyen
2023-01-31  6:38                             ` Linyu Yuan
2023-02-01 18:57                               ` Thinh Nguyen
2023-02-02  5:00                                 ` Linyu Yuan
2023-02-02 20:06                                   ` Thinh Nguyen
2023-02-03  2:18                                     ` Linyu Yuan
2023-01-09 18:35   ` Thinh Nguyen
2023-01-09 19:09     ` Thinh Nguyen

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=c4e01a0a-1c98-3103-2b91-2fe0ba8c3118@quicinc.com \
    --to=quic_linyyuan@quicinc.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=dh10.jung@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jh0801.jung@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sc.suh@samsung.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;
as well as URLs for NNTP newsgroup(s).