Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3553959imw; Thu, 7 Jul 2022 03:54:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tcqcYfn4Lk+CuIWl+odoxfpKUA8/6uf1mVAhpc1ckFHSf9BtCngJwc+shBjHRBKYxUwwnf X-Received: by 2002:a05:6402:510e:b0:435:9052:3b16 with SMTP id m14-20020a056402510e00b0043590523b16mr63629804edd.20.1657191250023; Thu, 07 Jul 2022 03:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657191250; cv=none; d=google.com; s=arc-20160816; b=wnnCcE6EAXY5QjXSdIEGfDDov5d+HKzQKIr1/IhfqJWqtRLmCch2piSVugkPE0yzkD itNCf07dhKEIJO+jXcvpmqRgADC4NBMoO8jISFGtC1tJNS8KLttbDfofFs6RuFOi9Tp4 Sh2qXmfFcflKnpm3WPBZeCXHknu88lRnCPKZkqWt4dN26lx9cL3Of4Uvj+EEUIN+oPno d58mdayTQxuje1VhA6zkVqPFs1t9td3buchwuPOCkeKStiepIrKWCiGNKsRQAfmICbK1 RiusJG9+5aGX4LR9lznAnH1eJqQi5vAv7Z/ouGDygETh/YWZldMRCm7OV0KU4YGFoxGh XoEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=hi9mSFgdRQ1KsXquyddbTXObC9bTZSrF6H6u/zfkijo=; b=LOfSzA+ki7YasBVRX+4vOB0wQCFlS+kt2IOkwSRqATawawHS2mlfCy9eamJAiWgmuD aFu2xhMmcxTe6S51JG6i0NNLexGewp5ElditMpK4jIDkZHkkwv41a5AO5JktrrpmpbfQ U2x1xmysp4cI6+NGXD/nluy9qT8ZdiKrfcTUL9q+XMO8iUONVf00x2gWEhwK952vQpPZ v6EvBR3ySt7cbnrIW9mxbnFlDALKKJvquEkKl13gyvQYjOpOyWApzSPr5gQVZq3WDZV7 USEWjAd7cbzchSftbAui3otm4ORbtlctOcGX8Nt3j4HIjG3i2pgFdjRPksJYXWO9Paoy C9WA== 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 di11-20020a170906730b00b0072aebf9cc60si3260179ejc.619.2022.07.07.03.53.42; Thu, 07 Jul 2022 03:54:10 -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 S234508AbiGGKpC (ORCPT + 99 others); Thu, 7 Jul 2022 06:45:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231710AbiGGKpB (ORCPT ); Thu, 7 Jul 2022 06:45:01 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4AFB445055; Thu, 7 Jul 2022 03:45:00 -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 301BE1063; Thu, 7 Jul 2022 03:45:00 -0700 (PDT) Received: from [10.57.11.194] (unknown [10.57.11.194]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F1F4A3F792; Thu, 7 Jul 2022 03:44:56 -0700 (PDT) Message-ID: Date: Thu, 7 Jul 2022 11:44:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2 1/4] PM: EM: convert power field to micro-Watts precision and align drivers Content-Language: en-US To: Daniel Lezcano Cc: amitk@kernel.org, rui.zhang@intel.com, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, rafael@kernel.org, dietmar.eggemann@arm.com, nm@ti.com, sboyd@kernel.org, sudeep.holla@arm.com, cristian.marussi@arm.com, matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org References: <20220707071555.10085-1-lukasz.luba@arm.com> <20220707071555.10085-2-lukasz.luba@arm.com> <9b4bd8b5-d5d9-7f75-128a-87b727ad0bd7@linaro.org> From: Lukasz Luba In-Reply-To: <9b4bd8b5-d5d9-7f75-128a-87b727ad0bd7@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,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 On 7/7/22 09:31, Daniel Lezcano wrote: > On 07/07/2022 09:15, Lukasz Luba wrote: >> The milli-Watts precision causes rounding errors while calculating >> efficiency cost for each OPP. This is especially visible in the 'simple' >> Energy Model (EM), where the power for each OPP is provided from OPP >> framework. This can cause some OPPs to be marked inefficient, while >> using micro-Watts precision that might not happen. >> >> Update all EM users which access 'power' field and assume the value is >> in milli-Watts. >> >> Solve also an issue with potential overflow in calculation of energy >> estimation on 32bit machine. It's needed now since the power value >> (thus the 'cost' as well) are higher. >> >> Example calculation which shows the rounding error and impact: >> >> power = 'dyn-power-coeff' * volt_mV * volt_mV * freq_MHz >> >> power_a_uW = (100 * 600mW * 600mW * 500MHz) / 10^6 = 18000 >> power_a_mW = (100 * 600mW * 600mW * 500MHz) / 10^9 = 18 >> >> power_b_uW = (100 * 605mW * 605mW * 600MHz) / 10^6 = 21961 >> power_b_mW = (100 * 605mW * 605mW * 600MHz) / 10^9 = 21 >> >> max_freq = 2000MHz >> >> cost_a_mW = 18 * 2000MHz/500MHz = 72 >> cost_a_uW = 18000 * 2000MHz/500MHz = 72000 >> >> cost_b_mW = 21 * 2000MHz/600MHz = 70 // <- artificially better >> cost_b_uW = 21961 * 2000MHz/600MHz = 73203 >> >> The 'cost_b_mW' (which is based on old milli-Watts) is misleadingly >> better that the 'cost_b_uW' (this patch uses micro-Watts) and such >> would have impact on the 'inefficient OPPs' information in the Cpufreq >> framework. This patch set removes the rounding issue. >> >> Signed-off-by: Lukasz Luba > > Acked-by: Daniel Lezcano > > > Thanks Daniel! I'll ping Rafael to take this via his PM tree