Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4895562imu; Wed, 19 Dec 2018 02:05:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xg0rpQ235gAWh0yJgd5GtgDujhvQn2J5bvEzC2N4yTCdwkZ7SPh26JECd9r9GPzSrgWSxj X-Received: by 2002:a63:6207:: with SMTP id w7mr18302366pgb.90.1545213936926; Wed, 19 Dec 2018 02:05:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545213936; cv=none; d=google.com; s=arc-20160816; b=K+o/ywNpcuF9x4D1y4DI5WKGJSLOd1euMWbmlT6rTbCVvkWvIEfHUOpL9S+ZnSsbPc 86bpFsw0W1WKfCzNLBSxvAt/yDX/lKyB7ZQOZm38bvXyclj/cjuQ4E+EYIhethFsZvdv nweUueLSPVwPNKPaf565JAYM9Diad7KQ/aeN5wzrLXxyWbkfF7VHuG8ACzOBqxHYui3t 2GB353lzfqLO8U27qRf9EEIPitIMBNSpIv5tUORboQLINat9XZV1uEr/yXs1EoX+AmPK nhTRQeVM4YIweDl4ZOf2whyS2pFixSVyabHDuB1+FgAJnOm6eoomITK9yvDSmT0Au9gz I/3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NQx7dLUJGiSAdVx/e9rnK06sQwchI0BSenA1bBEwXWM=; b=acMsc3pEX5PvJiSRk3yqIwVkR0TZVlRSmoUTO5KS1KYX31UhmDL1kPO0BJC7GK0081 6fvaC1bUIBYRh2iD2jjtecEUV8xXQ/s9TRw/U1qYJxodcz+QumBAXUq9rVj8zhbEgFJ2 rBH5IRF1aW/dUCyra1BCJYpsORFswCnVFwMsb0HwYUo0ZUoOiaJxbPG0sokrul72G4VZ vB6hvrhuZ4iCwD/Hl0dea4tzlWqOi/L1NShm9pr4uL4UkYteytckEWk4TSUMzEZM/k0g yxtTln7+hIsO1geOv9//SV+dAryGkx3v8LQqcMQyttXCCuDkBb097MR/ebWtb77MVE1A w6wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ESTlneAd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si15898132pgg.339.2018.12.19.02.05.19; Wed, 19 Dec 2018 02:05:36 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=ESTlneAd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728570AbeLSKCn (ORCPT + 99 others); Wed, 19 Dec 2018 05:02:43 -0500 Received: from mail-ua1-f66.google.com ([209.85.222.66]:33504 "EHLO mail-ua1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726537AbeLSKCm (ORCPT ); Wed, 19 Dec 2018 05:02:42 -0500 Received: by mail-ua1-f66.google.com with SMTP id t8so6786833uap.0 for ; Wed, 19 Dec 2018 02:02:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NQx7dLUJGiSAdVx/e9rnK06sQwchI0BSenA1bBEwXWM=; b=ESTlneAdRAvwkG+zZ26ezJt7iDxfFGWlUc3J7WkSnuGT/Si2x2H3LHwRoD5AupI9xI r2RVktvCRDT9LEsXK7hSdzePAY9E7Q0cQSJknQDSmE/2FcIIUxWJQ6vZMXWqCrlM6+QY JvdtcM36xJtSnNKcalSFnzRJR6qo4xstBZQ5M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NQx7dLUJGiSAdVx/e9rnK06sQwchI0BSenA1bBEwXWM=; b=UBXmYdPp07lhJk1/UtAAXCoN3OjDti88TnxFuc3xNIXP8gwQ1iBFLkF2Ve+7ydviix spPSxYPkaqFZyu/GA0pGPlk0lQHwSbh2Y438Wbj0audKugLT8AXW4I68pL0YpMtxA9sv oR4QbtdQ3dw+Zd8Rwc5rTF1J9uWFJdQW4gYqU/+SCyPfU4kq10rOzQWSr3lQg2OyvXDB WhWGVgaVyyf5RAqDMvacppyWICt7cH77hcSYgc4t+XKkuvWVPMFyJt6W9+8Rehz+/t76 ghLb/wVg5aB79FTTaKk2Ng4GSFUmC6p0+fiA3jp7ROqyWbvNIABTY+l/RYGb5qpoiU/m Vjcg== X-Gm-Message-State: AA+aEWaVMY1uiskfvphBLywDmogvozWPgJIlo8mazFFRgTMkCgjHMbLQ ywwUMIP+pioz4JMPohuGY/P0wPPY99OwFyiNILmL3A== X-Received: by 2002:ab0:31d5:: with SMTP id e21mr10084799uan.107.1545213761724; Wed, 19 Dec 2018 02:02:41 -0800 (PST) MIME-Version: 1.0 References: <20181129174700.16585-1-ulf.hansson@linaro.org> <20181129174700.16585-3-ulf.hansson@linaro.org> <45ff9a4b-6130-7800-28cc-a2f5f736f44b@linaro.org> In-Reply-To: <45ff9a4b-6130-7800-28cc-a2f5f736f44b@linaro.org> From: Ulf Hansson Date: Wed, 19 Dec 2018 11:02:05 +0100 Message-ID: Subject: Re: [PATCH v10 02/27] PM / Domains: Add support for CPU devices to genpd To: Daniel Lezcano Cc: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Linux PM , "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , Linux ARM , linux-arm-msm , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 Dec 2018 at 10:53, Daniel Lezcano wrote: > > On 29/11/2018 18:46, Ulf Hansson wrote: > > To enable a device belonging to a CPU to be attached to a PM domain managed > > by genpd, let's do a few changes to it, as to make it convenient to manage > > the specifics around CPUs. > > > > To be able to quickly find out what CPUs that are attached to a genpd, > > which typically becomes useful from a genpd governor as following changes > > is about to show, let's add a cpumask to the struct generic_pm_domain. At > > the point when a CPU device gets attached to a genpd, let's update its > > cpumask. Moreover, let's also propagate changes to the cpumask upwards in > > the topology to the master PM domains. In this way, the cpumask for a genpd > > hierarchically reflects all CPUs attached to the topology below it. > > > > Finally, let's make this an opt-in feature, to avoid having to manage CPUs > > and the cpumask for a genpd that doesn't need it. For that reason, let's > > add a new genpd configuration bit, GENPD_FLAG_CPU_DOMAIN. > > > > Cc: Lina Iyer > > Co-developed-by: Lina Iyer > > Signed-off-by: Ulf Hansson > > --- > > > > Changes in v10: > > - Don't allocate the cpumask when not used. > > - Simplify the code that updates the cpumask. > > - Document the GENPD_FLAG_CPU_DOMAIN. > > > > --- > > drivers/base/power/domain.c | 66 ++++++++++++++++++++++++++++++++++++- > > include/linux/pm_domain.h | 13 ++++++++ > > 2 files changed, 78 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > > index e27b91d36a2a..c3ff8e395308 100644 > > --- a/drivers/base/power/domain.c > > +++ b/drivers/base/power/domain.c > > @@ -20,6 +20,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "power.h" > > > > @@ -126,6 +127,7 @@ static const struct genpd_lock_ops genpd_spin_ops = { > > #define genpd_is_irq_safe(genpd) (genpd->flags & GENPD_FLAG_IRQ_SAFE) > > #define genpd_is_always_on(genpd) (genpd->flags & GENPD_FLAG_ALWAYS_ON) > > #define genpd_is_active_wakeup(genpd) (genpd->flags & GENPD_FLAG_ACTIVE_WAKEUP) > > +#define genpd_is_cpu_domain(genpd) (genpd->flags & GENPD_FLAG_CPU_DOMAIN) > > > > static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev, > > const struct generic_pm_domain *genpd) > > @@ -1377,6 +1379,56 @@ static void genpd_free_dev_data(struct device *dev, > > dev_pm_put_subsys_data(dev); > > } > > > > +static void __genpd_update_cpumask(struct generic_pm_domain *genpd, > > + int cpu, bool set, unsigned int depth) > > +{ > > + struct gpd_link *link; > > + > > + if (!genpd_is_cpu_domain(genpd)) > > + return; > > With this test, we won't continue updating the cpumask for the other > masters. Is it done on purpose ? Correct, and yes it's on purpose. We are not even allocating the cpumask for the genpd in question, unless it has the GENPD_FLAG_CPU_DOMAIN set. [...] Kind regards Uffe