From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935827AbcLVBqL (ORCPT ); Wed, 21 Dec 2016 20:46:11 -0500 Received: from mga07.intel.com ([134.134.136.100]:47715 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934047AbcLVBqJ (ORCPT ); Wed, 21 Dec 2016 20:46:09 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,386,1477983600"; d="scan'208";a="42329928" Subject: Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command To: OGAWA Hirofumi , Mathias Nyman References: <0c39bfed1cf6f7b747e702aa841f82c9d2140f27.1480922249.git.baolin.wang@linaro.org> <584EC7B9.6040100@linux.intel.com> <5857B794.2070100@linux.intel.com> <5857CEE4.6040007@intel.com> <5858B3AE.90705@linux.intel.com> <5858D231.7040407@linux.intel.com> <5858DB52.8060707@linux.intel.com> <58594A9A.10507@linux.intel.com> <585A1E67.4020902@linux.intel.com> <585A7A0A.6090401@linux.intel.com> <87tw9xv0dt.fsf@mail.parknet.co.jp> <585A9A0F.4000603@linux.intel.com> <87mvfpux8n.fsf@mail.parknet.co.jp> Cc: Baolin Wang , Mathias Nyman , Greg KH , USB , LKML , Mark Brown , "Lu, Baolu" , Alan Stern From: Lu Baolu Message-ID: <585B305E.80202@linux.intel.com> Date: Thu, 22 Dec 2016 09:46:06 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <87mvfpux8n.fsf@mail.parknet.co.jp> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 12/21/2016 11:18 PM, OGAWA Hirofumi wrote: > Mathias Nyman writes: > >>> We set CMD_RING_STATE_ABORTED state under locking. I'm not checking what >>> is for taking lock for register though, I guess it should be enough just >>> lock around of read=>write of ->cmd_ring if need lock. >> After your patch it should be enough to have the lock only while >> reading and writing the cmd_ring register. >> >> If we want a locking fix that applies more easily to older stable >> releases before your change then the lock needs to cover set >> CMD_RING_STATE_ABORT, read cmd_reg, write cmd_reg and busiloop >> checking CRR bit. Otherwise the stop cmd ring interrupt handler may >> restart the ring just before we start checing CRR. The stop cmd ring >> interrupt will set the CMD_RING_STATE_ABORTED to >> CMD_RING_STATE_RUNNING so ring will really restart in the interrupt >> handler. > Just for record (no chance to make patch I myself for now, sorry), while > checking locking slightly, I noticed unrelated missing locking. > > xhci_cleanup_command_queue() > > We are calling it without locking, but we need to lock for accessing list. Yeah. I can make the patch. Best regards, Lu Baolu