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