From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754333AbcL0LHq (ORCPT ); Tue, 27 Dec 2016 06:07:46 -0500 Received: from mga06.intel.com ([134.134.136.31]:26916 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754192AbcL0LHh (ORCPT ); Tue, 27 Dec 2016 06:07:37 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,416,1477983600"; d="asc'?scan'208";a="23184927" From: Felipe Balbi To: Lu Baolu , Baolin Wang , gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, broonie@kernel.org Subject: Re: [PATCH] usb: dwc3: gadget: Avoid race between dwc3 interrupt handler and irq thread handler In-Reply-To: <5861D477.7070407@linux.intel.com> References: <0d79eb1f34e409749a136173b68f365b545c4789.1482738764.git.baolin.wang@linaro.org> <5861D477.7070407@linux.intel.com> Date: Tue, 27 Dec 2016 13:05:56 +0200 Message-ID: <874m1p3a3v.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, 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 g= adget >> irq thread handler by dwc3_thread_interrupt(), meanwhile another core al= so can >> respond other interrupts from dwc3 controller and modify the event buffe= r 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. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlhiSxQACgkQzL64meEa mQZuFA//Wp9ZW46zBTnxCDuJY9uvmfhUhOyFtW2G3yY24gin3ErdkIJmoiT1y9hk FpZfuRnOSCSXsyBNGr766ohGCrYiixKHGJJ3mNQtdYrJWYvKWWT1eJ3GRo5NEZdt qm4eQ8prDrY16mexe4mWwq/ehtIOfi3QJzMmncJqaq4UvMB3cfRSyiY0FLKpUzPh Z1f4t6p5+Mc39NdcQWUE91nxJXPXAooZObu9el5E2JtDeaU2kSK+ki/OLbUJtqsW j6Nv9okWZ/cXxwrzZvUP1z5GFBVeQoPNSl0m53UqE6QD8XllyrmfSGpU9Pf7Ywm1 K9GM/+0QXoI1wWHO+4ntjZ0lQCxLWwglqSRur2qO9qCiRgi2u1xRlw7MXSP7LQW+ DREOHRof03YHqOwyUUWL1D3zSvPecK5UIC6uabGxpp4C8O2sDuOeHeTOuTvnUZ3P wEkobBXnzde3zYbdtuhPvsgvtNfPdsImsn9YIkqIeQAWyFONNe2JdWG6kTfi82Yv t1/PCnuE/GMMPg94JttZi4lXPc/AIZdKOOZq5ZE+4cpWI6WMDwbVHFfG0G8UcNaf 8cWxza91djVvVplGDXugW5F0jzjLqRcF/rsxqFciq4V+P1vHoCOrwFDwcLNYQmDh jz2wSGtOgaqvphzNaoeM/G4Wx8UW6BrdzKZ4CPteV4RsknToSgs= =piPI -----END PGP SIGNATURE----- --=-=-=--