From patchwork Tue Feb 2 21:39:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 8196091 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 72FB4BEEE5 for ; Tue, 2 Feb 2016 21:39:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99AE8202D1 for ; Tue, 2 Feb 2016 21:39:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 331E72034E for ; Tue, 2 Feb 2016 21:39:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754031AbcBBVjV (ORCPT ); Tue, 2 Feb 2016 16:39:21 -0500 Received: from muru.com ([72.249.23.125]:59667 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbcBBVjU (ORCPT ); Tue, 2 Feb 2016 16:39:20 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id D2B5A828D; Tue, 2 Feb 2016 21:40:19 +0000 (UTC) Date: Tue, 2 Feb 2016 13:39:17 -0800 From: Tony Lindgren To: Ulf Hansson Cc: Alan Stern , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Kevin Hilman , "linux-pm@vger.kernel.org" , Linux OMAP Mailing List , "linux-arm-kernel@lists.infradead.org" Subject: Re: PM regression with commit 5de85b9d57ab PM runtime re-init in v4.5-rc1 Message-ID: <20160202213916.GA19432@atomide.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP * Ulf Hansson [160202 12:25]: > > > > ? pm_runtime_put_sync() _already_ does not respect the autosuspend > > mode. If you want to respect it, you have to call > > pm_runtime_put_sync_autosuspend() instead. > > Then there's a bug in the runtime PM core. > > From Tony's regression report and from mine own local runtime PM test > driver, I can see that the device doesn't get RPM_SUSPENDED (the > ->runtime_suspend() callback isn't called), even when the usage count > is zero - when pm_runtime_put_sync() is called. ... > Okay, so you are saying that the pm_runtime_put_sync() should idle the > device even if autosuspend is in use. That seems reasonable, I will > look into this problem. The patch below fixes pm_runtime_put_sync() to not respect the autosuspend mode to match what Alan is saying above. Seems to also fixes the $subject issue for me. And seems to behave for PM runtime for other devices during runtime too based on light testing here. Regards, Tony 8< --------------- --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -353,7 +353,9 @@ static int rpm_idle(struct device *dev, int rpmflags) out: trace_rpm_return_int(dev, _THIS_IP_, retval); - return retval ? retval : rpm_suspend(dev, rpmflags | RPM_AUTO); + if (!(rpmflags & RPM_IGNORE_AUTO)) + rpmflags |= RPM_AUTO; + return retval ? retval : rpm_suspend(dev, rpmflags); } /** --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -23,6 +23,8 @@ usage_count */ #define RPM_AUTO 0x08 /* Use autosuspend_delay */ +#define RPM_IGNORE_AUTO 0x10 /* Ignore autosuspend */ + #ifdef CONFIG_PM extern struct workqueue_struct *pm_wq; @@ -241,7 +243,7 @@ static inline int pm_runtime_put_autosuspend(struct device *dev) static inline int pm_runtime_put_sync(struct device *dev) { - return __pm_runtime_idle(dev, RPM_GET_PUT); + return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_IGNORE_AUTO); } static inline int pm_runtime_put_sync_suspend(struct device *dev)