From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941891AbcLWM4B (ORCPT ); Fri, 23 Dec 2016 07:56:01 -0500 Received: from mga03.intel.com ([134.134.136.65]:61705 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941659AbcLWMz7 (ORCPT ); Fri, 23 Dec 2016 07:55:59 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,393,1477983600"; d="scan'208";a="206116622" Subject: Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command To: Lu Baolu , OGAWA Hirofumi 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> <585B305E.80202@linux.intel.com> Cc: Baolin Wang , Mathias Nyman , Greg KH , USB , LKML , Mark Brown , "Lu, Baolu" , Alan Stern From: Mathias Nyman Message-ID: <585D1E94.6040400@linux.intel.com> Date: Fri, 23 Dec 2016 14:54:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <585B305E.80202@linux.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22.12.2016 03:46, Lu Baolu wrote: > 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. > Force updated timeout_race_fixes branch. I'll be out for a few days during xmas, continue testing after that -Mathias