From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935283AbcLUPSW (ORCPT ); Wed, 21 Dec 2016 10:18:22 -0500 Received: from mail.parknet.co.jp ([210.171.160.6]:43695 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbcLUPSU (ORCPT ); Wed, 21 Dec 2016 10:18:20 -0500 From: OGAWA Hirofumi To: Mathias Nyman Cc: Lu Baolu , Baolin Wang , Mathias Nyman , Greg KH , USB , LKML , Mark Brown , "Lu\, Baolu" , Alan Stern Subject: Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command 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> Date: Thu, 22 Dec 2016 00:18:16 +0900 In-Reply-To: <585A9A0F.4000603@linux.intel.com> (Mathias Nyman's message of "Wed, 21 Dec 2016 17:04:47 +0200") Message-ID: <87mvfpux8n.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks. -- OGAWA Hirofumi