Received: by 10.213.65.68 with SMTP id h4csp502834imn; Tue, 20 Mar 2018 08:22:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELu4nY5CvVvLdQ0HeEf63hzAEFXGDccq+pGeXtPvZ4ByiLaDVnSYOMqVqmNcPo33HF1csAOK X-Received: by 2002:a17:902:2f:: with SMTP id 44-v6mr17124679pla.187.1521559357561; Tue, 20 Mar 2018 08:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521559357; cv=none; d=google.com; s=arc-20160816; b=dpme8TnurkZLohw23bCwcUNTeyWFW6kmqzQFYyrwn/cs43vML3xdutfiJg3YqL186S O/sUKSp+5w+3qblOeD/karvWM48otzsoAtjTDnQ/QUcWQdKZhmN9PqD1nhFypJSt3gZ6 CsVMl+gcf6H1aQXycbHdi/Dmst3N5Ppop5TQw/BrLRwtupdQpblc8BTAs6llDJiUfbX6 qEHrvpTunLTflQPlaEm/hdmscWG+CgDijKzo6TAO6SvF5VZQN2/k4n0PXQJGRWArML64 joPps+RlC1nVxgV4DvZZnVfIpizuhuidVQr8AD4vXujwlzyRX/j1a9jyR/2QEZ9qgEbI LgfA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=DSNGsT478uA2h3zKb5j3sj7uWp5qci5ZTHi4zjR+SVw=; b=fPhrL9aKzAYxfXJ2lmmAKL69V9OJDlltMvgiCRlzHbJ4EJ6YQda8scXSZ9IuQDOshO b+7FELcAGBG6ws+MrlRt0Ua6uTKTAO0y7I/V/0c3V9RXDdWjWUgELcj5M1pd8PDiw9p7 765meBXNg0Tb2CVZ60fCQHbGvh6UlNsCdt9L8jwsNoKITgmCQii1zZqVFGHQfWV2K6tO LYxPaCMh738dRz55pzCXUbn8VCSBczIRzwfhxmWA2sGlUJBZlxS1pFBs9dvGrQy/g8/Q txJ9/bse6c0dnSe7/yPxe6iMZ0Y7qcSkw7qtrU5uHQpj1wYZtaEoT/rJc8cD1MuxMZv7 KrDQ== 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 a2-v6si1712239plp.544.2018.03.20.08.22.23; Tue, 20 Mar 2018 08:22:37 -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 S1751796AbeCTPVE (ORCPT + 99 others); Tue, 20 Mar 2018 11:21:04 -0400 Received: from foss.arm.com ([217.140.101.70]:41728 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbeCTPVB (ORCPT ); Tue, 20 Mar 2018 11:21:01 -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 715941529; Tue, 20 Mar 2018 08:21:00 -0700 (PDT) Received: from [0.0.0.0] (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5C0FD3F592; Tue, 20 Mar 2018 08:20:57 -0700 (PDT) Subject: Re: [RFC PATCH 6/6] drivers: base: arch_topology.c: Enable EAS for arm/arm64 platforms To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Quentin Perret , Thara Gopinath , linux-pm@vger.kernel.org, Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Todd Kjos , Joel Fernandes References: <20180320094312.24081-1-dietmar.eggemann@arm.com> <20180320094312.24081-7-dietmar.eggemann@arm.com> <20180320094932.GA23359@kroah.com> From: Dietmar Eggemann Message-ID: Date: Tue, 20 Mar 2018 16:20:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180320094932.GA23359@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/20/2018 10:49 AM, Greg Kroah-Hartman wrote: > On Tue, Mar 20, 2018 at 09:43:12AM +0000, Dietmar Eggemann wrote: >> From: Quentin Perret >> >> Energy Aware Scheduling (EAS) has to be started from the arch code. > > Ok, but: > >> This commit enables it from the arch topology driver for arm/arm64 >> systems, hence enabling a better support for Arm big.LITTLE and future >> DynamIQ architectures. > > Why does this have to be in the driver core code just for those specific > types of cpus? The arch_topology driver is shared functionality between arm and arm64 arch. So far it handles the correct setting of per-cpu cpu_scale values which are then used by the task scheduler to set the correct cpu capacity values. This allows to provide cpu invariant load tracking for arm and arm64 big.LITTLE systems. The driver was initially created so that we didn't had to duplicate the exact code in the arm and arm64 arch. Big.Little platforms have to set appropriate cpu node capacity-dmips-mhz properties (e.g. arch/arm64/boot/dts/arm/juno.dts) to enable the start the functionality of the driver. The cpu_scale value depends on the capacity-dmips-mhz property as well as on the max frequency of a logical cpu (hence the dependency to cpufreq). A corner case would be a big.little platform purely based on max frequency differences (e.g. Google Pixel, Qualcomm MSM8996 Snapdragon 821, Quad-core (2x2.15 GHz Kryo & 2x1.6 GHz Kryo)). For such a system capacity-dmips-mhz should be set to the same value for all logical cpus (e.g. 1024). We would like to use the same code (shared between arm and arm64) to initialize the energy model and start EAS for arm and arm64 systems. >> Cc: Greg Kroah-Hartman >> Signed-off-by: Quentin Perret >> --- >> drivers/base/arch_topology.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c >> index 52ec5174bcb1..e2206ea16538 100644 >> --- a/drivers/base/arch_topology.c >> +++ b/drivers/base/arch_topology.c >> @@ -15,6 +15,7 @@ >> #include >> #include >> #include >> +#include >> >> DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE; >> >> @@ -204,6 +205,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, >> free_raw_capacity(); >> pr_debug("cpu_capacity: parsing done\n"); >> schedule_work(&parsing_done_work); >> + init_sched_energy(); > > This is not arch-specific code only for arm. The driver requires CONFIG_GENERIC_ARCH_TOPOLOGY which is currently only set in arch/arm/Kconfig and arch/arm64/Kconfig. > Don't you have a ARM cpu bringup code somewhere? Shouldn't this call be > in there? It feels odd that this scheduler change is buried way down > here... The big benefit is that we don't have to duplicate code for arm and arm64. In the current form, EAS should only be started when cpufreq is initialized for all possible cpus. And we don't have to signal back from the driver to the arch that cpufreq is initialized for all possible cpus. I agree that none of this is obvious so the patch should explain the requirements and design better. -- Dietmar [...]