Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp973701ybf; Sat, 29 Feb 2020 21:21:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzRdZm1vrT0m6T6rGdcC55tCLm5O+m9o8DVbNOG/uIBE98W8qD4qPTpLkvasL+ywqXVWYDU X-Received: by 2002:a05:6830:1317:: with SMTP id p23mr8926760otq.3.1583040073814; Sat, 29 Feb 2020 21:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583040073; cv=none; d=google.com; s=arc-20160816; b=lhghtLSLBiBqBh5EnpyjGIK/Ijvkbglox87PfTbxBrePPt6ymoGj9xzP1LYKVcNVF9 Wh+yn+7VDuDG2/MHK3wZxlXPyCyqiQjR3GPuxWd6DESlqPNCvArbnm+ILnJRD5sBFF7D 5QU0Br1DGkVfJOVqYInuUtJau5l+3tdB2k6A/9WcWaEIYyvDChF9H9XG6yt4Bawu5YHx 5wtonssmJQ9CFAoeNoSZTU36bALvbDBh9RNOGTC+U6pMC+FsIXILsv4xi3fp55qVrR+e 41kdQ+6uxUqKCXtg+rBxnRtfysP1Ha5SvCwHZZmgbJleNYwO8PqUiitqY0qpGbtpfH8r ZStA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=tKWxwloKkppiaROKC4GzObW4qC91QAmFIs1aiZFtJJ0=; b=x3O5FkR37sZNM+ZHZXFz92UGLuGz6noWKqjxKv/Vyo8suNYkHKcwJzJo1hZxRlTes9 JzRZW57hqXis9psVCFocWN/XkpyjJf1XDSJ6rz7hcdAyJZkEwl6xdwlNc9WteqAhzZer afs4RoRzitxUlIY8J87mQAO6epqZqzm03m8t/Po46rEEEQsDJuLsEif4dqzb1zDGkvdd t0bF6CBOs1pKuwP2geVYKGuDzMcXCMfKFtB9sJPQKEA9qXxkL4RHl4nHerTH0iMCS9kf 06ukg5sS+xXe5CJtXe9zAref12m8iJ1UQ5gdL/6XV1Y9kSGAzDY8vbY0JaiyKxj8i7oA CfcQ== 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 j21si3982185oie.210.2020.02.29.21.20.42; Sat, 29 Feb 2020 21:21:13 -0800 (PST) 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 S1726204AbgCAFUh (ORCPT + 99 others); Sun, 1 Mar 2020 00:20:37 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:38646 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgCAFUh (ORCPT ); Sun, 1 Mar 2020 00:20:37 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 535F815BD8502; Sat, 29 Feb 2020 21:20:36 -0800 (PST) Date: Sat, 29 Feb 2020 21:20:35 -0800 (PST) Message-Id: <20200229.212035.1001013376740500991.davem@davemloft.net> To: vicamo@gmail.com Cc: grundler@chromium.org, hayeswang@realtek.com, kai.heng.feng@canonical.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org, pmalani@chromium.org, vicamo.yang@canonical.com Subject: Re: [PATCH v2] r8152: check disconnect status after long sleep From: David Miller In-Reply-To: <20200226153710.239838-1-vicamo@gmail.com> References: <20200224.144714.329725174070305071.davem@davemloft.net> <20200226153710.239838-1-vicamo@gmail.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sat, 29 Feb 2020 21:20:36 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: You-Sheng Yang Date: Wed, 26 Feb 2020 23:37:10 +0800 > From: You-Sheng Yang > > Dell USB Type C docking WD19/WD19DC attaches additional peripherals as: > > /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M > |__ Port 1: Dev 11, If 0, Class=Hub, Driver=hub/4p, 5000M > |__ Port 3: Dev 12, If 0, Class=Hub, Driver=hub/4p, 5000M > |__ Port 4: Dev 13, If 0, Class=Vendor Specific Class, > Driver=r8152, 5000M > > where usb 2-1-3 is a hub connecting all USB Type-A/C ports on the dock. > > When hotplugging such dock with additional usb devices already attached on > it, the probing process may reset usb 2.1 port, therefore r8152 ethernet > device is also reset. However, during r8152 device init there are several > for-loops that, when it's unable to retrieve hardware registers due to > being disconnected from USB, may take up to 14 seconds each in practice, > and that has to be completed before USB may re-enumerate devices on the > bus. As a result, devices attached to the dock will only be available > after nearly 1 minute after the dock was plugged in: ... > To solve this long latency another test to RTL8152_UNPLUG flag should be > added after those 20ms sleep to skip unnecessary loops, so that the device > probe can complete early and proceed to parent port reset/reprobe process. > > This can be reproduced on all kernel versions up to latest v5.6-rc2, but > after v5.5-rc7 the reproduce rate is dramatically lowered to 1/30 or less > while it was around 1/2. > > Signed-off-by: You-Sheng Yang Applied, thank you.