From patchwork Fri Dec 23 03:01:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Cherian X-Patchwork-Id: 9487181 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6BAAA601C0 for ; Fri, 23 Dec 2016 03:33:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B2B227D5E for ; Fri, 23 Dec 2016 03:33:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D19B27F54; Fri, 23 Dec 2016 03:33:42 +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=-1.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=no 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 643E827D5E for ; Fri, 23 Dec 2016 03:33:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758067AbcLWDdj (ORCPT ); Thu, 22 Dec 2016 22:33:39 -0500 Received: from mail-sn1nam01on0067.outbound.protection.outlook.com ([104.47.32.67]:45837 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751097AbcLWDdh (ORCPT ); Thu, 22 Dec 2016 22:33:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jBhFJJfLSaMv3KHgUIkw7c0TPU1P9o2T8rilTgEAkVY=; b=XDDUpAQm3ZgfxleGWOWJr3P90cr9YkAdy9oJxFEjStqwKLRXynxERjMaHdur9Vq1Sqhfu72gkgco4gHc85SXDwySZEVRXypwPQgEW39Nrey6WPmrvxsRZ8EIJu4e5NbqRBgwVcYZAIuiAIArEwnRH5regVN7VazQazxW078FG5k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=George.Cherian@cavium.com; Received: from [10.160.0.37] (111.93.218.67) by BN3PR0701MB1704.namprd07.prod.outlook.com (10.163.39.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Fri, 23 Dec 2016 03:02:13 +0000 Subject: Re: JMS56x not working reliably with uas driver To: Alan Stern References: CC: , , , From: George Cherian Message-ID: <64608b5d-e90f-3839-eb80-7e3cd042a887@caviumnetworks.com> Date: Fri, 23 Dec 2016 08:31:53 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0032.INDPRD01.PROD.OUTLOOK.COM (10.164.117.39) To BN3PR0701MB1704.namprd07.prod.outlook.com (10.163.39.158) X-MS-Office365-Filtering-Correlation-Id: a448cee9-01f9-49dd-4286-08d42ae01a01 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0701MB1704; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1704; 3:fHHivoanZZCS3rdrczLNexxD0HhALXTjsuMrh4vGj0PatALRnWTPhf+BVTLZvD7su8Paeychz7/cT+PRbOjWOzQ6KrxKDwj2Aoa6+Jis/YvQRd3Zg5aZc7IY04HjKAfA68MWJH2KLhRu/kUfVvoFMaBQbInFn4wlX4LFiz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TyHOzPG1TUI1xnTeAp51oXRNEDP1GMlgH7ikAgPLiayDLXp761XeU7rm2oPer6gNddftF+7C0NK7l0EQdQzRp+oCB3SFpFJTPdxikXhJIaPQhuOqL+CAo0mp6tyNyjK5520mXPX6H5zEI+Pyst9YPXkx8gnXHy9PGHLteOPivPqGnbKeBTAC+sTsmd8UmEXm4dqIkOYLc8d/rWr2yuXFjT3xMM4cSsxZV7SXgYEhNE4tCIn5K+G0Ku0RCd1i7rk2fGaAsgYPOIqiGeCztqB6CAZiFy8ZPDTtDTdWlwkdB1sZ4yQol2nahHc1PyxuH8JjoN9P8qygnH5+KtTgctRecrnb0ro+o0M/9I44XPuEk/akC3wG6pfD8ZXWriPvx2WzsL7bLj3EpZ980shTch3w2UTY3UtBLjfBo2kpY+YQVHU8kePP+WeHqr+yMODrWD3Hbo+SzJaFC5WF+Zb9ursO/3aZOdwevmg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123558021)(20161123562025)(20161123555025)(20161123560025)(20161123564025)(6072148); SRVR:BN3PR0701MB1704; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1704; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1704; 4:NNmaNF9bMtKfeUIojlDwLEDM9Gl9gQ11dstaLTpuq4hFycysoYWsGTPbyaHrWMw0xLmKSB7g84OYFa9+LwM0xk1UOYDq5SDIwjVoyEQFM+egt2bANy5O+TtpUKOmxj5mICJydiezvHiQzho6JwChbpBGmu6e1yadcOivCb18FiJlckJsumtWVWMLokCi0TO/OTSPeKcnDpMZTfqr1YGIbnZ3TCVy+Ed1lHgj/TsThDppexoHj74DbcJI8yueeTjTa8WbgGlVQ+s/PufmHtsXPMpCcP0V7vf9NpUflp7sJUeCZNiQoF06SLqx41eBY5tm9jh/nAMm95S2BDBA6siudeKZTmSOcuSN+winHsK1EWQ/C7knbbUDTjC7xpAR3yBUoYe4AHxbNfLV0Bzlwul6U0vGZ0EYuIya0esiskgNe9SD4grSifjoHCGSunyFaMyxOoCGt+aKsbj1oimRPsUhbzXcjDt1pnWcUQNxaA5NuXMe36psO3xqfAmBVby+X9Wc7PQjzolxZ5y3i6arIyBfUT58It360Zhjapq5T6sSjEFx9P5Y184dX7SPh41rFwsDb1p6lK6nLByB+whZdvtaZP14gchXJ2V/V1pkUTpgm9HP94ks6/2fKXqpDF/yOWC7uugsYBxOTnSDhEq51Rtcbw== X-Forefront-PRVS: 016572D96D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(39450400003)(189002)(24454002)(199003)(377454003)(64126003)(4326007)(66066001)(65806001)(50466002)(65956001)(6486002)(4001350100001)(36756003)(97736004)(92566002)(6916009)(83506001)(77096006)(2950100002)(101416001)(42882006)(6666003)(2906002)(2171001)(5660300001)(229853002)(38730400001)(25786008)(90366009)(31686004)(7736002)(305945005)(65826007)(68736007)(230700001)(42186005)(50986999)(106356001)(54356999)(76176999)(110136003)(33646002)(31696002)(189998001)(47776003)(3846002)(6116002)(5009440100003)(81156014)(81166006)(105586002)(8676002)(23746002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1704; H:[10.160.0.37]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; BN3PR0701MB1704; 23:Sbjvf2F88izEvus5Y77Nx2IFNxx3RNENUGp?= =?Windows-1252?Q?t58/XAkLMuUgGzw3fWSoSrLtMSMFyf7Fw7q8UWUay0KX/ik86+bPrpPi?= =?Windows-1252?Q?xjizv+rryPLwkcDs6U233UUQ0aCQByO5JY04SxRNdndI1So/XhjQE8JS?= =?Windows-1252?Q?ZEvQdGg+gQhPdLTrcum2O2hmA9bGE4cwDQ3chX6NjsrmaC5Qjt8au16m?= =?Windows-1252?Q?bBoRaIhOSLWKgg6tYocpJht9GFVOSJNbywRBXH3tx5MbCDtFaSJyanjq?= =?Windows-1252?Q?vhxkknohDbJ5yzfWw89ILl/jo3LLO6b7jG61R7QtCx6vde8tzZ1wCFMI?= =?Windows-1252?Q?eXDq6X0CcVN876921zWiYIDgusPwTyqqIjnRe6kcgROAUVhdE8YfMi4U?= =?Windows-1252?Q?SoPMZrz9XhskpNHuK/va23FB29bgtlI1M8JKGGfV+MSLvXEtKkKBbTZX?= =?Windows-1252?Q?+U750JRWGtCzqm6oKj7xolT67ISv8MTZx37ZW+MKHGIT0T9kXtIodi31?= =?Windows-1252?Q?vAMJ3yPAXmfKazEoIfP2sEmmmllKmQYb74w7QODyNlMSGnX6/wzAdTZr?= =?Windows-1252?Q?b/z6ab8cUgATLYnFqtVvxFgiGcjfV/NbCIkT7UI2Wdrj1PSrEdyOsY91?= =?Windows-1252?Q?B0tooGky1EZaXGT+Gv6D3gbBmjSQdYz3qzUUClq6VRkG9bxfMz6hWUnM?= =?Windows-1252?Q?0znW4zRkitQegh2cpycjSLB7W6NPJ7kIDVmxIf1/rKDFPacuGF2N3mvA?= =?Windows-1252?Q?vIgtnC7Vzb1Zo/PrGM49tA9egXOMe4h9JyMnrjvSBkR9JK85HCSp2pYJ?= =?Windows-1252?Q?hzk6dskyY2jxt3+Rm0+uYKiDiTseYuV+l6eahc0Z+Qr3Wv2qBjlk+WqD?= =?Windows-1252?Q?G1NqmKoc/Rbltz9D9PzhANPOtz6gep+5IT4AcvbhZK5WIAObgbQnfh1u?= =?Windows-1252?Q?iXgYEmJx372RQ23WJsCvEwd2uy1Sg7hDodKVurMmvILrVCdXfBzJ5DdA?= =?Windows-1252?Q?2VdEzqmI5WjdxV9F7RYIBK+jn7r5sujwOR5HopJSIzy2vpJECbOWy404?= =?Windows-1252?Q?ikeJZe5X6R5XwZ6A5i1V2CEjdrZjYD1dewWxZI8V9BVfN4IChywFl06L?= =?Windows-1252?Q?wlB6bPcBRsUYgwTjcV+CAOBVhv0+1ZqxtZX6wWpGSP7HRjG968bCkrWi?= =?Windows-1252?Q?Xq6BEDpBSpWfFlKKfcT+1RqDlZG/t3SXvij26D+VJQhMZDCXi9P2zzjX?= =?Windows-1252?Q?ws8lmnvkyVPGXHC0Vya8m7ShR/WmJ4z/r1j2qw7ccJvS/3n81EaWe1tu?= =?Windows-1252?Q?KLIrfS0tntyU43re9MsyHojISGp4+Rm95EURzUkxtqZM6oDiNNS3ggy2?= =?Windows-1252?Q?O9zfvjCWW/YaTW+XVoCeUC2g4qwAPWnikc+m01gRbYO8ATTDCzBtCbUC?= =?Windows-1252?Q?fVdV6Iq21E3uvexCO9ILzO6XuWnyijPz9mr+aJmSx7YD1Wi8eheiBL9R?= =?Windows-1252?Q?xGPcaU60oLKFkIQ8zEnT3Z8VFeDH92YxawP01dDxt9fEP/+NLZA=3D?= =?Windows-1252?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1704; 6:dsiO6CVoKHTbJXhvdp+1GWlZsfqX3V+O1XpuESJiC19/Ytd0HiaROFDBZS1XX5SjEocnZotF53D2PJsn2Xk4zAYTBQVKXXHekG0/y+Mo8TTovZlPH5035mCSxMz3b08us3x4KF6JmANdq5d4huCWsk6os9k45uo1dU5bgK4yvkE8prl4A+kN02kmo5xmq6az4niMYEqfvn6M+iaO80TEWafBfuBBAJY6eauGUeTCozNtLA6wdEvam13AxdwEXNrNKFSBORO+7aJHwUQcmorK2uypzCg9F4FkRODx1Rv7ZCtMdK4vlQl3JU+6RYDlNdsooPv0XhjG8uSiSD5PktP0f1P/OaCIRGxZc7AMD52Od1F8CxKc+ZZo0rpC1xORgpQsVjb25OxoIZB4ZU9AkGRE6QYzFVv9feVu3bWeRB348E0=; 5:Ohfm24fOrCRXcEnCjx+qGMNaS7bGsziYas0zv6jfeTyPKyMha3bZ+1q8p6Ie3lUtcKrhg6mcg19rN1ZqhoG0JAC65MQ+RBff1ps4NIcI9cxxHj+xbC8bY25/CpfO7WDqB1iTw4iRgE3o7ukg81XuJw==; 24:R5ivGC4BcuPb3KQ+1d8vF8tQgW2QtCpPiehcjvdAMn8BjY7HVQ61I57KQpJGzaDoL8Baqqa0W90dv04LW9Ll8d4saIUHNafM97VJLobf+qo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1704; 7:A0soyZnKXWB6+Gvd947/eH1xanKCSUyz2jmxBcgIkJKuDs7Uj2I8bkWjIniileVvA5vBcUSSgNTULPpE909QRQ4whT1zdiU/kwsPUxsXqPHsqfbgdGpY1tNPJvJed9f5ZZADFn4ALtp+NtU7ZxBI3QJYG2cYEmSaiuTvfhOwDGlUH30+FyYLRk+HkBrtr5FjIcC3px+7XOAvU+BJFiEbjwig2IgD+8R8GuJSwm69G9zYqZmApvHOdlQNTUUdTxr8e9hOtwSyAUpchw/aO6fpRasESgblh9rDzDLDF335NkMyAy5j7dtVJVBeOu6DXSa72KS9Md0GXTRRK3NhGdyat0nIPRzkLQFQUdVzcUoXvgC+P8bG5UdLr+QMhZCwx4+Z0Y6x64tYAuWPfMJep8a1CIl8+lS9iHzVOXUmT8r+rMD0jMawNqk++0MaHUalelkBVhDk62aFveW594pCwEVrpw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2016 03:02:13.1878 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1704 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Alan, On Friday 23 December 2016 04:14 AM, Alan Stern wrote: > On Wed, 21 Dec 2016, George Cherian wrote: > >> Hi Oliver, >> >> I was working with this JMicron device and using the uas driver. >> I am seeing the following 2 issues. >> >> 1) On connect I see the following messages. >> xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or >> incorrect stream ring >> This was eliminated using the following scissor patch. >> >> ---------------------------------8<------------------------------------ >> [PATCH] usb: storage: unusual_uas: Add JMicron JMS56x to unusual device >> >> This device gives the following error on detection. >> xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or >> incorrect stream ring >> >> The same error is not seen when it is added to unusual_device >> list with US_FL_NO_REPORT_OPCODES passed. >> >> Signed-off-by: George Cherian >> --- >> drivers/usb/storage/unusual_uas.h | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/drivers/usb/storage/unusual_uas.h >> b/drivers/usb/storage/unusual_uas.h >> index cbea9f3..d292299 100644 >> --- a/drivers/usb/storage/unusual_uas.h >> +++ b/drivers/usb/storage/unusual_uas.h >> @@ -142,6 +142,13 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, >> USB_SC_DEVICE, USB_PR_DEVICE, NULL, >> US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES), >> >> +/* Reported-by George Cherian */ >> +UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x9999, >> + "JMicron", >> + "JMS56x", >> + USB_SC_DEVICE, USB_PR_DEVICE, NULL, >> + US_FL_NO_REPORT_OPCODES), >> + >> /* Reported-by: Hans de Goede */ >> UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, >> "VIA", >> --------------------------------->8------------------------------------ > I don't see how this patch fixes anything. Unless I'm mistaken, it > just avoids the problem by preventing the system from issuing the > command that provokes the error, rather than really fixing the > underlying error. > >> 2) On disconnect I am seeing the following issue >> >> scsi host4: uas_post_reset: alloc streams error -19 after reset >> sd 4:0:0:0: [sdb] Synchronizing SCSI cache >> >> This is more fatal because after these messages the USB port becomes >> unusable. Even an lsusb invocation hangs for ever. > This problem looks pretty simple. uas doesn't check properly to see if > the device was disconnected following a reset. > > Try changing the line in uas_post_reset() that says: > > if (devinfo->shutdown) > > to: > > if (devinfo->shutdown || > devinfo->udev->state == USB_STATE_NOTATTACHED) Yes this works for me but with a little bit change as follows, But am not sure whether we should goto reset_scsi in case of shutdown. Please advice. if (err) { @@ -1083,6 +1083,7 @@ static int uas_post_reset(struct usb_interface *intf) return 1; } +reset_scsi: spin_lock_irqsave(shost->host_lock, flags); scsi_report_bus_reset(shost, 0); spin_unlock_irqrestore(shost->host_lock, flags); > Alan Stern > --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 5ef014b..24db3fd 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -1072,8 +1072,8 @@ static int uas_post_reset(struct usb_interface *intf) unsigned long flags; int err; - if (devinfo->shutdown) - return 0; + if (devinfo->shutdown || devinfo->udev->state == USB_STATE_NOTATTACHED) + goto reset_scsi; err = uas_configure_endpoints(devinfo);