From patchwork Fri Sep 21 01:48:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 10608933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98CD7913 for ; Fri, 21 Sep 2018 01:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 989A82DFCD for ; Fri, 21 Sep 2018 01:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B3CB2DFE1; Fri, 21 Sep 2018 01:51:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16DD72DFCD for ; Fri, 21 Sep 2018 01:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388877AbeIUHhu (ORCPT ); Fri, 21 Sep 2018 03:37:50 -0400 Received: from mail-eopbgr10059.outbound.protection.outlook.com ([40.107.1.59]:26876 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725869AbeIUHhu (ORCPT ); Fri, 21 Sep 2018 03:37:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PUgPlC6AcOfLt7OXTB9B+cVVIhWIqPk1X0o0APTLFzk=; b=dnAvmHZZ5sGTHXvEZnfGb2cbHRMvAJOVxLdGSSnpgKBQuMhi9ALiq3AI2YTp8VYS6028+UHWgxsN7tCcYMXGRoOE7m8JmNrwAd0q3okOTcFugYosMHo6VYK52qI8Iv8L6TYgk5ej2SjYi2kTeC55UV+acmsLaLKHvwfY+izkv7w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peter.chen@nxp.com; Received: from b29397-desktop.ap.freescale.net (119.31.174.66) by VI1PR04MB5326.eurprd04.prod.outlook.com (2603:10a6:803:60::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 01:50:39 +0000 From: Peter Chen To: mathias.nyman@intel.com Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, jun.li@nxp.com, Peter Chen Subject: [PATCH 3/3] usb: host: xhci: return early for xhci_urb_dequeue when removing hcd Date: Fri, 21 Sep 2018 09:48:45 +0800 Message-Id: <20180921014845.14560-4-peter.chen@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180921014845.14560-1-peter.chen@nxp.com> References: <20180921014845.14560-1-peter.chen@nxp.com> MIME-Version: 1.0 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK0P153CA0022.APCP153.PROD.OUTLOOK.COM (2603:1096:203:18::34) To VI1PR04MB5326.eurprd04.prod.outlook.com (2603:10a6:803:60::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5dd82d40-edad-4797-b421-08d61f64a366 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB5326; X-Microsoft-Exchange-Diagnostics: 1;VI1PR04MB5326;3:XssefB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p1/HE9E4cASvPbgtlThmWhwW8tYkyll9QrXMkErQSapHmmRLeV327+YzPDN6ep/K0oLi4wIYEt75GLpa41XwuFfmOnxJWOHJc2Ba07ZmgVWP1+5FNVEyvhmQuzgAnxbIadAyCAABPQu1Ys5FHZJ6LxbywPIxjVBwwUrAZBOZzUuqMo39M9iAZQ/vv1FxAWpIQuuy3KmG2voTsWPKj72qcrLXvoWHdZa+b+QeytAvxL40G+7bUITuIZ5HQyJKXZmrMtjnHla0rqsZw/EF13jOmN2t2PJY3CKCaH4IbD63Kl5tZjcthY8/nN7vN83FmtgZJ8npoJwEbXpcIYuAyEZcGgsYA6coE;4:h/M95ylaOCa8TD5lD8rY2tiFmhmHmnaDXUaRClSlN2i38ArJcYDiJIbQLMQ1WMFzofRffkZ1ODKkjuuBxJrSZ86gF9gZGw/Jfea9T+Gd286kfktF1DtI1dmjdkPecCIl9ZZl1XXEpBIQmSyhTWctN30bHrj40L/SMmWqnP1ytoCjWoI3lcLRwGOtSVmfFl+ZnQcNOYmkZMRutdXgJbxHRe6Q4awKqwpuGASN8/iisWOnn8MKhu9vhkqllch0BqUf3GoIPTHSiSyL3AUc/99bfsRxq6PDZChp94h2RZLJBYMeLOomZdH9WpGAHUzi12B2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231355)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(201708071742011)(7699051);SRVR:VI1PR04MB5326;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB5326; X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(366004)(346002)(376002)(396003)(189003)(199004)(52116002)(76176011)(81156014)(3846002)(8676002)(51416003)(2906002)(81166006)(386003)(2616005)(50226002)(316002)(6506007)(486006)(11346002)(476003)(446003)(8936002)(956004)(6116002)(44832011)(6512007)(50466002)(6486002)(4326008)(105586002)(53936002)(305945005)(48376002)(7736002)(2351001)(14444005)(26005)(186003)(106356001)(16526019)(5660300001)(36756003)(66066001)(16586007)(47776003)(6916009)(86362001)(97736004)(68736007)(1076002)(478600001)(2361001)(25786009)(6666003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5326;H:b29397-desktop.ap.freescale.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;VI1PR04MB5326;23:zcZFpc4aSpnoxMrcWNafEVpiG1wKLUZOZpzXPoXrUIVBbxX7QAtyCpbe4S6WuONnWpVWgnbRlizsUh8znb18KEcRqxlR9ZS6sWm42WC3fJ4CKtfH+TZoPpVin4DDmooNU5ehBj/jTvxQUHTdDXhtZhPJ9Gth0Yv92gvJ7/eyesIfiw2uXGB6uXCbq4nEunjpmBClV6SCSQWbq928y8y0y5L1Fbt/E3nX3KEvaOAnVbATwhKtGiKPZW9KpM3ouEB+pzGOU1wzQTLY6tvVqooEwFVrGTLYAFAtRZDyHSf6dYkA9wYO1CVBsu8WkyTMEIzdyKWESKmqJF78YNooVbv1smlralW1zx9vS4YvEw/BtoqiV6iQQttZF0Hndv3eMA4yX0u2QQHcHslJVixWpBFrFIP/eyP2F4VeQ1VMOhUik/4jhhfxfSX7UTsWKVy/zxTS7QF1iJtkv015duFW7ZTbVb/a7QXfTUYzvVA+OJ16VKudVVP6cypFCuh57SPfhYR6wK6SygCD9prDReoBirxsRt9N4aoWADUDakZZkN1McWXuj3nNhVHcXYoDXzgU3rXQvPyXuomtFVzu1x0QzOKpx9OmcQUoM+EucGqD2mwCJ7MwzxiKyafSJGwo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87XX7SvAZ+DtIq+6t9ZcKUsRlMQiXIlmqXV4ChLPT444M/9I1CKN8WCyiatPkkXzoFPqDNi1iqpM4f54gFYKgiOuFDB3Xw50D7/gEnnxsqJ7elWlkmyip4e3k7apcL4G+kFqwuW0mR/CMRLD3R28gDkcLFUE/JZ/G9t8qd0E6kci/9jPEtvaEmDugQBcAOwt1PHjOCyl5m30rktXZmbGOim8Zs5HRVsL+l9yBY5xzheZhEkE3NIAqgK9GxzMLXbCwfVgo2b0vYNkd5Gsxu3UlRJBH+ugloLpgFrWm5jcYz9Ns5TCOHT918lRuXxO8UC6NdbTofe6593hC+HnVvjagokN2yfr3L4dOEMncfko/AHnWokN7g1LL6NBxof4xlI1f2kU+pe9/1zdg1Z0bS6AEne1wqbOucn0rgYxnpqVl6nwGQx852WJNSEzvtHpzm8qGvQqnnf8R23sWRbVMCQ==;5:ocQKK0qylGRdV0wdEwfL2xbkakm62GoHYzRba1KF52/A+wtSoQAtdkhHh/N6SkgJgntatr7mql6y8YTm9Dor1d6OlCJ91pnHnSZxuDPJtgVuxWS3cvhkpV5A0fcPsOxaA3R+Hq7RxFGGHcCs+5hNDTcAo8jo4czD8COeb0ELbrM=;7:67MjBOkrOfOC9DlSusRMa9YYMCgYMTfeGvBYMCpPnMBnVmCdMAoyPi38IHxZBs/cqcQT0Iix7Lod1/GZe1fjjUvBKwB6ConPr3gA6jQtSn/Qr0RwCKKgIwOaDstrt2ruZJV3fpGDqtg35g2Vg9dugKfu1VsGnSq6B4fmrPoJYMB0ZzY5Wu9u6AdYRgypMVhBVzO2bkradrM4pqP43iL+F4voe6MRwvqKiSAZIN534U/+Xe9483MfX6pjjq8vWxCd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 01:50:39.5767 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5dd82d40-edad-4797-b421-08d61f64a366 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5326 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we are removing hcd, the stop endpoint command may be timeout. To eliminate the timeout, we'd better return early. The related log for this timeout like below: [31.208933] hub 3-1:1.0: hub_ext_port_status failed (err = -71) [31.214972] usb 3-1-port2: cannot reset (err = -71) [31.219962] usb 3-1-port2: cannot reset (err = -71) [31.225069] usb 3-1-port2: cannot reset (err = -71) [31.230018] usb 3-1-port2: Cannot enable. Maybe the USB cable is bad? [31.236566] usb 3-1-port2: cannot disable (err = -71) [31.241745] usb 3-1-port2: unable to enumerate USB device [31.247255] usb 3-1-port2: cannot disable (err = -71) [31.252422] hub 3-1:1.0: hub_ext_port_status failed (err = -71) [31.258486] hub 3-1:1.0: hub_ext_port_status failed (err = -71) [31.264518] hub 3-1:1.0: hub_ext_port_status failed (err = -71) [31.270649] hub 3-1:1.0: hub_ext_port_status failed (err = -71) [31.276723] hub 3-1:1.0: hub_ext_port_status failed (err = -71) [31.282809] usb 3-1: USB disconnect, device number 2 [31.287859] usb 3-1.1: USB disconnect, device number 3 [31.293076] usb 3-1.1: unregistering device [31.299292] xhci-hcd xhci-hcd.1.auto: remove, state 4 [31.304416] usb usb4: USB disconnect, device number 1 [31.309566] usb 4-1: USB disconnect, device number 2 [31.314589] usb 4-1: unregistering device [31.316389] usb 3-1: unregistering device [31.331131] usb usb4: unregistering device [31.339809] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered [31.345534] xhci-hcd xhci-hcd.1.auto: remove, state 1 [31.350668] usb usb3: USB disconnect, device number 1 [36.407457] xhci-hcd xhci-hcd.1.auto: xHCI host not responding to stop endpoint command. [36.423638] xhci-hcd xhci-hcd.1.auto: xHCI host controller not responding, assume dead [36.436502] usb usb3: unregistering device [36.445429] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregistered Signed-off-by: Peter Chen --- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 3113938063fd..1bcf27a9737d 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1601,7 +1601,8 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) goto err_giveback; } - if (xhci->xhc_state & XHCI_STATE_HALTED) { + if (xhci->xhc_state & XHCI_STATE_HALTED || + xhci->xhc_state & XHCI_STATE_REMOVING) { xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, "HC halted, freeing TD manually."); for (i = urb_priv->num_tds_done;