Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3345830ybl; Fri, 20 Dec 2019 07:50:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyX6RL1iuC0qZaV41vtKcZ5tHCx58XYfTW7NtRhWtUnyjzpuFPupBjvQTnrAcoRMe8NRwa7 X-Received: by 2002:a05:6830:1715:: with SMTP id 21mr16102534otk.67.1576857000376; Fri, 20 Dec 2019 07:50:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576857000; cv=none; d=google.com; s=arc-20160816; b=TnKr0R3kCLYm2mt0obf9VnPCDhYSMeKzRCAXHSnue6MUfgO/fYboqLmZiWA6pNXvaP /PIoBh88rtyW021pJB59OsAuMfEg8zvw/+DcmcwInU5OdoJnyCddkopNXeRgXKlGoA1w 2us7IFLArzthgVUL/GdiLc9tCcRbNkakq8Lify2B7o3WOF43TV233CXDWsVi+jPY8QG+ Ea/72OgEnTfs35QvT0EZhWsoIX7ysNpsLq3S5hjx0d0CipZ7Wb+ORQSRNKwvwyD2jjVD 4wWX5TWORVfi3uOSIQZ+sjdEQlp5ad3kbXOb432WV+nT0cYfUQP4oFknqnj9ruxZTVvN 1cAA== 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:in-reply-to :subject:cc:to:from:date; bh=bPHeGYZhj+BCIIPOICKIoUISMsGq8RYeAqTVORhHJHg=; b=By4orKnJAzR3SYh5sE/7MCMtFZmSf+reGUJE+LVtaTkaAdS2kEmH2PZMGMdivAGKBO YcQiTFM3DigeqasQA89NBKPMJErCWdcEw+dwtxx8EdEWi9o8QqYQEetttxFMJdGKK4Dv 0XKo4iMwYvr0CxgZ7+jhfwyhno3J5CR5aVbj+wfzFmpea8P+dm0Ordw1T1uyDqMBdqn/ x0Uenqc1SUpyUTknpzO2yyPtn2pEGIyrQiWer1+7wG17MrvY9MxkClgB/dGI5AxhMejF 1gUkmnguav1/KXWCMpIPDtjjXFJNHYkyGzkeGJEfHF3koQLLGYqqWubyJMLu62eH1D1j 06JA== 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 t3si1350907oth.113.2019.12.20.07.49.47; Fri, 20 Dec 2019 07:50:00 -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 S1727472AbfLTPsj (ORCPT + 99 others); Fri, 20 Dec 2019 10:48:39 -0500 Received: from netrider.rowland.org ([192.131.102.5]:44493 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727270AbfLTPsj (ORCPT ); Fri, 20 Dec 2019 10:48:39 -0500 Received: (qmail 4678 invoked by uid 500); 20 Dec 2019 10:48:38 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 20 Dec 2019 10:48:38 -0500 Date: Fri, 20 Dec 2019 10:48:38 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: AceLan Kao cc: Greg Kroah-Hartman , Kai-Heng Feng , Thinh Nguyen , Harry Pan , David Heinzelmann , Andrey Konovalov , Nicolas Saenz Julienne , Mathieu Malaterre , , Subject: Re: [PATCH] usb: hub: move resume delay at the head of all USB access functions In-Reply-To: <20191220025917.11886-1-acelan.kao@canonical.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Dec 2019, AceLan Kao wrote: > usb_control_msg() function should be called after the resume delay, or Which usb_control_msg() call are you referring to? Is it the call under hub_port_status()? > you'll encounter the below errors sometime. > After the issue happens, have to re-plug the USB cable to recover. > > [ 837.483573] hub 2-3:1.0: hub_ext_port_status failed (err = -71) > [ 837.490889] hub 2-3:1.0: hub_ext_port_status failed (err = -71) > [ 837.506780] usb 2-3-port4: cannot disable (err = -71) You need to do a better job of figuring out why these errors occur. It is not connected to the resume delay; there must be a different reason. Hint: This is the sort of error you would expect to see if the kernel tried to resume a device while its parent hub was still suspended. > Signed-off-by: AceLan Kao > --- > drivers/usb/core/hub.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index f229ad6952c0..2fb2816b0d38 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -3522,6 +3522,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) > } > } > > + msleep(USB_RESUME_TIMEOUT); This makes no sense at all. At this point we haven't even started to do the resume signalling, so there's no reason to wait for it to finish. > usb_lock_port(port_dev); > > /* Skip the initial Clear-Suspend step for a remote wakeup */ > @@ -3544,7 +3545,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) > /* drive resume for USB_RESUME_TIMEOUT msec */ > dev_dbg(&udev->dev, "usb %sresume\n", > (PMSG_IS_AUTO(msg) ? "auto-" : "")); > - msleep(USB_RESUME_TIMEOUT); This is wrong also. At this point the resume signal _is_ being sent, and the USB spec requires that we wait a minimum amount of time for the device to fully resume. Alan Stern