Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp653739pxu; Thu, 26 Nov 2020 08:11:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFa63NV6RYJp1CMkqWtlPHowExSTZ9BBrYLfl8zbd68alvA1Lpkf4i2iTHkK3SDg8H+H7m X-Received: by 2002:a17:906:fc4:: with SMTP id c4mr3380715ejk.490.1606407103400; Thu, 26 Nov 2020 08:11:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606407103; cv=none; d=google.com; s=arc-20160816; b=GEKKjs2fbzn3MqT8Dz13C3hBYmMD+FySU0kr8fPPaSsotZLspUP16PZL9GgHt2HH6a QO0FXM5YApOHvHuTzSG9QDhMapxGAri41rHsf76LmTmjdEZqMblm3kep4YKIxuamMv6/ DDJaFV0R875bwy4R0tNm4ZrKmYfn/D22AX3FqTfcCelgzHciWdmrm1B+6mIxo4ag1afK VQY6IuL7zmlcsjKF1hshsH8ErHvWvEs0kkN0/CLpySbeXDkX5v/FHap/HRoZtJh0WEUE icGsyMO5t+8MvHRC/6Z9ruC7Z2tv+43bKuAs+m+/zmHAzccBP7N4ti06zBC0AGIHnefw 8hMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=8z5RAKBxVs6KP02RBdhTopj8BnN8PJzxGHuI6nkt/z8=; b=HT0A0EF9CufqxcblLX1wBU1QYrNZMfTLZCnFQBFKWocFpwUJgsCPAPimn5GH9ppUJH X3hmMi5FPZHfeN7ktx9vPd6xkv/j9NlwGjB/jx0OPk8UXl5xfP9DIWhpv7RGy3qIEJ7v mJyb+BPpbLDJ6kGbQbmjERyLP7uCPZKe71J36RTRHAQ6lZ7XvDC3fT8/M+su1CZb516h qWtxliGoJEJSa20wfZXdA+cAkEhSMearJvDCYmtcVSlQE59Qk4E59moRAomRDmolRZ5Q 8LVnxADzsEYjq4NWMo240yUBqzPDjK4OrXWzZpEPvcK5FZmX1Y08iWXFiNMINLa82JLh ghCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k12si3336509eds.191.2020.11.26.08.11.18; Thu, 26 Nov 2020 08:11:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730181AbgKZQIb (ORCPT + 99 others); Thu, 26 Nov 2020 11:08:31 -0500 Received: from netrider.rowland.org ([192.131.102.5]:59517 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1730602AbgKZQIb (ORCPT ); Thu, 26 Nov 2020 11:08:31 -0500 Received: (qmail 828475 invoked by uid 1000); 26 Nov 2020 11:08:30 -0500 Date: Thu, 26 Nov 2020 11:08:30 -0500 From: Alan Stern To: Longfang Liu Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB:ehci:fix an interrupt calltrace error Message-ID: <20201126160830.GA827745@rowland.harvard.edu> References: <1606361673-573-1-git-send-email-liulongfang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1606361673-573-1-git-send-email-liulongfang@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 26, 2020 at 11:34:33AM +0800, Longfang Liu wrote: > The system goes to suspend when using USB audio player. This causes > the USB device continuous send interrupt signal to system, When the > number of interrupts exceeds 100000, the system will forcibly close > the interrupts and output a calltrace error. This description is very confusing. USB devices do not send interrupt signals to the host. Do you mean that the device sends a wakeup request? Or do you mean something else? > When the system goes to suspend, the last interrupt is reported to > the driver. At this time, the system has set the state to suspend. > This causes the last interrupt to not be processed by the system and > not clear the interrupt state flag. This uncleared interrupt flag > constantly triggers new interrupt event. This causing the driver to > receive more than 100,000 interrupts, which causes the system to > forcibly close the interrupt report and report the calltrace error. If the driver receives an interrupt, it is supposed to process the event even if the host controller is suspended. And when ehci_irq() runs, it clears the bits that are set in the USBSYS register. Why is your system getting interrupts? That is, which bits are set in the USBSTS register? > so, when the driver goes to sleep and changes the system state to > suspend, the interrupt flag needs to be cleared. > > Signed-off-by: Longfang Liu > --- > drivers/usb/host/ehci-hub.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c > index ce0eaf7..5b13825 100644 > --- a/drivers/usb/host/ehci-hub.c > +++ b/drivers/usb/host/ehci-hub.c > @@ -348,6 +348,11 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) > > /* Any IAA cycle that started before the suspend is now invalid */ > end_iaa_cycle(ehci); > + > + /* clear interrupt status */ > + if (ehci->has_synopsys_hc_bug) > + ehci_writel(ehci, INTR_MASK | STS_FLR, &ehci->regs->status); This is a very strange place to add your new code -- right in the middle of the IAA and unlink handling. Why not put it in a more reasonable place? Also, the patch description does not mention has_synopsys_hc_bug. The meaning of this flag has no connection with the interrupt status register, so why do you use it here? > + > ehci_handle_start_intr_unlinks(ehci); > ehci_handle_intr_unlinks(ehci); > end_free_itds(ehci); Alan Stern