Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3289177rdg; Tue, 17 Oct 2023 09:54:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9LrcAeqJsLouEXzv9urrpZ4GU7wNRDNv3EUuL1z3cwPJeZhWpupATjteuQ0e+glfyK58l X-Received: by 2002:a17:903:78f:b0:1ca:86db:1d31 with SMTP id kn15-20020a170903078f00b001ca86db1d31mr2222785plb.7.1697561643467; Tue, 17 Oct 2023 09:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697561643; cv=none; d=google.com; s=arc-20160816; b=dPUQSDDbSfCAtC+SM4BwEl7EAb1cXlp9M0uyUhM5M2gweA4P/jvFaYsIzUQ5lCi98o HomxscDG97dY4tjgxv7v7xWYL6eMVdwoZPp6/NFCWIT4p+oNaEd7Bep8idP7C4A6BevM C4jmX4KygGZmCLPAlJOqeDQ3bx84e4LGywjdtc6gz7sHc4nFd7jp8hRHobf7x2Om60Ni aRrIKZJlIc6sGzwrJfXq67RzhZkH1heQwnBHOUEHX+WWlJ8E+d+2Ulh7h1r1sVRZTJYe IB/d6kuUAoXZU+Ausxmzfq6qT5rvcvzHqAQVDWVpahiYYnHtP+Vl2pd7zsF2R8YYbvSu 2cIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=poTUd+C7IM37B8jj1BqwazHG+NmJaej216SCH8EdUAo=; fh=qTlv9Yjxx31H/uPR2d9ZJGU+ALzAsNEjMqin+ZX5afM=; b=Y/keR4Aqc40OLTS3uP/Ts/MwXzjXc6s1GYEXxm6033UZt6fE/5FmJFMd2zR7rU2ded oUOazvW+K/ZN0zEmStM2r2exdbjgkMtC59uCQIpMmE4y6uuZfjZmFC1nL98VjuX7bi82 28j5+3zfjHMQQdicxYkQwl0sthXHP+WPQUQzA3L4fVl3dLtNYONhizAdYgghvvOXAwGE vInRhxKCkbeb0/yKxvNawkval0wRv0aE6FEav1hC0GzqjgaRppWwh6BEWjoI92HYAB7+ vKdV+Ma50jcIpGcpKOj0+lWLm1IE6F6M5aTUYcudMYF0M/n4wi+JGyOVcL/QwHZNlFDi +GEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FG1JVZVp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id u14-20020a170902e5ce00b001c9c8109692si2032600plf.537.2023.10.17.09.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 09:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FG1JVZVp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5F09880B28AE; Tue, 17 Oct 2023 09:54:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233940AbjJQQxw (ORCPT + 99 others); Tue, 17 Oct 2023 12:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjJQQxv (ORCPT ); Tue, 17 Oct 2023 12:53:51 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B158AA4 for ; Tue, 17 Oct 2023 09:53:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4992C433C8; Tue, 17 Oct 2023 16:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697561629; bh=RaxBlkhFIAhkajhxqmNdE/U+qglufyW+ULA5w+v6mjY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FG1JVZVpP5/zwJo5CdV5HOxHvYr04WcncrOGr4hTj4kgiEST2DY1tBTadV1RxMEkk xK0mOVf4AVhzgzucqPfRtfn48nwQlZGw/FafdxprnSoeYgQAmoGm7Jk19tnywMQUB/ x7oXDLIv6nWU6G5O2Pyjx9lmoAFTdrTt4YAunkJk= Date: Tue, 17 Oct 2023 18:53:44 +0200 From: Greg KH To: Hardik Gajjar Cc: mathias.nyman@intel.com, stern@rowland.harvard.edu, yangyingliang@huawei.com, jinpu.wang@ionos.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, erosca@de.adit-jv.com Subject: Re: [PATCH v4] usb: core: hub: Add quirks for reducing device address timeout Message-ID: <2023101750-bless-humorous-45c7@gregkh> References: <2023101155-unframed-satirical-f7ec@gregkh> <20231011164525.97616-1-hgajjar@de.adit-jv.com> <2023101620-shaky-sensitize-9708@gregkh> <20231017161021.GA62775@vmlxhi-118.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231017161021.GA62775@vmlxhi-118.adit-jv.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 17 Oct 2023 09:54:00 -0700 (PDT) On Tue, Oct 17, 2023 at 06:10:21PM +0200, Hardik Gajjar wrote: > On Mon, Oct 16, 2023 at 07:58:36PM +0200, Greg KH wrote: > > On Wed, Oct 11, 2023 at 06:45:25PM +0200, Hardik Gajjar wrote: > > > Currently, the timeout for the set address command is fixed at > > > 5 seconds in the xhci driver. This means the host waits up to 5 > > > seconds to receive a response for the set_address command from > > > the device. > > > > > > In the automotive context, most smartphone enumerations, including > > > screen projection, should ideally complete within 3 seconds. > > > > "should" according to whom? That goes against the USB specification, so > > why not take it up with them? > We're implementing this change to meet Google's Android Auto certification > requirements, even though these requirements aren't publicly available. Then perhaps Google needs to talk about this somewhere if they are forcing us to take such an out-of-spec requirement? > The issue arises when we connect an Android phone to a Linux host using a special > automotive USB hub. The host's xHCI doesn't receive a response from the hub after > sending a 'set_address' request, resulting in a timeout. This problem is specific > to one phone model. > > It's worth noting that we can't argue that this requirement violates USB standards > because the 3-second time limit applies only when connecting an Android mobile phone. > I assume that Android phones also undergo Google certification, which likely includes > a condition for successful enumeration within a specified time frame. However, I can't confirm this. Android's CTS/VTS testing is pretty public, but huge, so you might want to dig into that and see if they really test for this or not. > More logs and detailed in patch V1: > https://lore.kernel.org/linux-usb/20230818092353.124658-1-hgajjar@de.adit-jv.com/T/#m452ec9dad94e8181fdb050cd29483dd89437f7c1 > > > > > Achieving this is impossible in scenarios where the set_address is > > > not successful and waits for a timeout. > > > > Agreed, broken hardware is a pain, but if your device is allowed to take > > longer, it can, and will, so you have to support that. > > > The problem is not caused by the device taking an extended amount of time to > process the 'set_address' request. Instead, the issue lies in the absence of > any activity on the upstream bus until a timeout occurs. So, a broken device. Why are you then adding the hub to the quirk list and not the broken device? We are used to adding broken devices to qurik lists all the time, this shouldn't be new. > This situation arises when the host has already transmitted the 'set_address' command to the hub, > assuming that the device operates at full speed. However, the device connected > to the hub undergoes a state change from full speed to high-speed during this process. During which process? While the set-address happens? That feels like a hub bug then. > > > The shortened address device timeout quirks provide the flexibility > > > to align with a 3-second time limit in the event of errors. > > > By swiftly triggering a failure response and swiftly initiating > > > retry procedures, these quirks ensure efficient and rapid recovery, > > > particularly in automotive contexts where rapid smartphone enumeration > > > and screen projection are vital. > > > > Screen projection is a requirement that you should not be relying on USB > > for as USB has a different set of required timeouts, right? This sounds > > like a bad hardware design, if not an impossible one. > > > > Screen projection for us means displaying the connected phone on the screen and > launching Carplay and Android Auto for the user. This works perfectly in nearly all > cases, except in scenarios like this one where a combination of a special hub and > a specific phone model is causing the issue So which is broken, the hub or phone? > > So the real issue that you have here is a broken built-in USB hub that > > does not error out quick enough, right? Why not fix the firmware in > > that hub as you know it's broken? Why is it the operating system's job > > to work around non-compliant devices? > > > > Ok, that last question was redundant, of course it's our job to work > > around broken devices, but this feels different. You are trying to say > > "hey, I know this device is broken, so error out quick so we can just > > ignore it", right? If so, why not just never allow that device to > > enumerate at all? You don't have to accept it as a valid device to the > > system (just don't authorize it), and then no device will ever connect > > to it so what is the delay issue? > > > > We require the device (HUB) as it is a vital component of our infotainment system. Great, then you can fix the firmware in it! > The issue arises when the host has already issued the 'set_address' command to the hub, > assuming the device is operating at full speed. However, in such cases, when the device > connected to the hub changes its state from full speed to high-speed, the 'set_address' > request becomes blocked, waiting for the full 5-second timeout. This patch reduces the > timeout from 5 seconds to 500 milliseconds, allowing for quicker failure and re-enumeration > of the device as high-speed Changing speed is under hub control, not device control, right? Are you sure the firmware is correct in that hub? Has the hub passed all of the USB-IF testing requirements? thanks, greg k-h