Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1539281imm; Thu, 19 Jul 2018 03:38:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcaK3DOIdRcJA0se5VopWC8pSnGg5Co+g0F2JerHO6NTGoveOPIYqKAYOez2vPdPJGYDhEx X-Received: by 2002:a63:1d22:: with SMTP id d34-v6mr9478363pgd.133.1531996708290; Thu, 19 Jul 2018 03:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531996708; cv=none; d=google.com; s=arc-20160816; b=CyEm4LWDyZRq2SGYgyoOAjp2doSR6bWH/oHck9y3txrLP6le1vZvFI3SwrTwe+VNY7 OzbiBhdVPxWR4gOHVG7Ax4a/sKvh3AdEPxkVTQpZkBiU2PnmPbXbXguJ9GeZWAE7ktZB IbDcwkyxFHeXG9gnmcZgAOj/Q1xbipeVzFCLBheQ3TlPjlsakfKFEvgyj3C2oibrpUBg 2qJGamVbQKGBZdlC5N3UU+U9xpkpWhfTbB03NAeGi4rfxMEUV7l+CZQWfrl3Sf7kbxsu 1OYqDhgKJLTT/UR8/OLmrCVyud6liQbOcM6YE5Ah1uyrUvElROTgFiGhPrJes6Vvoupy 2wlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=00XcD+HFuLIZEBG2M48xnJBsvQlaaw4YknsBnAexdU8=; b=BvcEyTBC6K2eiWn8f62XZxoOO1SECVAcQ74srdkHzBPLxNxh44uRSIYmmvEIwqlG6E LfST7e9sDRlaYzIXDVPM3HBw7x4wXZpHWx5wYEC/m8PdtzN5asHdH2ps6EGM+xNmeiQv Bc617hreWCIvQSf5yzH8gcMSkP858jC2+PvZgpxh05XT9AggfpYJLrPK0acaXeBaKQra fZoPG4ts+lQYh0Ks8lk22JQcwOcLvt6gHjMdKggPn20pMof6sSVGJCB9XZYgJcACvPX0 dxkGb0PQE0VxwGOVjGzNrcISvMyeo4vElaFVsRXMyIwiXCiJ0PdvT9AD2Nc35+F9vNfa NCtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1-v6si5974047pli.58.2018.07.19.03.38.13; Thu, 19 Jul 2018 03:38:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727702AbeGSLUM (ORCPT + 99 others); Thu, 19 Jul 2018 07:20:12 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:63293 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727185AbeGSLUM (ORCPT ); Thu, 19 Jul 2018 07:20:12 -0400 Received: from 79.184.255.17.ipv4.supernova.orange.pl (79.184.255.17) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83) id 1c24aeafc6239828; Thu, 19 Jul 2018 12:37:38 +0200 From: "Rafael J. Wysocki" To: Ulf Hansson Cc: Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org, Kevin Hilman , Lina Iyer , Lina Iyer , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 08/26] PM / Domains: Extend genpd CPU governor to cope with QoS constraints Date: Thu, 19 Jul 2018 12:35:59 +0200 Message-ID: <1683770.JmsJDzJTZp@aspire.rjw.lan> In-Reply-To: <20180620172226.15012-9-ulf.hansson@linaro.org> References: <20180620172226.15012-1-ulf.hansson@linaro.org> <20180620172226.15012-9-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, June 20, 2018 7:22:08 PM CEST Ulf Hansson wrote: > CPU devices and other regular devices may share the same PM domain and may > also be hierarchically related via subdomains. In either case, all devices > including CPUs, may be attached to a PM domain managed by genpd, that has > an idle state with an enter/exit latency. > > Let's take these latencies into account in the state selection process by > genpd's governor for CPUs. This means the governor, pm_domain_cpu_gov, > becomes extended to satisfy both a state's residency and a potential dev PM > QoS constraint. > > Cc: Lina Iyer > Co-developed-by: Lina Iyer > Signed-off-by: Ulf Hansson > --- > drivers/base/power/domain_governor.c | 15 +++++++++++---- > include/linux/pm_domain.h | 1 + > 2 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c > index 1aad55719537..03d4e9454ce9 100644 > --- a/drivers/base/power/domain_governor.c > +++ b/drivers/base/power/domain_governor.c > @@ -214,8 +214,10 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) > struct generic_pm_domain *genpd = pd_to_genpd(pd); > struct gpd_link *link; > > - if (!genpd->max_off_time_changed) > + if (!genpd->max_off_time_changed) { > + genpd->state_idx = genpd->cached_power_down_state_idx; > return genpd->cached_power_down_ok; > + } > > /* > * We have to invalidate the cached results for the masters, so > @@ -240,6 +242,7 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) > genpd->state_idx--; > } > > + genpd->cached_power_down_state_idx = genpd->state_idx; > return genpd->cached_power_down_ok; > } > > @@ -255,6 +258,10 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd) > s64 idle_duration_ns; > int cpu, i; > > + /* Validate dev PM QoS constraints. */ > + if (!default_power_down_ok(pd)) > + return false; > + > if (!(genpd->flags & GENPD_FLAG_CPU_DOMAIN)) > return true; > > @@ -276,9 +283,9 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd) > /* > * Find the deepest idle state that has its residency value satisfied > * and by also taking into account the power off latency for the state. > - * Start at the deepest supported state. > + * Start at the state picked by the dev PM QoS constraint validation. > */ > - i = genpd->state_count - 1; > + i = genpd->state_idx; > do { > if (!genpd->states[i].residency_ns) > break; > @@ -312,6 +319,6 @@ struct dev_power_governor pm_domain_always_on_gov = { > }; > > struct dev_power_governor pm_domain_cpu_gov = { > - .suspend_ok = NULL, > + .suspend_ok = default_suspend_ok, > .power_down_ok = cpu_power_down_ok, > }; > diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h > index 97901c833108..dbc69721cad8 100644 > --- a/include/linux/pm_domain.h > +++ b/include/linux/pm_domain.h > @@ -81,6 +81,7 @@ struct generic_pm_domain { > s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ > bool max_off_time_changed; > bool cached_power_down_ok; > + bool cached_power_down_state_idx; > int (*attach_dev)(struct generic_pm_domain *domain, > struct device *dev); > void (*detach_dev)(struct generic_pm_domain *domain, > I don't see much value in splitting this patch off [07/26] and it actually confused me, so it may as well confuse someone else.