On Thu, Feb 6, 2025 at 8:13 AM Michał Pecio <michal.pecio@xxxxxxxxx> wrote: > > Hi, > > > - not flushing the endpoints of actively offloaded USB devices. Given > > that the USB devices is used by another entity, unilaterally flush > > the endpoint might lead to unexpected behavior on another entity. > > This doesn't seem right, because flushing applies to URBs managed by > the kernel, so it should have no effect on offloaded endpoints. > > As far as I understand from your earlier discussion with Alan Stern, > the real reason is that it disrupted operation of class drivers, in > particular causing kernel-managed interrupt endpoints not to be polled > during suspend and some events were being lost. > > Or maybe the real problem was that if the INT IN endpoint isn't being > polled, device events don't trigger xHCI IRQs that wake up the CPU? > The main reason is as you described above. Without polling the INT IN endpoint, some functions (e.g. hid, hub) failed during system suspend. > > And by the way, usb_hcd_flush_endpoint() doc states that no new URBs > may be submitted during this call. I wonder if this can be guaranteed > if the interface has not been suspended first? Perhaps this alone is > good reason not to flush. > > Regards, > Michal To my understanding if the interface creates another URB, then the interface might be able to submit it. Is there a reason to not flushing all endpoints on a USB device when we have offloaded transfer happening during system suspend? If there is, we'll identify what kinds of endpoints are influenced and not flush them independently. Otherwise, not flushing all of them might maintain a simpler code logic. Regards, Guan-Yu