Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp802002pxb; Wed, 29 Sep 2021 09:57:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3bS2rQ3B9Ml8/76FmfhKtj00NAMQAdUO85Cm5bE5Fi62uctIJP0bs+J6qVjfQDq2MNMuN X-Received: by 2002:a17:902:a406:b029:12b:c50a:4289 with SMTP id p6-20020a170902a406b029012bc50a4289mr653148plq.56.1632934646956; Wed, 29 Sep 2021 09:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632934646; cv=none; d=google.com; s=arc-20160816; b=DqVNrJPULX5PwY/Eok1Y439XsQ0I7c0UnO7+FUw97twbYUJq3Hz95nh3rTNlnEKsgp xiW0KtMQdHC5K7aBWI+L3CtHn5YFp84ugPZzXuSpqujCk08NbnLypSsRatkmXHJ7rtTX 0aUNPdGYdjXI40zYdgA/38Ofy1zzDW3QWlxIGZVDb0XxDqmokJlpMxKq1UaQypq2fvF0 1VeAxKlzZGJAHWRXmZdGGWD98otH12WJ3MvEupFn+CJAW3bhyeVVMRDrj4MHhNWzFS1g dUDjQ40ptpXM50vfhuKrMx7DaDNejKtzUJrFs26JjCQnVK/rqLZUOk53IS+zDbXix44F uqlQ== 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=q4qSN/rVneHzX69Pb6/Lhl45gzI4Us1ibH1of0f2qE4=; b=UpPj9AgRQ/HijyA9gbSAtE8tkQXohUo2o+u+fu4bQfzXAMngfAL1AeAwmQnvucglAs OHA3b7jY8g0blnlrJBy2WwA82XKaXN2w9Ln9tSWgOaceijhstrwL5X5nWaS+sjsZ/Id9 0ZjiQSO1hUmj8kvHndb8HB28KLgnZDi04eqJuGs047wROxswiIbekN/I/eVOC1ar6vRH dWe6YmskReedryCrjhWkkfsRsJ12kmVnJ9AYygsiHBq82+7J/hc4zN0zTk9iCOSOYeh/ J5oMa2t/P19FhtB6PP6W+W2eJD1gXml2+1I0p4JYyhw1T85EpFj5K9XWfKfrGEOBzAJF QRYg== 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 h124si379020pgc.181.2021.09.29.09.57.13; Wed, 29 Sep 2021 09:57:26 -0700 (PDT) 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 S1344897AbhI2PBM (ORCPT + 99 others); Wed, 29 Sep 2021 11:01:12 -0400 Received: from netrider.rowland.org ([192.131.102.5]:36035 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1344938AbhI2PA5 (ORCPT ); Wed, 29 Sep 2021 11:00:57 -0400 Received: (qmail 429369 invoked by uid 1000); 29 Sep 2021 10:59:05 -0400 Date: Wed, 29 Sep 2021 10:59:05 -0400 From: Alan Stern To: Yinbo Zhu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Patchwork Bot Subject: Re: [PATCH v2] usb: ohci: add check for start frame in host controller functional states Message-ID: <20210929145905.GA428239@rowland.harvard.edu> References: <1632910167-23554-1-git-send-email-zhuyinbo@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1632910167-23554-1-git-send-email-zhuyinbo@loongson.cn> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 06:09:27PM +0800, Yinbo Zhu wrote: > The pm states of ohci controller include UsbOperational, UsbReset, UsbSuspend Those aren't really PM states. The specification calls them "USB states". > , and UsbResume. Among them, only the UsbOperational state supports launching --^ This comma should come directly after the word "launching", with no space in between. > the start frame for host controller according the ohci protocol spec, but in > S3/S4 press test procedure, it may happen that the start frame was launched What is the S3/S4 press test? I don't recall hearing of it before. > in other pm states and cause ohci works abnormally then kernel will allways > report rcu CallTrace. This patch was to add check for start frame in host > controller functional states for fixing above issue. The patch doesn't check for start of frames, that is, it doesn't check the INTR_SF bit in the intrstatus register. Instead it checks whether controller is in the UsbOperational state. And the patch also sets INTR_SF in the intrdisable register -- you do not mention this in the description. > Signed-off-by: Yinbo Zhu > --- > Change in v2: > Revise the punctuation. > > drivers/usb/host/ohci-hcd.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c > index 1f5e693..f0aeae5 100644 > --- a/drivers/usb/host/ohci-hcd.c > +++ b/drivers/usb/host/ohci-hcd.c > @@ -881,6 +881,13 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) > struct ohci_regs __iomem *regs = ohci->regs; > int ints; > > + ints = ohci_readl(ohci, ®s->control); > + > + if ((ints & OHCI_CTRL_HCFS) != OHCI_USB_OPER) { > + ohci_writel(ohci, OHCI_INTR_SF, ®s->intrdisable); > + (void)ohci_readl(ohci, ®s->intrdisable); > + } The driver is already supposed to prevent this problem by writing the OHCI_INTR_SF flag to the intrdisable register when start-of-frame interrupts aren't needed. Maybe what you should do is change this code lower down in ohci_irq(): if ((ints & OHCI_INTR_SF) != 0 && !ohci->ed_rm_list && ohci->rh_state == OHCI_RH_RUNNING) ohci_writel (ohci, OHCI_INTR_SF, ®s->intrdisable); by getting rid of the test for OHCI_RH_RUNNING. Alan Stern > + > /* Read interrupt status (and flush pending writes). We ignore the > * optimization of checking the LSB of hcca->done_head; it doesn't > * work on all systems (edge triggering for OHCI can be a factor). > -- > 1.8.3.1 >