From patchwork Thu Jul 6 09:49:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 107104 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1883110qge; Thu, 6 Jul 2017 02:52:29 -0700 (PDT) X-Received: by 10.99.104.74 with SMTP id d71mr26035084pgc.7.1499334749725; Thu, 06 Jul 2017 02:52:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499334749; cv=none; d=google.com; s=arc-20160816; b=H2cWvxKcPnhwncDEdGMhw+j+FXjbuK0kRlqxePer9yk+bWgEdnf2F+aPHCc9wiPcRo +jZ12hPpcqYuGi39otWUhCVVewj61LpDhQP/JHsL8rX+DhrzQ/B3brW1tdpyRMOUOvCp wZux9UF4wwj72FXK/UdrxoS2q5EcgaNeVHe9rZF4yWShp5ygESYjqDxQTF6P+mdwVl8h boKpSPOBCCOM7WED3aJ9jwFuM8S8+NIHAFntmn4859vCYU+GrfFES4TpJnnJsPpnxR8J 3tZloTozCcYQlWTV19GZrIIHAISnjVyzxwvbUdKsysYeh58JfcqBrBxjPH5AgQ9pPbx1 Nicg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=WQaXGd4c/AVkQ+RWNBAJwrz+U+lhTpfcC8QTwNyw3VQ=; b=XnrhanEz9A0akkH3/97TecmHsEFdH1QvfMp1uef/mULMH2BI4dBGk2YHY6UxOPXALq CJhl6NspzLrAJVG5oXAnOIg1+KqEDx56HQfPjau015bgh1dxObSry5au7sSln91u1htA oYzdyZjHkUFbWmKScXIbc1yuLp9kyMjn/RM3hrqtPjrOWxq9etFP/R6p8o3PuXMGh9oT N2I7VjZhywXGhAbKttc3BgMG65ofbJC4KJ5HUiCN+O7LfUeaB7T7CA00kId07jRWSHqX V2n1AnhUwyUkGPkaxjeXZssXbqr1rqUot9/3E4S63PJBln3XPVP6FXO8pyBZuVkl6fGs l5PA== 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 x5si1133541pgj.373.2017.07.06.02.52.29; Thu, 06 Jul 2017 02:52:29 -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 S1752655AbdGFJwH (ORCPT + 25 others); Thu, 6 Jul 2017 05:52:07 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36044 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752167AbdGFJuV (ORCPT ); Thu, 6 Jul 2017 05:50:21 -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 CDFBA80D; Thu, 6 Jul 2017 02:50:15 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CDB873F3E1; Thu, 6 Jul 2017 02:50:13 -0700 (PDT) From: Dietmar Eggemann To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux@arm.linux.org.uk, Greg Kroah-Hartman , Russell King , Catalin Marinas , Will Deacon , Juri Lelli , Vincent Guittot , Peter Zijlstra , Morten Rasmussen , Viresh Kumar , "Rafael J . Wysocki" Subject: [PATCH v2 00/10] arm, arm64: frequency- and cpu-invariant accounting support for task scheduler Date: Thu, 6 Jul 2017 10:49:38 +0100 Message-Id: <20170706094948.8779-1-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For a more accurate (i.e. frequency- and cpu-invariant) load-tracking the task scheduler needs a frequency-scaling and on a heterogeneous system a cpu-scaling correction factor. This patch-set implements a Frequency Invariance Engine (FIE) (topology_get_freq_scale()) in drivers/base/arch_topology.c to provide a frequency-scaling correction factor. During the v1 [1] review Viresh Kumar pointed out that such a FIE based on cpufreq transition notifier will not work with future cpufreq policies supporting fast frequency switching. To include support for fast frequency switching policies the FIE implementation has been changed. Whenever there is a frequency change cpufreq now calls the arch specific function arch_set_freq_scale() which has to be implemented by the architecture. In case the arch does not specify this function FIE support is compiled out of cpufreq. The advantage is that this would support fast frequency switching since it does not rely on cpufreq transition (or policy) notifier anymore. The Cpu Invariance Engine (CIE) (topology_get_cpu_scale()) providing a cpu-scaling correction factor was already introduced by the "Fix issues and factorize arm/arm64 capacity information code" patch-set [2]. This patch-set also enables the frequency- and cpu-invariant accounting support. Enabling here means to associate (wire) the task scheduler function name arch_scale_freq_capacity and arch_scale_cpu_capacity with the FIE and CIE function names from drivers/base/arch_topology.c. This replaces the task scheduler's default FIE and CIE in kernel/sched/sched.h. There is an additional patch [10/10] in v2 which allows inlining of the FIE and CIE into the appropriate task scheduler functions. +------------------------------+ +------------------------------+ | | | | | cpufreq: | | arch: | | | | | | arch_set_freq_scale() +-----------> topology_set_freq_scale() | | | | | +------------------------------+ | | | | +------------------------------+ | | | | | | | task scheduler: | | | | | | | | arch_scale_freq_capacity() +-----------> topology_get_freq_scale() | | | | | | arch_scale_cpu_capacity() +-----------> topology_get_cpu_scale() | | | | | +------------------------------+ +------------------------------+ Patch high level description: [ 01/10] Fix to free cpumask cpus_to_visit [ 02/10] Let cpufreq provide current and max supported frequency for the set of related cpus [ 03/10] Frequency Invariance Engine (FIE) [ 04/10] Connect cpufreq input data to FIE on arm [05,06/10] Enable frequency- and cpu-invariant accounting support on arm [ 07/10] Connect cpufreq input data to FIE on arm64 [08,09/10] Enable frequency- and cpu-invariant accounting support on arm64 [ 10/10] Allow CIE and FIE inlining Changes v1->v2: - Rebase on top of next-20170630 - Add fixup patch to free cpumask cpus_to_visit [01/10] - Propose solution to support fast frequency switching [02-04,07/10] - Add patch to allow CIE and FIE inlining [10/10] The patch-set is based on top of linux-next/master (tag: next-20170630) and it is also available from: git://linux-arm.org/linux-de.git upstream/freq_and_cpu_inv_v2 It has been tested on TC2 (arm) and JUNO (arm64) by running a ramp-up rt-app task pinned to a cpu with the ondemand cpufreq governor and checking the load-tracking signals of this task. [1] https://marc.info/?l=linux-kernel&m=149690865010019&w=2 [2] https://marc.info/?l=linux-kernel&m=149625018223002&w=2 Dietmar Eggemann (10): drivers base/arch_topology: free cpumask cpus_to_visit cpufreq: provide data for frequency-invariant load-tracking support drivers base/arch_topology: frequency-invariant load-tracking support arm: wire cpufreq input data for frequency-invariant accounting up to the arch arm: wire frequency-invariant accounting support up to the task scheduler arm: wire cpu-invariant accounting support up to the task scheduler arm64: wire cpufreq input data for frequency-invariant accounting up to the arch arm64: wire frequency-invariant accounting support up to the task scheduler arm64: wire cpu-invariant accounting support up to the task scheduler drivers base/arch_topology: inline cpu- and frequency-invariant accounting arch/arm/include/asm/topology.h | 11 +++++++++++ arch/arm/kernel/topology.c | 1 - arch/arm64/include/asm/topology.h | 11 +++++++++++ arch/arm64/kernel/topology.c | 1 - drivers/base/arch_topology.c | 30 ++++++++++++++++++++++++------ drivers/cpufreq/cpufreq.c | 26 ++++++++++++++++++++++++++ include/linux/arch_topology.h | 20 +++++++++++++++++++- 7 files changed, 91 insertions(+), 9 deletions(-) -- 2.11.0