Re: [PATCH] usb: dwc3: gadget: Avoid race between dwc3 interrupt handler and irq thread handler

From: Felipe Balbi
Date: Tue Dec 27 2016 - 06:07:51 EST


Lu Baolu <> writes:
> On 12/26/2016 04:01 PM, Baolin Wang wrote:
>> 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.
> Why not spin_lock_irq ones? This lock seems to be used in both
> normal and interrupt threads. Or, I missed anything?

this is top half handler. Interrupts are already disabled.


Attachment: signature.asc
Description: PGP signature