Linux USB
 help / color / mirror / Atom feed
From: Selvarasu Ganesan <selvarasu.g@samsung.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jh0801.jung@samsung.com" <jh0801.jung@samsung.com>,
	"dh10.jung@samsung.com" <dh10.jung@samsung.com>,
	"naushad@samsung.com" <naushad@samsung.com>,
	"akash.m5@samsung.com" <akash.m5@samsung.com>,
	"rc93.raju@samsung.com" <rc93.raju@samsung.com>,
	"taehyun.cho@samsung.com" <taehyun.cho@samsung.com>,
	"hongpooh.kim@samsung.com" <hongpooh.kim@samsung.com>,
	"eomji.oh@samsung.com" <eomji.oh@samsung.com>,
	"shijie.cai@samsung.com" <shijie.cai@samsung.com>
Subject: Re: [PATCH] usb: dwc3: Potential fix of possible dwc3 interrupt storm
Date: Wed, 4 Sep 2024 21:20:27 +0530	[thread overview]
Message-ID: <11535d95-c972-4dbe-afb5-de3a44bc4a21@samsung.com> (raw)
In-Reply-To: <20240904010322.leqt3pap6lguivg4@synopsys.com>


On 9/4/2024 6:33 AM, Thinh Nguyen wrote:
> On Mon, Sep 02, 2024, Selvarasu Ganesan wrote:
>> I would like to reconfirm from our end that in our failure scenario, we
>> observe that DWC3_EVENT_PENDING is set in evt->flags when the dwc3
>> resume sequence is executed, and the dwc->pending_events flag is not
>> being set.
>>
> If the controller is stopped, no event is generated until it's restarted
> again. (ie, you should not see GEVNTCOUNT updated after clearing
> DCTL.run_stop). If there's no event, no interrupt assertion should come
> from the controller.
>
> If the pending_events is not set and you still see this failure, then
> likely that the controller had started, and the interrupt is generated
> from the controller event. This occurs along with the interrupt
> generated from your connection notification from your setup.


I completely agree. My discussion revolves around the handling of the 
DWC3_EVENT_PENDING flag in all situations. The purpose of using this 
flag is to prevent the processing of new events if an existing event is 
still being processed. This flag is set in the top-half interrupt 
handler and cleared at the end of the bottom-half handler.

Now, let's consider scenarios where the bottom half is not scheduled, 
and a USB reconnect occurs. In this case, there is a possibility that 
the interrupt line is unmasked in dwc3_event_buffers_setup, and the USB 
controller begins posting new events. The top-half interrupt handler 
checks for the DWC3_EVENT_PENDING flag and returns IRQ_HANDLED without 
processing any new events. However, the USB controller continues to post 
interrupts until they are acknowledged.

Please review the complete sequence once with DWC3_EVENT_PENDING flag.

My proposal is to clear or reset the DWC3_EVENT_PENDING flag when 
unmasking the interrupt line dwc3_event_buffers_setup, apart from 
bottom-half handler. Clearing the DWC3_EVENT_PENDING flag in 
dwc3_event_buffers_setup does not cause any harm, as we have implemented 
a temporary workaround in our test setup to prevent IRQ storms.



Working scenarios:
==================
1. Top-half handler:
     a. if (evt->flags & DWC3_EVENT_PENDING)
         return IRQ_HANDLED;
     b. Set DWC3_EVENT_PENDING flag
     c. Masking interrupt line

2. Bottom-half handler:
     a. Un-masking interrupt line
     b. Clear DWC3_EVENT_PENDING flag

Failure scenarios:
==================
1. Top-half handler:
     a. if (evt->flags & DWC3_EVENT_PENDING)
                 return IRQ_HANDLED;
     b. Set DWC3_EVENT_PENDING flag
     c. Masking interrupt line

2. No Bottom-half scheduled:

3. USB reconnect: dwc3_event_buffers_setup
     a. Un-masking interrupt line

4. Continuous interrupts : Top-half handler:
     a. if (evt->flags & DWC3_EVENT_PENDING)
                 return IRQ_HANDLED;

     a. if (evt->flags & DWC3_EVENT_PENDING)
                 return IRQ_HANDLED;

     a. if (evt->flags & DWC3_EVENT_PENDING)
                 return IRQ_HANDLED;
.....

.....

.....

Thanks,
Selva

>
> Check your platform and internal team, what condition would cause the
> setup to generate the interrupt and what condition would stop this
> custom connection interrupt assertion? This is outside of what's defined
> by the flow of the controller.
>
> BR,
> Thinh

  reply	other threads:[~2024-09-04 15:50 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240719110149epcas5p3dd468685a095c094ed2e540279bf3ec2@epcas5p3.samsung.com>
2024-07-19 11:00 ` [PATCH] usb: dwc3: Potential fix of possible dwc3 interrupt storm Selvarasu Ganesan
2024-08-07  0:38   ` Thinh Nguyen
2024-08-07  6:20     ` Selvarasu Ganesan
2024-08-08  1:15       ` Thinh Nguyen
2024-08-08  6:23         ` Selvarasu Ganesan
2024-08-09 23:42           ` Thinh Nguyen
2024-08-09 23:45             ` Thinh Nguyen
2024-08-10 15:14               ` Selvarasu Ganesan
2024-08-30 12:16             ` Selvarasu Ganesan
2024-08-31  0:50               ` Thinh Nguyen
2024-09-02 11:27                 ` Selvarasu Ganesan
2024-09-03 23:41                   ` Thinh Nguyen
2024-09-04  1:03                   ` Thinh Nguyen
2024-09-04 15:50                     ` Selvarasu Ganesan [this message]
2024-09-05  0:26                       ` Thinh Nguyen
2024-09-05 13:19                         ` Selvarasu Ganesan
2024-09-05 21:13                           ` Thinh Nguyen
2024-09-05 23:05                             ` Selvarasu Ganesan
2024-09-05 23:18                               ` Thinh Nguyen
2024-09-06  0:28                                 ` Selvarasu Ganesan
2024-09-06  0:59                                   ` Thinh Nguyen
2024-09-06 19:02                                     ` Selvarasu Ganesan
2024-09-07  0:39                                       ` Thinh Nguyen
2024-09-10 13:37                                         ` Selvarasu Ganesan
2024-09-11  0:24                                           ` Thinh Nguyen
2024-09-13 12:42                                             ` Selvarasu Ganesan
2024-09-13 17:51                                               ` Thinh Nguyen
2024-09-13 18:00                                                 ` Thinh Nguyen
2024-09-16 12:43                                                   ` Selvarasu Ganesan
2024-09-16 21:19                                                     ` Thinh Nguyen
2024-09-16 12:41                                                 ` Selvarasu Ganesan
2024-09-16 21:18                                                   ` Thinh Nguyen
2024-09-16 22:54                                                     ` Selvarasu Ganesan

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=11535d95-c972-4dbe-afb5-de3a44bc4a21@samsung.com \
    --to=selvarasu.g@samsung.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=akash.m5@samsung.com \
    --cc=dh10.jung@samsung.com \
    --cc=eomji.oh@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hongpooh.kim@samsung.com \
    --cc=jh0801.jung@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=naushad@samsung.com \
    --cc=rc93.raju@samsung.com \
    --cc=shijie.cai@samsung.com \
    --cc=taehyun.cho@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