Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2322789imm; Thu, 7 Jun 2018 08:46:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKitfG/1o0g8l39sv/0Rt+5gxDJiI6MrKQV+WERUpd7cgPAP+CcVFIgLKHRWzDB+4P6SNyO X-Received: by 2002:a17:902:145:: with SMTP id 63-v6mr2595933plb.332.1528386389285; Thu, 07 Jun 2018 08:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528386389; cv=none; d=google.com; s=arc-20160816; b=HTsCrWIIRZZH+3EQWjgIJJdzjsqVLItayYv/NNCC2Dm9qI5iyU1VRu2TXpJVrniuVo cg9/J1WEo32uE1POgpcSNcCx903mcFUsmjFT34kpYvgIQt5AxDtFpN6jgm+mzx2ZRRXX wYwBcxppyjh4tUGh+Ieyb8nG9CZXg52PDOu73LYF0QfWp6nhP+rg250RJpnHApeauPF7 xJG7nLr9hHwyWK4fKED/f3YiBd5xeNwdq6zztBEbPF5dtUwmemNp8tSUzCdyX6vNoFpl LWZNg0noFN1W1HVsmc1Tbullk+C9zE73U0aca5l39W/uZWbuDvz4Xpn5+kVoQZye/Z46 gk3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=dzD9r8EVlaTVKyB+l26Gp3nk+5hAFIHsBiXQyAoQsaE=; b=VGRF48itsrKryF6WHwmCxQ29q+Ty1yZ1On5DL/rbCkMQdJpytOM+Tkqzz+HhT6+PJR eg59tgxVp1+yRCtyNIqFizomBweGdLDaTHtBScxGnU+cZ+sURa4fhV7FWH/Q9tQqvn0E w083jjd7Hek8u6Z2EtUvQgrVJHtguXXHVXNw75guCpr9H/irdLMh+zH9CEcMLJKpTAQu 6PmLWK9IUKA7wo+/uFnv1eEmWsksfiqKtDUVXNV3AQbXbHxTCbPi4oyNkrzWW5VkGDkQ lm3egLEa1zIMTIgMYNaBRMMXNB1wXgziVQa/m8yFURP0m32JsWvVhu5SdSZCUT29Nbzc KG3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si16558044pgu.626.2018.06.07.08.46.14; Thu, 07 Jun 2018 08:46:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934754AbeFGPo7 (ORCPT + 99 others); Thu, 7 Jun 2018 11:44:59 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40557 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934505AbeFGOkh (ORCPT ); Thu, 7 Jun 2018 10:40:37 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbT-0005Zv-Kr; Thu, 07 Jun 2018 15:09:28 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbB-0003Br-Oj; Thu, 07 Jun 2018 15:09:09 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Greg Kroah-Hartman" , "Danilo Krummrich" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 327/410] usb: quirks: add control message delay for 1b1c:1b20 In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Danilo Krummrich commit cb88a0588717ba6c756cb5972d75766b273a6817 upstream. Corsair Strafe RGB keyboard does not respond to usb control messages sometimes and hence generates timeouts. Commit de3af5bf259d ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard") tried to fix those timeouts by adding USB_QUIRK_DELAY_INIT. Unfortunately, even with this quirk timeouts of usb_control_msg() can still be seen, but with a lower frequency (approx. 1 out of 15): [ 29.103520] usb 1-8: string descriptor 0 read error: -110 [ 34.363097] usb 1-8: can't set config #1, error -110 Adding further delays to different locations where usb control messages are issued just moves the timeouts to other locations, e.g.: [ 35.400533] usbhid 1-8:1.0: can't add hid device: -110 [ 35.401014] usbhid: probe of 1-8:1.0 failed with error -110 The only way to reliably avoid those issues is having a pause after each usb control message. In approx. 200 boot cycles no more timeouts were seen. Addionaly, keep USB_QUIRK_DELAY_INIT as it turned out to be necessary to have the delay in hub_port_connect() after hub_port_init(). The overall boot time seems not to be influenced by these additional delays, even on fast machines and lightweight distributions. Fixes: de3af5bf259d ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard") Signed-off-by: Danilo Krummrich Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/usb/core/message.c | 4 ++++ drivers/usb/core/quirks.c | 3 ++- include/linux/usb/quirks.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -147,6 +147,10 @@ int usb_control_msg(struct usb_device *d ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout); + /* Linger a bit, prior to the next control message. */ + if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG) + msleep(200); + kfree(dr); return ret; --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -226,7 +226,8 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, /* Corsair Strafe RGB */ - { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | + USB_QUIRK_DELAY_CTRL_MSG }, /* Corsair K70 LUX */ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h @@ -56,4 +56,7 @@ */ #define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL BIT(11) +/* Device needs a pause after every control message. */ +#define USB_QUIRK_DELAY_CTRL_MSG BIT(13) + #endif /* __LINUX_USB_QUIRKS_H */