Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1145813pxf; Fri, 2 Apr 2021 02:27:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoBo+ap2iHTFZnQFgHyNd5Cogr5T5K5fAx/rOliAEj1GqHA2HsgcuZuhKlKJAEXoLBeZ8V X-Received: by 2002:a05:6602:280f:: with SMTP id d15mr9951488ioe.127.1617355670973; Fri, 02 Apr 2021 02:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617355670; cv=none; d=google.com; s=arc-20160816; b=rfQHGupdsK2IFtvGQR7i0HBzLMjI+/g+aVa0IXz7X8C88siBMqrl1mCHIoOWQUrAgU COYYRqghqqOTWvAASS5oZOFOLB7+Sz/okvw7vSnv8FJErhTQLsDafb3n6nMNMc7F8n2X yrK/q12sN2s/knfINw8RaLfGnGB8FjXJAW/AWCF9Ieu6YmsJQF2fKcMtuppsR6vcZ+ja icTrSj4nDJTid5WcV2iLVMyFGoToR6yPx88YKWnH+2k8BxRe7JKkEQ38JeMzcearFO5a 7Vc1JgAgyz1NVcD1ISnXGKRO46bb+pBXrs2OdmpScW/UxWsXJiD1zb2L8A/cNZJs6+74 VvKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=PmUfNzZG9JL3nfnb9sRdLBG4W2VCClCQu7OB3cHUaxY=; b=vlIdM2xoRQg0DAlhqIubgqs6fTrOJj+g7XWag91wRaCkqG+8hTZZJ+okRklfo5BpD9 E0AyCnmHo2pZ2caDLtQgtjs8SU934BBjv5dn3J+NP3E6MAqWtNb3vAsvKZ2JtF/apJtY nW4a0wrSXiYTVLneHeqXF1jjQbX3e1d4HOgEh1VNzCNCaszKY3AIOkoaApDTWuFF3EqD kgu69JnUcHSgpNPfFkZ3O32PjVrK/cHU+sfqciZGb3YV/qNXJg1nXNhbQwEbZDgJR5TS YmSCteAXYa8sujAvaUzIhaZX9bPGlf39P6DkPN1x5faFy6tPoxfFygD7kOH5OOpCpSDr 5JXQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si7335040ilk.88.2021.04.02.02.27.37; Fri, 02 Apr 2021 02:27:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234433AbhDBJ1C (ORCPT + 99 others); Fri, 2 Apr 2021 05:27:02 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:15533 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231160AbhDBJ1C (ORCPT ); Fri, 2 Apr 2021 05:27:02 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FBZPZ2FRSzNsJt; Fri, 2 Apr 2021 17:24:18 +0800 (CST) Received: from [10.67.102.118] (10.67.102.118) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Fri, 2 Apr 2021 17:26:50 +0800 Subject: Re: [PATCH] USB:ohci:fix ohci interruption problem To: , , CC: , , , References: <1617354660-43964-1-git-send-email-liulongfang@huawei.com> From: liulongfang Message-ID: Date: Fri, 2 Apr 2021 17:26:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1617354660-43964-1-git-send-email-liulongfang@huawei.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.118] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/4/2 17:11, Longfang Liu wrote: > The operating method of the system entering S4 sleep mode: > echo disk > /sys/power/state > > When OHCI enters the S4 sleep state, the USB sleep process will call > check_root_hub_suspend() and ohci_bus_suspend() instead of > ohci_suspend() and ohci_bus_suspend(), this causes the OHCI interrupt > to not be closed. > > At this time, if just one device interrupt is reported. Since rh_state > has been changed to OHCI_RH_SUSPENDED after ohci_bus_suspend(), the > driver will not process and close this device interrupt. It will cause > the entire system to be stuck during sleep, causing the device to > fail to respond. > > When the abnormal interruption reaches 100,000 times, the system will > forcibly close the interruption and make the device unusable. > > Because the root cause of the problem is that ohci_suspend is not > called to perform normal interrupt shutdown operations when the system > enters S4 sleep mode. > > Therefore, our solution is to specify freeze interface in this mode to > perform normal suspend_common() operations, and call ohci_suspend() > after check_root_hub_suspend() is executed through the suspend_common() > operation. > After using this solution, it is verified by the stress test of sleep > wake up in S4 mode for a long time that this problem no longer occurs. > > Signed-off-by: Longfang Liu > --- > drivers/usb/core/hcd-pci.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c > index 1547aa6..78a56cd 100644 > --- a/drivers/usb/core/hcd-pci.c > +++ b/drivers/usb/core/hcd-pci.c > @@ -509,6 +509,11 @@ static int resume_common(struct device *dev, int event) > > #ifdef CONFIG_PM_SLEEP > > +static int hcd_pci_freeze(struct device *dev) > +{ > + return suspend_common(dev, device_may_wakeup(dev)); > +} > + > static int hcd_pci_suspend(struct device *dev) > { > return suspend_common(dev, device_may_wakeup(dev)); > @@ -605,8 +610,8 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = { > .suspend_noirq = hcd_pci_suspend_noirq, > .resume_noirq = hcd_pci_resume_noirq, > .resume = hcd_pci_resume, > - .freeze = check_root_hub_suspended, > - .freeze_noirq = check_root_hub_suspended, > + .freeze = hcd_pci_freeze, > + .freeze_noirq = hcd_pci_freeze, > .thaw_noirq = NULL, > .thaw = NULL, > .poweroff = hcd_pci_suspend, > Sorry, please ignore this patch, I will resend it. Thanks. Longfang.