From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756239AbcL0C60 (ORCPT ); Mon, 26 Dec 2016 21:58:26 -0500 Received: from mail-oi0-f48.google.com ([209.85.218.48]:35569 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754477AbcL0C6Y (ORCPT ); Mon, 26 Dec 2016 21:58:24 -0500 MIME-Version: 1.0 In-Reply-To: <5861D477.7070407@linux.intel.com> References: <0d79eb1f34e409749a136173b68f365b545c4789.1482738764.git.baolin.wang@linaro.org> <5861D477.7070407@linux.intel.com> From: Baolin Wang Date: Tue, 27 Dec 2016 10:58:22 +0800 Message-ID: Subject: Re: [PATCH] usb: dwc3: gadget: Avoid race between dwc3 interrupt handler and irq thread handler To: Lu Baolu Cc: Felipe Balbi , Greg KH , USB , LKML , Linaro Kernel Mailman List , Mark Brown Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 27 December 2016 at 10:39, Lu Baolu wrote: > Hi, > > 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? I assumed there are no nested interrupts, when one core is running at interrupt context, then it can not respond any other interrupts, which means we don't need to disable local IRQ now, right? -- Baolin.wang Best Regards