[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4e82c0dd-4a36-4e1d-a93a-9bef5d63aa50@samsung.com>
Date: Wed, 3 Dec 2025 10:55:40 +0530
From: Selvarasu Ganesan <selvarasu.g@...sung.com>
To: Alan Stern <stern@...land.harvard.edu>, Thinh Nguyen
<Thinh.Nguyen@...opsys.com>
Cc: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"jh0801.jung@...sung.com" <jh0801.jung@...sung.com>, "dh10.jung@...sung.com"
<dh10.jung@...sung.com>, "naushad@...sung.com" <naushad@...sung.com>,
"akash.m5@...sung.com" <akash.m5@...sung.com>, "h10.kim@...sung.com"
<h10.kim@...sung.com>, "eomji.oh@...sung.com" <eomji.oh@...sung.com>,
"alim.akhtar@...sung.com" <alim.akhtar@...sung.com>, "thiagu.r@...sung.com"
<thiagu.r@...sung.com>, "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH v2] usb: dwc3: gadget: Prevent EPs resource conflict
during StartTransfer
On 11/21/2025 8:38 AM, Alan Stern wrote:
> On Fri, Nov 21, 2025 at 02:22:02AM +0000, Thinh Nguyen wrote:
>> On Wed, Nov 19, 2025, Alan Stern wrote:
>>> ->set_alt() is called by the composite core when a Set-Interface or
>>> Set-Config control request arrives from the host. It happens within the
>>> composite_setup() handler, which is called by the UDC driver when a
>>> control request arrives, which means it happens in the context of the
>>> UDC driver's interrupt handler. Therefore ->set_alt() callbacks must
>>> not sleep.
>> This should be changed. I don't think we can expect set_alt() to
>> be in interrupt context only.
> Agreed.
>
>>> To do this right, I can't think of any approach other than to make the
>>> composite core use a work queue or other kernel thread for handling
>>> Set-Interface and Set-Config calls.
>> Sounds like it should've been like this initially.
> I guess the nobody thought through the issues very carefully at the time
> the composite framework was designed. Maybe the UDCs that existed back
> did not require a lot of time to flush endpoints; I can't remember.
>
>>> Without that ability, we will have to audit every function driver to
>>> make sure the ->set_alt() callbacks do ensure that endpoints are flushed
>>> before they are re-enabled.
>>>
>>> There does not seem to be any way to fix the problem just by changing
>>> the gadget core.
>>>
>> We can have a workaround in dwc3 that can temporarily "work" with what
>> we have. However, eventually, we will need to properly rework this and
>> audit the gadget drivers.
> Clearly, the first step is to change the composite core. That can be
> done without messing up anything else. But yes, eventually the gadget
> drivers will have to be audited.
>
> Alan Stern
Hi Thinh,
Do you have any suggestions that might be helpful for us to try on our side?
This EP resource‑conflict problem becomes easily observable when the
RNDIS network test executing ifconfig rndis0 down/up is run repeatedly
on the device side.
Thanks,
Selva
Powered by blists - more mailing lists