From patchwork Fri Sep 21 01:48:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 10608929 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 79BB2913 for ; Fri, 21 Sep 2018 01:51:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CD7D2DFCD for ; Fri, 21 Sep 2018 01:51:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E7932DFE1; Fri, 21 Sep 2018 01:51:21 +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 5D8342DFCD for ; Fri, 21 Sep 2018 01:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388874AbeIUHhp (ORCPT ); Fri, 21 Sep 2018 03:37:45 -0400 Received: from mail-eopbgr10073.outbound.protection.outlook.com ([40.107.1.73]:20092 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388798AbeIUHhp (ORCPT ); Fri, 21 Sep 2018 03:37:45 -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=FPTkTMRBxIlOsw/fSTloWYQzyq9TFOKZqyiTADcQbS8=; b=gBhOref7EYxdo/cT4QdWOXYKS5dP66FzUwj2OiGa1hTG4yQvsQxxCjCPRj+9lx4T71ntTOjCEFIznz7u+WYLWaneRsDoCbU9ObDtwmSm/Sd9mrZzqxfL7Yloyov0L/oljVpwxCt77Vj1oxoyIwVS4kpBPyZzCibDLdmu1/WGhIA= 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:33 +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 1/3] usb: host: xhci: fix oops when removing hcd Date: Fri, 21 Sep 2018 09:48:43 +0800 Message-Id: <20180921014845.14560-2-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: ec6d7d88-aa4e-4ab2-ff21-08d61f64a009 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:F9Et4Cqj3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ZV9eb0O057aLfKc/kquDd+5x+mJOUvJuKopmqwow3qu0OiQHNA/7/kzF8h/RUMzr3wgxgiv9TuOjTM3USY4masp2OafllooA5rNUxY8bOFBy8W+F0F6DjQQoCFTDnEng6wrLPgGZe2h0tF/DZ/G0IbW+t5x9mvz+leSE7S4Ksr3jCggUth1ocrV9GOJDLtE95BH4eJgTzNVXjCrzSCHtNXHTmmigUwruXEKx2zxuu4ecXy6oh66uZNHXmP42PpXLgM66Zi0DybonB/awpjhmPaBVvKnR2OeOibk5GKUUhS66PZh1b2D3VdlwwIyba6PMjWAyVQdMjGat43Z7QaxQnR27SO2YB5Xd;4:Lt/YHVqywPmQZb8om3Q+R11o/UIptVZ9IhPYvrUJ+xVl8tPKf8OplA55X+WePcVJM2iwwfTb6Barg5GWFETtc9uTa60qemNf9aAIaJ1tO1azrrTfKQuzPJZdn4mBlLGagSShqT8AU9zCpxV4sNQX04bAAMa9lYht8hwX5OQZjCRDTmXF7pspJjb5wjcpGYGsT4D6RV/Yaj/oGK6bM/kmDcN/GXCYWYRvZdMJ7BqCvKsH4SjBiKIrOU9bp07fI6pwxYA4PpYRpocJULIjGGmaPdJs1fW+EZ31wi7FEX7YehNNk69wGPPm6wd3exGSQlFU 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)(51234002)(199004)(575784001)(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)(45080400002)(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:K9cSPWFf2FgsnvJQuwAt+WKg3fEOz5Vx9oA2z48uw7ocHLiKUfXI4LJ4TU+lcURuERwTQ7IuwTQU+5lAIFhkElrsT4ybWmtdbBawo7ePh3PmskWlfaE7jZ/8xm0ORenSpf2o7B8C5j83vOmKpAGf7uin/fWv6JiKBcDmCzBqhsAYnQyrkyArmXKdX3BkiIQo9+gzZsDpJMmWqm+gQiyLOGReBNi+Y2iGYTikyJgFr10bWZEry5Pt99PYoFtHXz+cRbbDmwyrEbUSzn8IzRBhdq9Ddx5+rDh9genk7MNAmvD0qA45qxJzVMa70xuZddNAgGNapeXQm+9bXzrtDLra5aYMzF8DbOIWLwafoEHVI/8wcWlV0ndeaA9nfaLh82264o4JDT/N+BZgFHntW8qRMoBjgwYHz1pOBwFF1h4I0mBqLsMWonGUKBKRbtgw/pDRZu5mUamV3MF9Z80ytXRHY+QjUCPxVzbjqf4Zg03KOB4uE43PE6ljjq6dK/nK9hJ2msdmPArSF4Q9zXTwb63ZnRpTZ112a0HwcHG+F+VF/hE/205GQ/X5Y+j7n6XN9MCxahkEvctc0w5q/JgDvQ4bppXFm4gTXDKQ8BPh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2vNs09Ll5I+Lo01wpveunJGHikrck= X-Microsoft-Exchange-Diagnostics: 1;VI1PR04MB5326;6:l8D+83qNMO9Z4lbe6A78pApkdmPlj7jJdrZLoNjtleWMQBM5plow1pDDp8CHRBB3EXyIjQJENA3FaHD5P9TlTjbYs+jtQ2zQI0XB6i9T62J+P3iu+aLBQ9172i80ie4W1cjQp5JiW0t+GCpmWssQg2PR29BxSQV9XW2zbnTaayJ7yGWBL+5i8S5kAtB31u26Ok2SVozoQSRmDUO6xUAgfn7LytzdKef2db7YSHmRXL406wgBEp16fgyydFGJ2gtRrgQC+ZTpGGEQOpQOXmyBLwpl/Yn4bzGOXPmuwM1CMn1QqspbptVqGOV1mR71DAlsgvB3DrK1jxnv00Q1a+ipaXh8S/5W9MtcibWG2VnyPqBvmWZm4reqtbY+JbpIRC9ibDO8O/dXiHiTvsN/otMkcOl2RG+aEazP84lxYrvLikIl9+ZNxfCPoPp6M7Nt0SfVNrvoyk4zdwN69YHIYIjU0Q==;5:hDHMI5tMV08NKqlzqgEzFIjMdnU8cDFwT11CUnugazohW1t0/O3muzSsOAHXkaqKq+qy3nMmyWhFsUsjXzhoCdAq3NsHWtL4pJqshpxq9pQiKTeuQxtTbM0shcG9iAXB+jrq6Mv+sa2HR6oaYKAv7IeS2XZznlrJ19cUOCV/Ph4=;7:Xb3w53qiJyxHfAN/P79MyuC5h8rKZ8co5B7aslt66hGXHhyCeFNJUOyU1Xi++tN+uDmFhTrbO2lDiqgNHkzpKI+l5OGr2jbrKejPmVVhiyeD2AKlNYBApkdshbv8ZlqyJmftXh25aWX2Bbv+GzQzDtxV9apmFMipasx3ZSip7Q1QdyOmvQUz5i8LxJFq94qaex8ZxPp4dKeREZYwUJBkQ+mqll93QIANYt9jOQaGjwJGoZcxyQnuVs8VU2rfXwEP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 01:50:33.9360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec6d7d88-aa4e-4ab2-ff21-08d61f64a009 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 The USB3 HCD structure (xhci->shared_hcd) may be NULL when the USB3 interrupt occurs, the typical use case is we plug out Type-C-to-A cable, and there is a USB device at the port. The platform controller driver (eg, dwc3) unregisters xhci platform driver, and remove hcd accordingly. It is very easy to reproduce if there is a USB3 HUB on the port, and there is no USB3 device on HUB's port, the controller is at U3, it performs a far-end receiver termination detection every 100 ms, so the USB3 port change interrupt may be occurs 100ms maximum later when we plug out Type-C-to-A cable, and the USB3 HCD has already been NULL at that time. The oops log like below: [681.782288] xhci-hcd xhci-hcd.1.auto: remove, state 1 [681.787490] usb usb4: USB disconnect, device number 1 [681.792808] usb 4-1: USB disconnect, device number 2 [681.818089] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered [681.823803] Unable to handle kernel NULL pointer dereference at virtual address 000000a0 [681.823806] Mem abort info: [681.823809] Exception class = DABT (current EL), IL = 32 bits [681.823811] SET = 0, FnV = 0 [681.823813] EA = 0, S1PTW = 0 [681.823814] Data abort info: [681.823816] ISV = 0, ISS = 0x00000004 [681.823818] CM = 0, WnR = 0 [681.823822] user pgtable: 4k pages, 48-bit VAs, pgd = ffff8000ae3fd000 [681.823824] [00000000000000a0] *pgd=0000000000000000 [681.823829] Internal error: Oops: 96000004 [#1] PREEMPT SMP [681.823832] Modules linked in: 8021q garp stp mrp crc32_ce qca6174(O) crct10dif_ce galcore(O) [681.823849] CPU: 0 PID: 94 Comm: kworker/0:1 Tainted: G O 4.14.62-imx_4.14.y+gcd63def #1 [681.823851] Hardware name: Freescale i.MX8MQ EVK (DT) [681.823862] Workqueue: events_freezable __dwc3_set_mode [681.823865] task: ffff8000b8a18000 task.stack: ffff00000a010000 [681.823872] PC is at xhci_irq+0x5fc/0x14b8 [681.823875] LR is at xhci_irq+0x3c/0x14b8 [681.823878] pc : [] lr : [] pstate: 800001c5 [681.823880] sp : ffff000008003b20 [681.823882] x29: ffff000008003b20 x28: ffff00000a53df10 [681.823886] x27: ffff8000ae3c0238 x26: 00000000000001c0 [681.823890] x25: ffff8000ae3c0000 x24: ffff00000a53df10 [681.823893] x23: 0000000000000000 x22: ffff000009297db8 [681.823897] x21: ffff000008f3f0e8 x20: 0000000000000001 [681.823901] x19: ffff8000ae3c0284 x18: 0000000000000010 [681.823904] x17: 0000000000427268 x16: 00000000000000f1 [681.823908] x15: ffffffffffffffff x14: 0000000000000000 [681.823911] x13: ffff000008db0500 x12: 0000000000000001 [681.823915] x11: ffff000008db0508 x10: 0000000000000040 [681.823918] x9 : ffff0000094e4088 x8 : ffff8000b6020000 [681.823922] x7 : ffff8000b6020028 x6 : 0000000000000001 [681.823925] x5 : 0000000000000001 x4 : 0000000000000000 [681.823928] x3 : 0000000000000003 x2 : 0000000000000002 [681.823932] x1 : ffff8000ae3c0000 x0 : ffff8000b48b8c00 [681.823936] Process kworker/0:1 (pid: 94, stack limit = 0xffff00000a010000) [681.823938] Call trace: [681.823942] Exception stack(0xffff0000080039e0 to 0xffff000008003b20) [681.823946] 39e0: ffff8000b48b8c00 ffff8000ae3c0000 0000000000000002 0000000000000003 [681.823950] 3a00: 0000000000000000 0000000000000001 0000000000000001 ffff8000b6020028 [681.823953] 3a20: ffff8000b6020000 ffff0000094e4088 0000000000000040 ffff000008db0508 [681.823957] 3a40: 0000000000000001 ffff000008db0500 0000000000000000 ffffffffffffffff [681.823960] 3a60: 00000000000000f1 0000000000427268 0000000000000010 ffff8000ae3c0284 [681.823964] 3a80: 0000000000000001 ffff000008f3f0e8 ffff000009297db8 0000000000000000 [681.823968] 3aa0: ffff00000a53df10 ffff8000ae3c0000 00000000000001c0 ffff8000ae3c0238 [681.823972] 3ac0: ffff00000a53df10 ffff000008003b20 ffff0000088fec44 ffff000008003b20 [681.823975] 3ae0: ffff0000088ff204 00000000800001c5 ffff7e0002d0bb40 ffff8000b42ed880 [681.823979] 3b00: 0000ffffffffffff ffff0000081fd2b4 ffff000008003b20 ffff0000088ff204 [681.823984] [] xhci_irq+0x5fc/0x14b8 [681.823991] [] usb_hcd_irq+0x2c/0x48 [681.823997] [] __handle_irq_event_percpu+0x5c/0x148 [681.824000] [] handle_irq_event_percpu+0x1c/0x58 [681.824003] [] handle_irq_event+0x48/0x78 [681.824008] [] handle_fasteoi_irq+0xa8/0x180 [681.824014] [] generic_handle_irq+0x24/0x38 [681.824018] [] __handle_domain_irq+0x5c/0xb8 [681.824023] [] gic_handle_irq+0x78/0x17c [681.824026] Exception stack(0xffff000008003d90 to 0xffff000008003ed0) [681.824029] 3d80: 0000000000000000 ffff000009667700 [681.824032] 3da0: 0000000000000708 0000000000000000 0000000000000016 00ffffffffffffff [681.824036] 3dc0: 00000000363b4285 7fffffffffffffff ffff8000bdf62db8 0000000000000004 [681.824039] 3de0: 00000000000000f1 ffff000008db0508 0000000000000001 ffff000008db0500 [681.824043] 3e00: 0000000000000000 ffffffffffffffff 00000000000000f1 0000000000427268 [681.824047] 3e20: 0000000000000010 ffff8000b8a18000 0000000000000003 ffff000009667700 [681.824051] 3e40: ffff0000094b0018 ffff8000b8006c00 ffff000009664000 00000001000174c1 [681.824055] 3e60: ffff000008004000 ffff000008daf000 0000000000000202 ffff000008003ed0 [681.824058] 3e80: ffff000008081ad4 ffff000008003ed0 ffff000008081b14 0000000040000145 [681.824062] 3ea0: ffff8000b8a18000 0000000000000003 0000ffffffffffff 0000000000000003 [681.824065] 3ec0: ffff000008003ed0 ffff000008081b14 [681.824068] [] el1_irq+0xb0/0x124 [681.824072] [] __do_softirq+0xac/0x228 [681.824078] [] irq_exit+0xc4/0x100 [681.824083] [] __handle_domain_irq+0x60/0xb8 [681.824086] [] gic_handle_irq+0x78/0x17c [681.824089] Exception stack(0xffff00000a013770 to 0xffff00000a0138b0) [681.824091] 3760: 0000000000000020 ffff8000b8a18000 [681.824095] 3780: 00008000b4aa6000 ffffffffffffffff 0000000000000000 0000000000000000 [681.824099] 37a0: 000000000000000f 2034207375622042 7473696765726564 0000000000000006 [681.824102] 37c0: ffff00000a013820 ffff000008633128 ffff0000094c9df8 ffff00000966d45d [681.824106] 37e0: ffff00008966d44f ffffffffffffffff 0000ffff9bf1f358 0000000000427268 [681.824109] 3800: 0000000000000010 0000000000000000 0000000000000140 ffff00000966c000 [681.824113] 3820: ffff00000966cef8 ffff0000094c9000 ffff00000966dcc8 ffff0000094b0018 [681.824117] 3840: 0000000000000040 0000000000000000 ffff00000966cec8 ffff00000a0138b0 [681.824120] 3860: ffff000008121194 ffff00000a0138b0 ffff000008121198 0000000040000145 [681.824124] 3880: ffff00000966c000 ffff00000966cef8 ffffffffffffffff ffff00000966dcc8 [681.824127] 38a0: ffff00000a0138b0 ffff000008121198 [681.824130] [] el1_irq+0xb0/0x124 [681.824134] [] console_unlock.part.8+0x208/0x418 [681.824138] [] vprintk_emit+0x250/0x2e0 [681.824144] [] dev_vprintk_emit+0x104/0x220 [681.824148] [] dev_printk_emit+0x48/0x50 [681.824152] [] __dev_printk+0x3c/0x78 [681.824155] [] _dev_info+0x4c/0x58 [681.824159] [] usb_deregister_bus+0x34/0x70 [681.824162] [] usb_remove_hcd+0x130/0x1d8 [681.824165] [] xhci_plat_remove+0x48/0xe0 [681.824170] [] platform_drv_remove+0x24/0x50 [681.824175] [] device_release_driver_internal+0x174/0x208 [681.824180] [] device_release_driver+0x14/0x20 [681.824184] [] bus_remove_device+0x114/0x128 [681.824188] [] device_del+0x1ac/0x300 [681.824192] [] platform_device_del.part.3+0x24/0x90 [681.824196] [] platform_device_unregister+0x18/0x38 [681.824200] [] dwc3_host_exit+0x54/0x68 [681.824204] [] __dwc3_set_mode+0x1f4/0x210 [681.824210] [] process_one_work+0x1d4/0x348 [681.824213] [] worker_thread+0x48/0x470 [681.824218] [] kthread+0x12c/0x130 [681.824223] [] ret_from_fork+0x10/0x18 [681.824227] Code: f9400777 34002183 7103fc7f 54003680 (b940a2e4) [681.824236] ---[ end trace 3ecbb9c7f9dc3d7f ]--- [681.824239] Kernel panic - not syncing: Fatal exception in interrupt [681.824243] SMP: stopping secondary CPUs [681.824298] Kernel Offset: disabled [681.824301] CPU features: 0x080200c [681.824303] Memory Limit: none [682.518113] ---[ end Kernel panic - not syncing: Fatal exception in interrupt Signed-off-by: Peter Chen --- drivers/usb/host/xhci-ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index f0a99aa0ac58..2dc5176b79d0 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2680,7 +2680,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) } if (xhci->xhc_state & XHCI_STATE_DYING || - xhci->xhc_state & XHCI_STATE_HALTED) { + xhci->xhc_state & XHCI_STATE_HALTED || + xhci->xhc_state & XHCI_STATE_REMOVING) { xhci_dbg(xhci, "xHCI dying, ignoring interrupt. " "Shouldn't IRQs be disabled?\n"); /* Clear the event handler busy flag (RW1C); From patchwork Fri Sep 21 01:48:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 10608935 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 C7753913 for ; Fri, 21 Sep 2018 01:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6C062DFCD for ; Fri, 21 Sep 2018 01:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BABB82DFE1; Fri, 21 Sep 2018 01:51:35 +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 4E86B2DFCD for ; Fri, 21 Sep 2018 01:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725869AbeIUHiB (ORCPT ); Fri, 21 Sep 2018 03:38:01 -0400 Received: from mail-eopbgr10073.outbound.protection.outlook.com ([40.107.1.73]:20092 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388851AbeIUHiA (ORCPT ); Fri, 21 Sep 2018 03:38:00 -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=i9TQ41q0+jHhujj/A3QPbY5/oXtIptTHo4KfEMMcNFE=; b=NNrxcXOwJ0T09EN058UmZ+0Cibwk2BPcd3+eSeKVfyjc7w7ASPxxuHe+DAoApJW2rr0MR4EcpDMPz+bzA574EOnX15h7qAmnt/MTcr3ITG4Z/lJm7KhvKE2UcbbJ+epR3OPN3iDytjQPTTT8P9Lq1FEl/xOGBM0fd9elI3i/IUk= 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:37 +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 2/3] usb: host: xhci: return -ESHUTDOWN when removing hcd Date: Fri, 21 Sep 2018 09:48:44 +0800 Message-Id: <20180921014845.14560-3-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: 89a88948-3ae8-4527-2876-08d61f64a1b7 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:gDYnSTBa8GYddL5kXSfFhdNxsMKEUeW3B4GxC1AG5eifu4+rJGEIKpTcqf5SxBxPHiP0kyXnQCrf73MHbumOds3vuh5QLaR3GC9rRCImfNWV8Sfa+N6EQ+B4WPRbUTqptQPEo35Eysc/U2XTz3YNDD6mZZ5QrxuQpU/cO8DbFR+0WDU37QGQn3ov6yJ9SksV1HdiBjOCJ+v0r/A+jw6T10YNRROS0U4cymNkqe5c582TMjl2ADYg56BztaTblxS3;25:ZGHC8Km7CZTqvAO+1Ji1ilTJBWgJy1DuWMb69NqSZYJIalNuDH2sGMnrTnx13cpEPh1AqRR/vng0TdX4+QjeaZLwk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Eq;4:MwCnY9l+gym2Ja03xJ0reKUnwRChqqMCTSKcnsLaSwfrAf7aUHWkVzos0QR+FrCAnReCtbrOzHPPAlJ8DS7Fod47Q5a9O5mRuJOigv5uSdjlwQSScPOzuCuLGKVLpR0ryqdxMy96P/tuxdnyz9+vK1Cji5ACRSIy4jnZi2arG3fXKx0EbILppYTD8MCfSNKBPhyUNZ2aBhKAguhqrd5c6ynkXIH38Z6+yX7lUaAeWvp9kWuGMfv93/ZFNXe1rmInAX8UOuwo8p+K1DUYcD/ugva2DR0sZETIM6MX2OyBAVsi+dXBFmTwCux7dj4Sx2e5 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:Z+857aIkcD5Dpvh5qwuQSCdtpYxsy63hAQFduHue2bj8rI8e3UEcgMhD5vzLbdoN8LnAOkhkm9nAVfStRUUcSy9z9rmdoo1TNevgC8+tvsj9B9XM8ymG8MId+dquPzqX9HS7ldRpMqwEpXJHMzR7U9eglsQmPgN20qtg4/mTS0O6AC6GknSZC4w5BBumBlpq72CV4W+HTX20h6TePR4VPmJRLhxxvRgnGqIZr+qRXpVMqYt6qD90KbPqLVVy2oDBvuXbk3YQyvB5xhJTMMonOFSS96QYldeYG+ZlO3cKHpnz8QIUzvdd0mu0cPml8Cm3dAkXDzN1D6BGsM+wNb2ExUOFQdE9jzR2po/dPi9X69I/hbJIPj3hJQtRhZ5LFpYaHh2SvT+NBwboL58Mp6G9rbtF08gD6LZdk9Bv8URJhXh7NF+PG6rCFO9rBUpLLc55EXhOXQz2MnC1F79PbzPfSHS31U1QreCYfEgO+5iPPSyzqXUggbjglfQ00rDWK5kUgKr4v+k0OpGD9zo2ukE/XeVkjnUaGbVw4oc9PiAycQ14oF4bf/5hZ6ip3HYUOG6au1RrS3Uo+TwHwJUAKuFYz9ccl92gGdkuaiCZCJ6gU+z57FD79eTk7JAJtM6ReMqIJ0+rXGGP1qqV3aloCztRsKwjr1MJTmr9IZtyMezWXpcJdTpigEhEjH+jxiCP+6Pm2sv1ztJ+uyArz7SZccn++j1p3UnBx/kSOXU5uX4Mu0s7H1pKI7hEJHLLT2PtaAR7DWIDsbyz+1EeGo2icavefWbW4sPrKRw358lIfyR6K3y0dAxV2PlpuA0VfpnSCFzdLBREldt/m8uZpXBK0MZAUL9359i0s37ZOcVu1PW5s4OLFZnrKgl7O4jgcy2nBlECC6nMuCfRXMZKBWnIRUtz37C5g5464U9kCxN/eUM846if8wdLuI3K9icf9RcS91QC7bQCSTLNW/Z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s017EO2sP7SSFP569gTO1+HkijFr7pX6MPASy0cmYxJGpcDk0xe6KgkACZv/NU6hfNl8qYrbJn3wy2ElcUQh0kleZd3Y474BmLbK8s5ACw3L2y8swxL92QjKvmTEhA==;5:2E81CdEIV+NPvycgrMbtiQskxxq2ZwNKYU33WzswYwfaYZxrNe+h6pBhEEGuodPNAtn0bxE7gXFN0btnb8rtq3PQgtgxcRc2LE1KPxpFGmRq3ldKtwu2oWms1k+dmhu4TMjPnF7vDG20zM3MG3FB4TsXH84Eb/mOrelvjMCBz1o=;7:oiWwYKbjanTXOa10wbrPrBjAJ8FeWHXSXGEtw1Q7wK83UYFoDkbutOeslgm5SkOJOaumUkyCGZUZBZwN2ZmMIFtqPa+hEnghEF/PLh9GcroR/w8K/m7QavWlQ7/quxTsjXfLStIqXAem3zNr2dtTKhGUKU/Cn1dELd8IjKV7F6WtqMJB2g7DajEkNineru1FmcqiZy9cJAfM1v4530hmtqJUNEhSWHJUO3UVEPW8+sz6wHf40eoiXsrsQ/BL14XG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 01:50:37.0766 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89a88948-3ae8-4527-2876-08d61f64a1b7 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 xhci_configure_endpoint may be timeout. To get rid of timeout, we'd better return before issue command. The related log message when removing HCD like below: [66.736633] usb 3-1: USB disconnect, device number 2 [66.737003] hub 3-1:1.0: hub_ext_port_status failed (err = -71) [66.737054] usb 3-1.1: USB disconnect, device number 3 [66.759910] xhci-hcd xhci-hcd.1.auto: remove, state 4 [66.765043] usb usb4: USB disconnect, device number 1 [66.770169] usb 4-1: USB disconnect, device number 2 [74.008294] xhci-hcd xhci-hcd.1.auto: Timeout while waiting for configure endpoint command [74.018737] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered [74.024446] xhci-hcd xhci-hcd.1.auto: remove, state 1 [74.029594] usb usb3: USB disconnect, device number 1 [74.062310] 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 0420eefa647a..3113938063fd 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -2698,7 +2698,8 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, spin_lock_irqsave(&xhci->lock, flags); - if (xhci->xhc_state & XHCI_STATE_DYING) { + if (xhci->xhc_state & XHCI_STATE_DYING || + xhci->xhc_state & XHCI_STATE_REMOVING) { spin_unlock_irqrestore(&xhci->lock, flags); return -ESHUTDOWN; } 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:XssefBXFjS+Nu/J/EceP9NwKfFFEd8ALUQZf2Ag+dHYv0Nmj5F+GAMShTz61hI5lMagGVXR/9uAOALS1oCND1IaZ+5nDb6QZ41IpVWHCepIYi20r/B1Hwpb0n71Hu/spuZnk3yLPk0pvjHmX5bllR8grR+EA1yzqZNWcSFUT7Csszb/TD+Nzr0hXVJXT0HgKcE8apiVRV4lTEgOVPgFp5NYixBuIGBJqbgBCpH8V+MXsRhsDe1yEEEcRewMHzWbW;25:DkVIAYkVbO3H/q7FWyb6+FpEIQKY58Gt2Lx8rOEzvREl9bTSVSrHgVsOk05Ce4s9BO9cyuzPh0hGjgrU2nyKK0bNd1PL+FgbtV+jh0zw1XhkZrKGtr2Z1P/7Jh1cckzSWJbzsvuuYcAww4BFhdt5sLVXoU8sGH83yxEV5uiBnlU5d4mlPkSKgC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/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: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GvQqnnf8R23sWRbVMCQ==;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;