Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp302443yba; Wed, 15 May 2019 01:24:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1lfBSgg6d4GZEjQebe7yP9AupIU6w463rtyFRHMf1Ob2xSXe7R5GDi39d8KFoL858iiM4 X-Received: by 2002:aa7:9159:: with SMTP id 25mr14636231pfi.64.1557908697875; Wed, 15 May 2019 01:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557908697; cv=none; d=google.com; s=arc-20160816; b=OGpz2nPqPRyxMPVWFOcBwgYLSfm/CYd8z0trIP43bgWzovjD9SSCfGlsdorIY9NcQJ DEpSq4dz9MlBcAPUUsA2ZIUa3fKBjOdl2/aafBAW3inaRX9OH5rtmDKeXW1FEwp0TUEv BGw/H98g2lUus5wtmql+BmOhNmL0e509XVkEfIDjsh6faAgASEHNWZ3CidkIVW/EGlPN 0hGepD9dayYQ2JPZT+l/uJt/wiDl/OPPQgTAkFERHn1KJO+2ELiX6RSOc8fa41fZlBuQ NJ3NurtoNONdFkewloDLBzum8Sv/fr6Ctdu+JsQWzbRWOWmWMpTgr3+A+g48xScur0iy Cx0Q== 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 :message-id:date:subject:cc:to:from; bh=dMghp86FXVkDVyf3GZigWG4qglLJmw7+cMbbnL6Lo3M=; b=V35WrYrUZ1E+4eGseTQTisZJA9HShbJgkNlhp+33GvTksNvkHHMoY6lCG+ytOb5UtT xT4VJsq57/stKZhm8h6h6bgDypsKy0ICoWAqO/H3oFQShZndqbGjRuGmX5Afgfweg+wx y2kDiC5WM9Gq1A72HcS5EfGcTf71lpDVnYkwgw5ylsmHFxPPZdt275MHPRXKxCWIKs4V Q/Qbds9ysQ4jGbaD0qXRYHLvJ1/ePYr+M5TCLDAedEAp/wXQq2c8aOtlpqcWz9dqymuT k5xnfur804UVGAZI+ygXpxok0Eo6ChH4Qw6P54P6F8LevGd1D/mJtZ15GdAGmj27e+Hy Lj5Q== 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 o14si1233027pgv.74.2019.05.15.01.24.43; Wed, 15 May 2019 01:24:57 -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 S1726545AbfEOIX3 (ORCPT + 99 others); Wed, 15 May 2019 04:23:29 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37940 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbfEOIX3 (ORCPT ); Wed, 15 May 2019 04:23:29 -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 5D604374; Wed, 15 May 2019 01:23:28 -0700 (PDT) Received: from queper01-lin.cambridge.arm.com (queper01-lin.cambridge.arm.com [10.1.195.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ADAB23F703; Wed, 15 May 2019 01:23:25 -0700 (PDT) From: Quentin Perret To: edubezval@gmail.com, rui.zhang@intel.com, javi.merino@kernel.org, viresh.kumar@linaro.org, amit.kachhap@gmail.com, rjw@rjwysocki.net, will.deacon@arm.com, catalin.marinas@arm.com Cc: daniel.lezcano@linaro.org, dietmar.eggemann@arm.com, ionela.voinescu@arm.com, mka@chromium.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, quentin.perret@arm.com Subject: [PATCH v4 0/3] Make IPA use PM_EM Date: Wed, 15 May 2019 09:23:15 +0100 Message-Id: <20190515082318.7993-1-quentin.perret@arm.com> X-Mailer: git-send-email 2.21.0 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 Changes in v4: ************** - Added Viresh's Acked-by to all 3 patches - Improved commit message of patch 3/3 to explain how it has no functional impact on existing users (Eduardo) Changes in v3: ************** - Changed warning message for unordered tables to something more explicit (Viresh) - Changed WARN() into a pr_err() for consistency Changes in v2: ************** - Fixed patch 01/03 to actually enable CONFIG_ENERGY_MODEL - Added "depends on ENERGY_MODEL" to IPA (Daniel) - Added check to bail out if the freq table is unsorted (Viresh) Cover letter: ************* The Intelligent Power Allocator (IPA) thermal governor uses an Energy Model (or EM) of the CPUs to re-distribute the power budget. To do so, it builds a table of tuples where the power values are computed using the 'dynamic-power-coefficient' DT property. All of this is done in and only for the thermal subsystem, and more specifically for CPUs -- the power of other types of devices is obtained differently. Recently, the CPU scheduler has seen the introduction of Energy Aware Scheduling (EAS) patches, which also rely on an EM of the CPUs. This EM, however, is managed by an independent framework, called PM_EM, aimed to be used by all kernel subsystems interested in the power consumed by CPUs, and not only the scheduler. This patch series follows this logic and removes the (now redundant) thermal-specific EM computation code to migrate IPA to use PM_EM instead. Doing so should have no visible functional impact for existing users of IPA since: - during the 5.1 development cycle, a series of patches [1] introduced in PM_OPP some infrastructure (dev_pm_opp_of_register_em()) enabling the registration of EMs in PM_EM using the DT property used by IPA; - the existing upstream cpufreq drivers marked with the 'CPUFREQ_IS_COOLING_DEV' flag all call dev_pm_opp_of_register_em(), which means they all support PM_EM (the only two exceptions are qoriq-cpufreq which doesn't in fact use an EM and scmi-cpufreq which already supports PM_EM without using the PM_OPP infrastructurei because it read power costs directly from firmware); So, migrating IPA to using PM_EM should effectively be just plumbing since for the existing IPA users the PM_EM tables will contain the exact same power values that IPA used to compute on its own until now. The only new dependency is to compile in CONFIG_ENERGY_MODEL. Why is this migration still a good thing ? For three main reasons. 1. it removes redundant code; 2. it introduces an abstraction layer between IPA and the EM computation. PM_EM offers to EAS and IPA (and potentially other clients) standardized EM tables and hides 'how' these tables have been obtained. PM_EM as of now supports power values either coming from the 'dynamic-power-coefficient' DT property or obtained directly from firmware using SCMI. The latter is a new feature for IPA and that comes 'for free' with the migration. This will also be true in the future every time PM_EM gets support for other ways of loading the EM. Moreover, PM_EM is documented and has a debugfs interface which should help adding support for new platforms. 3. it builds a consistent view of the EM of CPUs across kernel subsystems, which is a pre-requisite for any kind of future work aiming at a smarter power allocation using scheduler knowledge about the system for example. [1] https://lore.kernel.org/lkml/20190204110952.16025-1-quentin.perret@arm.com/ Quentin Perret (3): arm64: defconfig: Enable CONFIG_ENERGY_MODEL PM / EM: Expose perf domain struct thermal: cpu_cooling: Migrate to using the EM framework arch/arm64/configs/defconfig | 1 + drivers/thermal/Kconfig | 1 + drivers/thermal/cpu_cooling.c | 238 ++++++++++++---------------------- include/linux/energy_model.h | 3 +- 4 files changed, 84 insertions(+), 159 deletions(-) -- 2.21.0