[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFED-j=CUdGNtt0CsZPDZNMn9Op3tmAneNqscQRyFneibAOOjQ@mail.gmail.com>
Date: Wed, 28 Dec 2016 16:27:42 +0100
From: Janusz Dziedzic <janusz.dziedzic@...il.com>
To: Felipe Balbi <balbi@...nel.org>
Cc: Lu Baolu <baolu.lu@...ux.intel.com>,
Baolin Wang <baolin.wang@...aro.org>,
Greg KH <gregkh@...uxfoundation.org>,
USB <linux-usb@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Linaro Kernel Mailman List <linaro-kernel@...ts.linaro.org>,
Mark Brown <broonie@...nel.org>
Subject: Re: [PATCH] usb: dwc3: gadget: Avoid race between dwc3 interrupt
handler and irq thread handler
2016-12-27 12:05 GMT+01:00 Felipe Balbi <balbi@...nel.org>:
> Hi,
>
> Lu Baolu <baolu.lu@...ux.intel.com> 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.
>
BTW,
We don't use spin_lock in top half handler.
Maybe we should/can switch all spin_lock_irqsave() to simple
spin_lock() in the thread/callbacks?
Or there is a reason to use irqsave() version?
BR
Janusz
> --
> balbi
--
Janusz Dziedzic
Powered by blists - more mailing lists