Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752071AbdLALDl (ORCPT ); Fri, 1 Dec 2017 06:03:41 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:34817 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751660AbdLALDi (ORCPT ); Fri, 1 Dec 2017 06:03:38 -0500 X-IronPort-AV: E=Sophos;i="5.45,344,1508770800"; d="scan'208";a="263883122" From: Yoshihiro Shimoda To: Ulf Hansson CC: Geert Uytterhoeven , "Rafael J. Wysocki" , Linux PM , LKML , Greg Kroah-Hartman , Alan Stern , "USB list" , Linux-Renesas , Kishon Vijay Abraham I Subject: RE: [PATCH] PM / runtime: Drop children check from __pm_runtime_set_status() Thread-Topic: [PATCH] PM / runtime: Drop children check from __pm_runtime_set_status() Thread-Index: AQHTaDfS0q/eL1h6GUu734kOFriem6MpuB9wgABSgACAAPMO0IAAGbSAgAAFNYCAAARrAIABvQIAgAFdUQCAABPfAA== Date: Fri, 1 Dec 2017 11:03:33 +0000 Message-ID: References: <1713438.irjm9MTSvo@aspire.rjw.lan> In-Reply-To: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yoshihiro.shimoda.uh@renesas.com; x-originating-ip: [211.11.155.139] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;TY1PR06MB0989;20:aHM2GlOzey1NcNM8ST2GLyJDzrZHrqK1YQEt8z2g4XHMW8xRLH4EmTCqIl+47d9fXtYG6SSIlY6TXYGOe8rD/JqXLiVzjn2HbrSQZP3hbzw65jS9CgCtJaFBIbY8FANiwIUv2C0BDdMZ+NnSVvHkcKm5ysRVTk5jkTI268EWj3A= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 55d492de-3bf1-43e9-bbfb-08d538ab29ed x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603286);SRVR:TY1PR06MB0989; x-ms-traffictypediagnostic: TY1PR06MB0989: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231022)(6055026)(6041248)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123562025)(6072148)(201708071742011);SRVR:TY1PR06MB0989;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:TY1PR06MB0989; x-forefront-prvs: 05087F0C24 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(346002)(376002)(366004)(51444003)(199003)(45984002)(24454002)(189002)(6116002)(102836003)(53936002)(3846002)(3280700002)(106356001)(105586002)(25786009)(97736004)(3660700001)(2906002)(189998001)(9686003)(7696005)(229853002)(86362001)(6436002)(6506006)(66066001)(2900100001)(6246003)(4326008)(77096006)(55016002)(7416002)(74316002)(8936002)(33656002)(53546010)(81156014)(8676002)(81166006)(101416001)(2950100002)(316002)(305945005)(5660300001)(7736002)(14454004)(93886005)(54906003)(99286004)(6916009)(54356011)(478600001)(68736007)(76176011);DIR:OUT;SFP:1102;SCL:1;SRVR:TY1PR06MB0989;H:TY1PR06MB0992.apcprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55d492de-3bf1-43e9-bbfb-08d538ab29ed X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2017 11:03:33.5239 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR06MB0989 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vB1B3pPw019073 Content-Length: 3312 Lines: 88 Hi, > From: Ulf Hansson, Sent: Friday, December 1, 2017 6:22 PM > > + Kishon > > On 30 November 2017 at 13:51, Yoshihiro Shimoda > wrote: > > Hi, > > > >> From: Ulf Hansson, Sent: Wednesday, November 29, 2017 6:59 PM > >> > >> On 29 November 2017 at 10:43, Geert Uytterhoeven wrote: > >> > Hi Ulf, > > > >> Okay, so the problem remains no matter which solution for wakeup you > >> pick in genpd. > > > > Yes. Today I could reproduce this issue without usb host driver. > > - The renesas_usb3 usb peripheral driver has generic phy handling. > > (The peripheral driver uses different generic phy driver (phy-rcar-gen3-usb3.c) though.) > > --> If I used the current renesas_usb3 (this means doesn't call phy_power_{on,off}(), > > the issue didn't happen. > > --> If I added phy_power_{on,off}() calling, the issue happened. > > --> So, I'm thinking the APIs are related to the issue. > > Yes. > > > > > - The generic phy APIs are in drivers/phy/phy-core.c. > > --> The phy-rcar-gen3-usb[23] drivers call only pm_runtime_enable() before devm_phy_create(). > > --> The phy-core will call pm_runtime_{get_sync,put}() in phy_{init,exit,power_{on,off}}. > > --> So, IIUC, both devices of phy-. and will be handled by runtime PM APIs. > > --> The runtime PM implementation of phy-core seems good to me. But...? > > > I have digested the information that you and Geert provided, thanks! > > So, my conclusions so far is: > > The phy core is using runtime PM reference counting at > phy_power_on|off(). Although it does that on the phy core device, > which is a child device of the phy provider device. > > Because phy_power_off() is called during system suspend from phy > consumer drivers like usb, the phy core device (child) and the phy > provider device (parent) will never become runtime suspended (because > the PM core has invoked pm_runtime_get_no_resume() for all device in > the device prepare phase). > > Then, when genpd calls pm_runtime_force_suspend() at the suspend noirq > phase for the phy provider device, the call to > pm_runtime_set_suspended() in there, triggers the earlier error > message, which is because the child (phy core device) is still runtime > resumed. Thank you very much for the conclusions! It's helpful to me about runtime PM behavior. > >> Then this seems to point to that the driver may be misbehaving in some > >> way. I can help to check what is going on. > > > > I guess so. But, I don't find yet... > > I think the below patch will help, although I am not sure if that is > sufficient as a long term fix. Thank you very much for your help! Also, I'm not sure how to fix for a long term kernels though... > Can you please try and see if it solves the problems? Sure! I tested your patch, and then the following message disappeared! Enabling runtime PM for inactive device (ee080200.usb-phy) with active children However, the following message still exists. Enabling runtime PM for inactive device (ee080000.usb) with active children So, I guess ohci-platform.c also has similar issue. JFYI, the ehci-platform.c doesn't have runtime PM handling. So, I think that error message doesn't output from ehci devices. Best regards, Yoshihiro Shimoda