Open tmon-nordic opened 5 months ago
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.
Describe the bug
udc_submit_ep_event()
events are queued tousbd_msgq
insideusbd_event_carrier()
. The problem is that the function can silently fail to queue the event becausek_msgq_put()
is called withK_NO_WAIT
: https://github.com/zephyrproject-rtos/zephyr/blob/0781caf408459dfd6c91477cedb62a43912a8c51/subsys/usb/device_next/usbd_core.c#L34-L38This can lead to all sort of issues, but two major issues have been notified so far:
udc_submit_ep_event(dev, buf, -ECONNABORTED);
can be silently dropped, never making it to the class. Observed on MSC class that would not requeue the OUT transfer because it never received the-ECONNABORTED
on the request it submitted. The only solution was to reset the CPU (bus reset was not enough).To Reproduce
The following ways to fill the message queue were identified so far:
udc_submit_ep_event
is called before USB stack pops the SOFs fromusbd_msgq
, the events are silently dropped.Expected behavior Queued endpoint events are never dropped, i.e. there is always a matching
struct usbd_class_api
request
call for every successfulusbd_ep_enqueue()
.Impact If the issue trigger, the stack can cease to work until device reboot.
Logs and console output Console output irrelevant, the underlying issue is that things that must never be silently dropped can be dropped.
Environment (please complete the following information):
Additional context "Catching up" with not handled SOFs do not make much sense and can lead to avalanche effects if too many SOFs are queued for handling.