From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C502C433E1 for ; Thu, 30 Jul 2020 11:16:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16C1F2083E for ; Thu, 30 Jul 2020 11:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727807AbgG3LQm (ORCPT ); Thu, 30 Jul 2020 07:16:42 -0400 Received: from foss.arm.com ([217.140.110.172]:38316 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbgG3LQm (ORCPT ); Thu, 30 Jul 2020 07:16:42 -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 684C930E; Thu, 30 Jul 2020 04:16:41 -0700 (PDT) Received: from [10.37.12.66] (unknown [10.37.12.66]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 74C303F71F; Thu, 30 Jul 2020 04:16:38 -0700 (PDT) Subject: Re: [PATCH 2/2] thermal: cpufreq_cooling: Reuse effective_cpu_util() To: Viresh Kumar , Vincent Guittot Cc: Peter Zijlstra , Ingo Molnar , Zhang Rui , Daniel Lezcano , Amit Daniel Kachhap , Javi Merino , Amit Kucheria , linux-kernel , Quentin Perret , Rafael Wysocki , "open list:THERMAL" References: <20200716115605.GR10769@hirez.programming.kicks-ass.net> <681fb3e8-d645-2558-38de-b39b372499de@arm.com> <20200730062414.uq3ip7ukpu7nkiyg@vireshk-mac-ubuntu> From: Lukasz Luba Message-ID: Date: Thu, 30 Jul 2020 12:16:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200730062414.uq3ip7ukpu7nkiyg@vireshk-mac-ubuntu> 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 Hi Viresh, On 7/30/20 7:24 AM, Viresh Kumar wrote: > On 17-07-20, 11:46, Vincent Guittot wrote: >> On Thu, 16 Jul 2020 at 16:24, Lukasz Luba wrote: >>> On 7/16/20 12:56 PM, Peter Zijlstra wrote: >>>> Currently cpufreq_cooling appears to estimate the CPU energy usage by >>>> calculating the percentage of idle time using the per-cpu cpustat stuff, >>>> which is pretty horrific. >>> >>> Even worse, it then *samples* the *current* CPU frequency at that >>> particular point in time and assumes that when the CPU wasn't idle >>> during that period - it had *this* frequency... >> >> So there is 2 problems in the power calculation of cpufreq cooling device : >> - How to get an accurate utilization level of the cpu which is what >> this patch is trying to fix because using idle time is just wrong >> whereas scheduler utilization is frequency invariant > > Since this patch is targeted only towards fixing this particular > problem, should I change something in the patch to make it acceptable > ? > >> - How to get power estimate from this utilization level. And as you >> pointed out, using the current freq which is not accurate. > > This should be tackled separately I believe. > I don't think that these two are separate. Furthermore, I think we would need this kind of information also in future in the powercap. I've discussed with Daniel this possible scenario. We have a vendor who presented issue with the IPA input power and pointed out these issues. Unfortunately, I don't have this vendor phone but I assume it can last a few minutes without changing the max allowed OPP. Based on their plots the frequency driven by the governor is changing, also the idles are present during the IPA period. Please give me a few days, because I am also plumbing these stuff and would like to present it. These two interfaces: involving cpufreq driver or fallback mode for utilization and EM. Regards, Lukasz