2021년 8월 16일 (월) 오전 10:03, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>님이 작성: > > On Mon, Aug 16, 2021 at 08:52:06AM +0800, Peter Chen wrote: > > On 21-08-10 15:02:28, Jeaho Hwang wrote: > > > hw_ep_prime sometimes fails if irq occurs while it rus on RT kernel. > > > to prevent local_irq_save should keep the function from irqs. > > > > > > I am not sure where is the best to submit this patch, between RT and USB > > > community so sending to both. thanks. > > > > Greg, do you have any suggestions about it, the RT kernel schedules the interrupt > > handler (top-half) out which causes the USB hardware atomic sequences are broken, > > these hardware operations needs to be executed within limited time. > > The RT kernel does its scheduling based on priorities. If the > interrupt handler is scheduled out, it's because some other process > with a higher priority needs to run. The answer should be to increase > the handler's priority. It is not a schedule issue. Priority does not prevent atomic sequences from irq handlers which run in interrupt context. So we added local_irq_save to protect explicitly and asked if it is the right approach. In addition, I've checked if all functions in udc.c, which have the comment "execute without interruption", need to be protected from irqs. And I think no need for the others since they don't seem to have any contention between tasks and the chip as hw_ep_prime has. Thanks. > > Alan Stern