Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2316159ybd; Thu, 27 Jun 2019 10:16:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgNOiVWyCpy2j5vVbeFFIwEHhKZ24gwuS4gqsylAQo56JodgH10YvLsHiE3EkJQhTgU5Kk X-Received: by 2002:a17:90a:3344:: with SMTP id m62mr3091678pjb.135.1561655808359; Thu, 27 Jun 2019 10:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561655808; cv=none; d=google.com; s=arc-20160816; b=RkecQQRvUivBTuEA9Fd05Nw5FFBCOG7qCej5yuURnUdCVqK9FVMrwIBM2esSXg2QFH hdiol5v/jeMxfgG04ncSZA9XRVO0mg2fvJG49Xc9drvaEghf7iF6YKu3QOJKrwFiZKtP 9rllxUwW650KzmyvV7WVtCUT14dQWdYfcm4J+SLKPqiV+CC4FDjpGQ7oymD1SIwnIyit Fd6fptLGZklSloq1FYsxeuhlPHeFhuqiTXntUxxB4wjQQ2k0OViYtsRnIyHJcF6ogIzw NryBvUaQ06L/55eae8RU5MgAbizmX9OZrKFrTjpe1nBlHhWkezTqYvjKkY72/UqnXtAR Mw+w== 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=ZIQf88f2iEUVJE8VpJkCGeobgX1njsYUnRXiYDJY4lc=; b=QXiaeBIcMYaPrGBilxKW92lVkHv0eCpo7V39J1dPepwyDAYHU5idi/8H2pSysKBkvd e/gVsIzQcohtiSIwhfyaykxGa4twfNBq32rI7PZ2Can5Mvz5065m5bkpMh1MW3mshoZr X0jylvyIdK96HuL7cqLtQXbwtBS032FLuN937vW/870T3W4L/WVDz7zvpHpqgtfm1K7E /0YRjXMAp2X8dn/jajnsv4b5Xic4tyWDXRyJYjU8RXVTLzFp3MUCAsHcCd/QUbU+E9Wc VbYey25HWgLMVw34q5L6tVTpa3itgu+YGMywNN+EqWV7rsAiu2G4+3xY6DMDzw96eU18 e0ug== 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 x24si146049pfm.83.2019.06.27.10.16.32; Thu, 27 Jun 2019 10:16:48 -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 S1726646AbfF0RQX (ORCPT + 99 others); Thu, 27 Jun 2019 13:16:23 -0400 Received: from foss.arm.com ([217.140.110.172]:59226 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbfF0RQV (ORCPT ); Thu, 27 Jun 2019 13:16:21 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F0194142F; Thu, 27 Jun 2019 10:16:20 -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 9AFBA3F718; Thu, 27 Jun 2019 10:16:19 -0700 (PDT) From: Douglas RAILLARD To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, quentin.perret@arm.com, douglas.raillard@arm.com, patrick.bellasi@arm.com, dietmar.eggemann@arm.com Subject: [RFC PATCH v2 2/5] sched/cpufreq: Attach perf domain to sugov policy Date: Thu, 27 Jun 2019 18:16:00 +0100 Message-Id: <20190627171603.14767-3-douglas.raillard@arm.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190627171603.14767-1-douglas.raillard@arm.com> References: <20190627171603.14767-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 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 9c0419087260..0a3ccc20adeb 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -41,6 +41,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 { @@ -65,6 +69,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; @@ -850,6 +886,9 @@ static int sugov_start(struct cpufreq_policy *policy) sugov_update_shared : sugov_update_single); } + + sugov_policy_attach_pd(sg_policy); + return 0; } -- 2.22.0