Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5350346yba; Wed, 8 May 2019 11:48:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJMtrXMt7C01SWVoyI/lAbePyyRXNDS/UAf/XTQzIpsm38axgsxFlwT/nnl+7HxFqN2iUL X-Received: by 2002:a17:902:aa97:: with SMTP id d23mr10055023plr.313.1557341323616; Wed, 08 May 2019 11:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557341323; cv=none; d=google.com; s=arc-20160816; b=IkFy3nErRlkFJQ33bfIN/Zh4SwaTH7b/Y9M4q9jjbXZJK5HC1pXDZezSEl/aHpOUJE NixtvMwJ2ySb4HpoH+uU4oAG83qA0elaiZTIw8TnWaxOZUedDbXnd/QPLwq3ubqBZYyw AdbCY9cElNx/+NED05CjY5mdqw/+xFRbne+etFvOoIL+mOowELXnJP7YFVfYp/8YTlFP H9myIwJqDFrsGrEQHSi23e8onDgr3eMKADZnTYYoR0uXFTEBI/4kn6zM0NXVOa4+bHL8 VIy2LbfqdjVcEWaJqwz5JIgHwkB1xFuKrcqMnlgIvU9B5PLWdfMzbQ41vr0B2r/XZsxG 83IA== 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; bh=VQHOhY9E/KfrLYTez5nQhFlRAyQldBYGuqbFNbnbYok=; b=dnS3hwzPS4b/8pErgYYGE2d+bvmffeRIlU54i2zUQmVPFki+jZQRy4zsIiEK93RBgs QyxBZbCMbIvgncjCyGzYtFeqO2qzNMo4pggwkWEcOMGT3dHfdwjLXALQd++6JaFUMFbx sQD1fSV3Q83BA6llJhiBXH2/jpMA7lQVwjEBR1d0GnQsivY1fUY/iakCw+ZYtYemV+3B Q6EsWeh7l5w/JBEPj84+19Y9DuFd/0mfBBNZrbeqlVL/5nI+3JQkN/pUVVatatpF/2z3 XI2oZ/lqs3A9FewerAhpizF3GCvsgkIkytLIz1TNhRPYHv1t5eg9cVLeKpCSY6Ye6S5W bs8Q== 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 p63si5786739pfi.23.2019.05.08.11.48.27; Wed, 08 May 2019 11:48:43 -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 S1729155AbfEHRnm (ORCPT + 99 others); Wed, 8 May 2019 13:43:42 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41800 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729059AbfEHRnM (ORCPT ); Wed, 8 May 2019 13:43:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CE56415AB; Wed, 8 May 2019 10:43:11 -0700 (PDT) Received: from e107049-lin.arm.com (e107049-lin.cambridge.arm.com [10.1.195.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 536C23F575; Wed, 8 May 2019 10:43:10 -0700 (PDT) From: douglas.raillard@arm.com To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, quentin.perret@arm.com, douglas.raillard@arm.com, patrick.bellasi@arm.com, dietmar.eggemann@arm.com Subject: [RFC PATCH 2/7] sched/cpufreq: Attach perf domain to sugov policy Date: Wed, 8 May 2019 18:42:56 +0100 Message-Id: <20190508174301.4828-3-douglas.raillard@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190508174301.4828-1-douglas.raillard@arm.com> References: <20190508174301.4828-1-douglas.raillard@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas RAILLARD Attach an Energy Model perf_domain to each sugov_policy to prepare the ground for energy-aware schedutil. Signed-off-by: Douglas RAILLARD --- kernel/sched/cpufreq_schedutil.c | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index d0f4d2111bfe..82dbacf83649 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -39,6 +39,10 @@ struct sugov_policy { bool work_in_progress; bool need_freq_update; + +#ifdef CONFIG_ENERGY_MODEL + struct em_perf_domain *pd; +#endif }; struct sugov_cpu { @@ -64,6 +68,38 @@ static DEFINE_PER_CPU(struct sugov_cpu, sugov_cpu); /************************ Governor internals ***********************/ +#ifdef CONFIG_ENERGY_MODEL +static void sugov_policy_attach_pd(struct sugov_policy *sg_policy) +{ + struct em_perf_domain *pd; + struct cpufreq_policy *policy = sg_policy->policy; + + sg_policy->pd = NULL; + pd = em_cpu_get(policy->cpu); + if (!pd) + return; + + if (cpumask_equal(policy->related_cpus, to_cpumask(pd->cpus))) + sg_policy->pd = pd; + else + pr_warn("%s: Not all CPUs in schedutil policy %u share the same perf domain, no perf domain for that policy will be registered\n", + __func__, policy->cpu); +} + +static struct em_perf_domain *sugov_policy_get_pd( + struct sugov_policy *sg_policy) +{ + return sg_policy->pd; +} +#else /* CONFIG_ENERGY_MODEL */ +static void sugov_policy_attach_pd(struct sugov_policy *sg_policy) {} +static struct em_perf_domain *sugov_policy_get_pd( + struct sugov_policy *sg_policy) +{ + return NULL; +} +#endif /* CONFIG_ENERGY_MODEL */ + static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) { s64 delta_ns; @@ -849,6 +885,9 @@ static int sugov_start(struct cpufreq_policy *policy) sugov_update_shared : sugov_update_single); } + + sugov_policy_attach_pd(sg_policy); + return 0; } -- 2.21.0