Linux USB
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Selvarasu Ganesan <selvarasu.g@samsung.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	"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>,
	"h10.kim@samsung.com" <h10.kim@samsung.com>,
	"eomji.oh@samsung.com" <eomji.oh@samsung.com>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"thiagu.r@samsung.com" <thiagu.r@samsung.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2] usb: dwc3: gadget: Prevent EPs resource conflict during StartTransfer
Date: Fri, 5 Dec 2025 01:18:30 +0000	[thread overview]
Message-ID: <20251205011823.6ujxcjimlyetpjvj@synopsys.com> (raw)
In-Reply-To: <20251205003723.rum7bexy2tazcdwb@synopsys.com>

On Fri, Dec 05, 2025, Thinh Nguyen wrote:
> On Thu, Dec 04, 2025, Selvarasu Ganesan wrote:
> > 
> > On 12/4/2025 7:21 AM, Thinh Nguyen wrote:
> > > At the moment, I can't think of a way to workaround for all cases. Let's
> > > just leave bulk streams alone for now. Until we have proper fixes to the
> > > gadget framework, let's just try the below.
> > >
> > 
> > 
> > Hi Thinh,
> > 
> > Thanks for the changes. We understand the given fix and have verified 
> > that the original issue is resolved, but a similar below warning appears 
> > again in `dwc3_gadget_ep_queue` when we run a long duration our test. 
> > And we confirmed this is not due to this new given changes.
> > 
> > This warning is caused by a race between `dwc3_gadget_ep_disable` and 
> > `dwc3_gadget_ep_queue` that manipulates `dep->flags`.
> > 
> > Please refer the below sequence for the reference.
> > 
> > The warning originates from a race condition between 
> > dwc3_gadget_ep_disable and dwc3_send_gadget_ep_cmd from 
> > dwc3_gadget_ep_queue that both manipulate dep->flags. Proper 
> > synchronization or a check is needed when masking (dep->flags &= mask) 
> > inside dwc3_gadget_ep_disable.
> > 
> 
> I was hoping that the dwc3_gadget_ep_queue() won't come early to run
> into this scenario. What I've provided will only mitigate and will not
> resolve for all cases. It seems adding more checks in dwc3 will be
> more messy.
> 
> Probably we should try rework the usb gadget framework instead of
> workaround the problem in dwc3. Here is a potential solution I'm
> thinking: introduce usb_ep_disable_with_flush().
> 

Actually, no. Let's just revert this:

b0d5d2a71641 ("usb: gadget: udc: core: Revise comments for USB ep enable/disable")

Reword the implementation in dwc3 and audit where usb_ep_disable() is used.

Thanks,
Thinh

  reply	other threads:[~2025-12-05  1:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20251117160057epcas5p324eddf1866146216495186a50bcd3c01@epcas5p3.samsung.com>
2025-11-17 15:59 ` [PATCH v2] usb: dwc3: gadget: Prevent EPs resource conflict during StartTransfer Selvarasu Ganesan
2025-11-18  2:21   ` Thinh Nguyen
2025-11-18  3:58     ` Selvarasu Ganesan
2025-11-19  1:56       ` Thinh Nguyen
2025-11-18  4:20     ` Alan Stern
2025-11-19  1:49       ` Thinh Nguyen
2025-11-19  4:09         ` Alan Stern
2025-11-20  2:07           ` Thinh Nguyen
2025-11-20  3:33             ` Alan Stern
2025-11-21  2:22               ` Thinh Nguyen
2025-11-21  3:08                 ` Alan Stern
2025-12-03  5:25                   ` Selvarasu Ganesan
2025-12-04  1:51                     ` Thinh Nguyen
2025-12-04 13:15                       ` Selvarasu Ganesan
2025-12-05  0:37                         ` Thinh Nguyen
2025-12-05  1:18                           ` Thinh Nguyen [this message]
2025-12-05  1:19                             ` Thinh Nguyen
2025-12-11 10:38                             ` Selvarasu Ganesan
2025-12-12  1:21                               ` Thinh Nguyen
2026-02-26 10:59                                 ` Selvarasu Ganesan
2026-02-26 18:41                                   ` Thinh Nguyen
2026-03-02  5:56                                     ` 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=20251205011823.6ujxcjimlyetpjvj@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=akash.m5@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=dh10.jung@samsung.com \
    --cc=eomji.oh@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=h10.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=selvarasu.g@samsung.com \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=thiagu.r@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