Hi, Janusz Dziedzic writes: > 2016-12-26 9:01 GMT+01:00 Baolin Wang : >> On some platfroms(like x86 platform), when one core is running the USB gadget >> irq thread handler by dwc3_thread_interrupt(), meanwhile another core also can >> respond other interrupts from dwc3 controller and modify the event buffer by >> dwc3_interrupt() function, that will cause getting the wrong event count in >> irq thread handler to make the USB function abnormal. >> >> We should add spin_lock/unlock() in dwc3_check_event_buf() to avoid this race. >> > Interesting, I always think we mask interrupt in dwc3_interrupt() by setting > DWC3_GEVNTSIZ_INTMASK > And unmask interrupt when we end dwc3_thread_interrupt(). > > So, we shouldn't get any IRQ from HW during dwc3_thread_interrupt(), > or I miss something? > Do you have some traces that indicate this masking will not work correctly? that's the very question I have. We are already masking interrupts from this controller. The only thing this could race with is usb_ep_queue(), but that gets nowhere close to anything we're doing in the top half handler, so there's really no danger of anything bad happening. I'd like to see traces as well. -- balbi