From patchwork Tue Feb 27 10:41:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 129759 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1237472lja; Tue, 27 Feb 2018 02:41:53 -0800 (PST) X-Google-Smtp-Source: AH8x227v1in1CqLAzIGcHJEDo1jNq2pWJQfjP9RzzYJ5FXJ3/e6GAH5STSKRwJirRE/UYPl7zqu+ X-Received: by 2002:a17:902:a616:: with SMTP id u22-v6mr13564384plq.211.1519728113640; Tue, 27 Feb 2018 02:41:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519728113; cv=none; d=google.com; s=arc-20160816; b=0JWnQHpgCDMubZsVkMXS3nmvx8WG2dXFMgX9Ho+HyBIndaTugP6HyxqY/d5qYo56PZ xLGYdu+7cfufePtGD8GQd4mcw6X+Ujeu5K+97sFI5pTW4fDTok6/h09W+nm4bCjaa5TK 7LnfHfz85xyx7oCHc9tYknXLeGta0kAO//+2a3lwxiNGbWw5+IzJtNGKheE71rezsmPy qq+GfQfIymbYsMyWZhmB5f9oNGvSaiAB18n1AzFv4BQFxz2NWmyuP74M7k84HZf/nYr5 qaOIAGrnYdBdf5ZFOmV6M09mmjV3RVV6+XEa16/1RV2OxDxGVWL8y6jgpkrIqd6ln7cA SnLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=+j4bfFqKYWSwB7GFXIHNd2WGI+svyzWHlj3yVJCvYo0=; b=TOP3G3JWf8ATS+0nDFH5k/CGh6tW6eTSt8kRA09VjKPbbqJxTFo/a7AT63EVQjK96A 7yX/bSNKcE6z7RpJ4tg3qdH/LpnRf9l9zDcy3iX36MPiLgdrgsyEjIO8GL/I3dNd4T0c ON6OrN0Xasmzy1kh/MLSRKzDOviixb9kkBCKC+fCx32zFB3drljdNpD1DulDS8yy0w4S 3kojQTdcAF/JA71dZWLKyeeH+yyrMSlgpP+h+jGrLQsvGIxf9wYkx/PzpdyKXks5nKud 8w0hrH1uVltIyncAbzHTdAjqCiip9/w1en70L76KiClu48R3UJGFQpldQw7whz6mpBhS urkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=l4PaEu/n; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b128si6852738pgc.220.2018.02.27.02.41.53; Tue, 27 Feb 2018 02:41:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=l4PaEu/n; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752680AbeB0Klw (ORCPT + 10 others); Tue, 27 Feb 2018 05:41:52 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:9077 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752676AbeB0Klv (ORCPT ); Tue, 27 Feb 2018 05:41:51 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1RAfkqe027963; Tue, 27 Feb 2018 04:41:46 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519728106; bh=rDkrqpbe2UgiQCK9UEGmKzCxlzTFxv+v/RET85k0Db8=; h=From:To:CC:Subject:Date; b=l4PaEu/nRhYiRzk/wlyvd3YiWcTnYeoAJt9cjtiXnguZvchJR542Wg21l9E5mQRPV 6XK2pgm/UecAL3subucJpSVoB8MKLR5nxdJtaMhQcMP/j64ru2Y4lYEcL7RZx471zR WUO+nptlu4hmWF6tPBxl8ljgTO/IOMc7EJCmXoXE= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RAfkjT005325; Tue, 27 Feb 2018 04:41:46 -0600 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 27 Feb 2018 04:41:46 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Tue, 27 Feb 2018 04:41:46 -0600 Received: from dlelxv97.itg.ti.com (dlelxv97.itg.ti.com [172.17.2.193]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RAfk0d014015; Tue, 27 Feb 2018 04:41:46 -0600 Received: from lta0400828d.ti.com (vboxa0400828d.emea.dhcp.ti.com [172.22.233.227]) by dlelxv97.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RAfiok018995; Tue, 27 Feb 2018 04:41:44 -0600 From: Roger Quadros To: CC: , , , , Roger Quadros , "# v4 . 12+" Subject: [PATCH] usb: dwc3: Fix lock-up on ID change during system suspend/resume Date: Tue, 27 Feb 2018 12:41:41 +0200 Message-ID: <1519728101-15324-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org To reproduce the lock up do the following - connect otg host adapter and a USB device to the dual-role port so that it is in host mode. - suspend to mem. - disconnect otg adapter. - resume the system. If we call dwc3_host_exit() before tasks are thawed xhci_plat_remove() seems to lock up at the second usb_remove_hcd() call. To work around this we queue the _dwc3_set_mode() work on the system_freezable_wq. Fixes: 41ce1456e1db ("usb: dwc3: core: make dwc3_set_mode() work properly") Cc: # v4.12+ Suggested-by: Manu Gautam Signed-off-by: Roger Quadros --- drivers/usb/dwc3/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- cheers, -roger Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index f1d838a..e94bf91 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -175,7 +175,7 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode) dwc->desired_dr_role = mode; spin_unlock_irqrestore(&dwc->lock, flags); - queue_work(system_power_efficient_wq, &dwc->drd_work); + queue_work(system_freezable_wq, &dwc->drd_work); } u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type)