Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7183904imm; Tue, 28 Aug 2018 07:44:29 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbg35tw8qKMHYCXRZsyMHh+YonJVwhnKITnQ389TG6yM75wmsu3phSRt4PfOeEuCDfIIhR7 X-Received: by 2002:a62:c008:: with SMTP id x8-v6mr1929370pff.149.1535467469300; Tue, 28 Aug 2018 07:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535467469; cv=none; d=google.com; s=arc-20160816; b=f1b602fjWjTJpKQ4xzWQjBIBvxV+XOWL9r9680pGyPSkjpJ4glEhca7EfL1aa3bpYI MFgKRp8+tEVDEOXog8jU7CcrBacWsdrf1Nwqy61Cm3eHnD4sDiddWfKjbf/TNEZxKXcJ wGXduy5eZsSZz4JD25wYLgqbmbqmkiRcjQY4RPovuC7HmyVBBK4uFN4vJgZ3QLLL/A3G KukdzLJCZEA02h/L6zp+lBGKTGmRwVxsa7U1cNvSe1tloDvr1pJlafADugeCkmGC706H 7squGL/7xapDwrYfKpB1QEa2YwignKSxRDuT2jr5lU5caKEy3m7t523hK8rHDSQjL4aC E05Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=egX5CwpvxZFYVzdEl7dD/V6sVKc91DJA83Ym8q3fH8Q=; b=llS0sXmj5RdGcjBnVyPjjMPN6QFhLNVmLFAvHiv/sxh+8NcsvbSPZqNMlRp+l0ApEB eA+uMydxAOvdWHSmU+DdyQuowHTuCuSJp+jnE7fxZfQ1HYnq8nt20kqXCp1bjE8ekSjQ KI5n9ecWlsDrO1MC9F78BPLzUMz06fPx2qP7eDy4yb6HU47mhew6isoGAA5IpoTxpQql 0y6CqB14kpYxk1q4rAE80dQOpwcdUjlerdgfZXndblUirJrK6T9ocr9MZcy2hEttzJVM FhF+9prHOnsoJHMXE8+N/wXdkuT/XcNolYrFiA2ZrqqK5vr5S46H0Ekj1E1nSUszuAOw gJHg== 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 w4-v6si1175079pgj.566.2018.08.28.07.44.13; Tue, 28 Aug 2018 07:44: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 S1728195AbeH1SeK (ORCPT + 99 others); Tue, 28 Aug 2018 14:34:10 -0400 Received: from foss.arm.com ([217.140.101.70]:39454 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727176AbeH1SeK (ORCPT ); Tue, 28 Aug 2018 14:34:10 -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 41F9B18A; Tue, 28 Aug 2018 07:42:11 -0700 (PDT) Received: from localhost (e105922-lin.emea.arm.com [10.4.13.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D93A43F557; Tue, 28 Aug 2018 07:42:10 -0700 (PDT) From: Punit Agrawal To: Vincent Guittot Cc: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, Eduardo Valentin , viresh kumar , linux-kernel , "open list\:THERMAL" Subject: Re: [PATCH] dt-binding: arm/cpus.txt: fix dynamic-power-coefficient unit References: <1534869685-22221-1-git-send-email-vincent.guittot@linaro.org> <87ftz6ww1h.fsf@e105922-lin.cambridge.arm.com> Date: Tue, 28 Aug 2018 15:42:09 +0100 In-Reply-To: (Vincent Guittot's message of "Wed, 22 Aug 2018 16:32:39 +0200") Message-ID: <87k1oaa6ym.fsf@e105922-lin.cambridge.arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vincent Guittot writes: > Hi Amit, > > On Wed, 22 Aug 2018 at 12:11, Punit Agrawal wrote: >> >> Hi Vincent, >> >> Thanks for the patch. One comment about the choice of units below. >> >> Vincent Guittot writes: >> >> > The unit of dynamic-power-coefficient is described as mW/MHz/uV^2 whereas >> > its usage in the code assumes that unit is mW/GHz/V^2 >> >> Instead of choosing GHz as the base, I'd prefer to use uW/MHz/V^2. It'll >> avoid introducing fractional GHz value for frequency calculations. > > I don't understand your concern about fractional Ghz value for > frequency calculation ? > I mean, why it's a problem for frequency with Ghz vs Mhz but not a > problem for voltage with V vs mV ? > Don't we have the same "problem" in both case ? You're right. It's the same problem in both cases. >> >> > In drivers/thermal/cpu_cooling.c, the code is : >> > >> > power = (u64)capacitance * freq_mhz * voltage_mv * voltage_mv; >> > do_div(power, 1000000000); >> > >> > which can be summarized as : >> > power (mW) = capacitance * freq_mhz/1000 * (voltage_mv/1000)^2 >> >> Which would then translate to - >> >> power (mW) = power (uW) / 1000 = capacitance * freq_mhz * (voltage_mv/1000)^2 > > Not sure that the equation above is correct. If we consider uW/MHz/V^2 > for the unit, the equation becomes : > power (mW) = power (uW) / 1000 = capacitance * freq_mhz * > (voltage_mv/1000)^2 / 1000 Yes, I missed the "/ 1000" at the end. > which can be rearranged as > power (mW) = power (uW) / 1000 = capacitance * freq_mhz/ 1000 * > (voltage_mv/1000)^2 > > TBH, I don't really mind between mW/GHz/V^2 or uW/MHz/V^2 as they are > the same at the end > but I don't catch your reasoning The problem I was thinking of doesn't hold as it's the same issue with voltage. One benefit to go with uW/MHz/V^2 might be the extra resolution that it provides. I'd prefer to go with uW/MHz/V^2 if there's no compelling reason to go with anything else. [...] >> > >> > Furthermore, if we test basic values like : >> > voltage_mv = 1000mV = 1V >> > freq_mhz = 1000Mhz = 1Ghz >> > >> > The minimum possible power, when dynamic-power-coefficient equals 1, will >> > be : >> > min power = 1 * 1000 * (1000000)^2 = 10^15 mW >> > which is not realistic >> > >> > With the unit used by the code, the min power is >> > min power = 1 * 1 * 1^2 = 1mW which is far more realistic >> > >> > Signed-off-by: Vincent Guittot >> > --- >> > Documentation/devicetree/bindings/arm/cpus.txt | 4 ++-- >> > 1 file changed, 2 insertions(+), 2 deletions(-) >> > >> > diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt >> > index 29e1dc5..0148d7d 100644 >> > --- a/Documentation/devicetree/bindings/arm/cpus.txt >> > +++ b/Documentation/devicetree/bindings/arm/cpus.txt >> > @@ -274,7 +274,7 @@ described below. >> > Usage: optional >> > Value type: >> > Definition: A u32 value that represents the running time dynamic >> > - power coefficient in units of mW/MHz/uV^2. The >> > + power coefficient in units of mW/GHz/V^2. The >> > coefficient can either be calculated from power >> > measurements or derived by analysis. >> > >> > @@ -285,7 +285,7 @@ described below. >> > >> > Pdyn = dynamic-power-coefficient * V^2 * f >> > >> > - where voltage is in uV, frequency is in MHz. >> > + where voltage is in V, frequency is in GHz. >> > >> > Example 1 (dual-cluster big.LITTLE system 32-bit):