Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1422245pxb; Wed, 6 Apr 2022 18:31:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz+8Kzb8PiXQBD9Z4qcz4HV0OFQxBxXtXy5c0toRcdD4C+VxaAB0WZwPSWBWOnLOYaWUbK X-Received: by 2002:a17:906:6a1d:b0:6e8:35a:4439 with SMTP id qw29-20020a1709066a1d00b006e8035a4439mr11402924ejc.734.1649295099323; Wed, 06 Apr 2022 18:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649295099; cv=none; d=google.com; s=arc-20160816; b=ibpAPVEmkJL61pmTF0XLGKSfG53gOXMNvoWBIpgmqTe26KKFxiashf5H6hyjDWOdED JoG6fLfM4VZkebaGQNImHRhmc9n7tjfuJZodqawPbQruCooPmEEJ678TpjtL7iz4EMAK ymYQbAyJ4IQuwhWxIoXirOwz7n54Vs+WofX8T4a0VeDCh9ictCIRKQl8iBAWz4e8jg3L dhSGGnMXsJbSBcl9N8epliW61LPhMm67+6BPG7mi8b3ng8IlgC8ceVmzeEiyu8Air409 3osTncEEQJGzb+vBpvknQZdD4f3r2PzqtLP9OMGLWVMI2w2fYimi+ZVIMVCTrMdTP9zh GxGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=7m3ZkrCFvPaZzUrXPvWlSgkUbpXW9lCURCJSiWSmsjk=; b=sGeG1H7REfoWyy9lAJdEs1sl0yobjMH1ILabavcSAf0XGTWnk8hYiSEnhz4eCdYLnf zcksjGjgvaFMqQXLry68xG4BaW7QClfYKK3ei0JKFX8JR7MUTmZpUOpnHNCJddOF4Jos R1kpIPCTxQiIxu4DM01GR3XM2HmzxtrpJbVo20Z+O7jVk3tRHRsfSbaOz+1STwfSdFsy ypYKVY1K2ovzLXmN1qX9vSdLlALcfJyLQU1qCxYxgVcG8X9wDIO+WE0vaGEFEfs6rYg7 7J14VWLrP+FVXRZ28gycVAQVT6n7zj5OsQEAzO8jg0WooDMkqek3ah1lg2j+4FsV95hq T0UQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jt8-20020a170906ca0800b006dfebfbd77fsi12381310ejb.265.2022.04.06.18.31.13; Wed, 06 Apr 2022 18:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236888AbiDFWKY (ORCPT + 99 others); Wed, 6 Apr 2022 18:10:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiDFWKX (ORCPT ); Wed, 6 Apr 2022 18:10:23 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71BB312D0B6; Wed, 6 Apr 2022 15:08:25 -0700 (PDT) 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 3B69112FC; Wed, 6 Apr 2022 15:08:25 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.9.217]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4CC4A3F5A1; Wed, 6 Apr 2022 15:08:23 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org Cc: lukasz.luba@arm.com, dietmar.eggemann@arm.com, viresh.kumar@linaro.org, rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com, amit.kachhap@gmail.com, linux-pm@vger.kernel.org Subject: [RFC PATCH v3 0/5] Introduce Cpufreq Active Stats Date: Wed, 6 Apr 2022 23:08:04 +0100 Message-Id: <20220406220809.22555-1-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, This is the 3rd version of patch set which tries to address issues which are due to missing proper information about CPU performance in time. The issue description: 1. "Cpufreq statistics cover the time when CPUs are in idle states, so they are not suitable for certain purposes, like thermal control." Rafael [2] 2. Thermal governor Intelligent Power Allocation (IPA) has to estimate power, for the last period, e.g. 100ms, for each CPU in the Cluster, to grant new power and set max possible frequency. Currently in some cases it gets big error, when the frequency of CPU changed in the middle. It is due to the fact that IPA reads the current frequency for the CPU, not aware of all other frequencies which were actively (not in idle) used in the last 100ms. This code focuses on tracking the events of idle entry/exit for each CPU and combine them with the frequency tracked statistics inside internal statistics arrays (per-CPU). In the old cpufreq stats we have one shared statistics array for the policy (all CPUs) and not take into account periods when each CPU was in idle. Sometimes the IPA error between old estimation signal and reality is quite big (>50%). changelog: v3: - moved the core implementation into the cpufreq and not creating a new framework (as sugested by Rafael) - updated all function names and APIs v2 [1] Regards, Lukasz Luba [1] https://lore.kernel.org/all/20210706131828.22309-1-lukasz.luba@arm.com/ [2] https://lore.kernel.org/all/CAJZ5v0gzpfT__EyrVuZSr32ms7-YJZw7qEok0WZECv1iDRRvWA@mail.gmail.com/ Lukasz Luba (5): cpufreq: stats: Introduce Cpufreq Active Stats cpuidle: Add Cpufreq Active Stats calls tracking idle entry/exit thermal: Add interface to cooling devices to handle governor change thermal: power allocator: Prepare power actors and calm down when not used thermal: cpufreq_cooling: Improve power estimation using Cpufreq Active Stats MAINTAINERS | 2 +- drivers/cpufreq/cpufreq_stats.c | 872 ++++++++++++++++++++++++++ drivers/cpuidle/cpuidle.c | 5 + drivers/thermal/cpufreq_cooling.c | 131 ++++ drivers/thermal/gov_power_allocator.c | 71 +++ include/linux/cpufreq_stats.h | 131 ++++ include/linux/thermal.h | 1 + 7 files changed, 1212 insertions(+), 1 deletion(-) create mode 100644 include/linux/cpufreq_stats.h -- 2.17.1