All of lore.kernel.org
 help / color / mirror / Atom feed
* Computing the dynamic-power-coefficient on Exynos5422
@ 2018-07-20 14:15 Oliver Effland
  2018-07-20 15:36 ` Russell King - ARM Linux
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Oliver Effland @ 2018-07-20 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hello everyone,

I hope this is the right place to ask, otherwise please just point me in the right direction.

I'm currently testing the EAS patches [v4] on an ODROID-XU3 board, which has an Exynos5422 SoC. However, the corresponding DT is missing the "dynamic-power-coefficient" that is needed for an appropriate EM.
So I'm trying to compute the dynamic-power-coefficient according to the formula:

Pdyn = dynamic-power-coefficient * V^2 * f

The frequency f is given by the DT.The actual Voltage and Power are determined by means of the on-chip sensors (returns the values for the specific cluster). When using the Voltage given in the DT, the differences for the d-p-coefficient are negligible.

So I'm calculating the d-p-coefficient (mW/MHz/uV^2) by reading out the following SoC sensor values.

For the little cluster (A7):
frequency(MHz)  Voltage(V)  Power(mW)	Dynamic-power-coefficient
 200		0.9175	     49.470	~2.938*10^-13
 400		0.9165	     91.892	~2.736*10^-13
 600		0.9638	    149.454	~2.682*10^-13
 800		1.0263	    223.453	~2.652*10^-13
1000		1.1000	    327.707	~2.708*10^-13
1200		1.1725	    445.899	~2.703*10^-13
1400		1.2713	    627.010	~2.771*10^-13

For the big cluster (A15):
frequency(MHz)  Voltage(V)  Power(mW)	Dynamic-power-coefficient
 200		0.9162	     159.676	~9.510*10^-13
 500		0.9138	     325.480	~7.797*10^-13
 800		0.9288	     511.360	~7.410*10^-13
1100		1.0063	     828.020	~7.434*10^-13
1400		1.0713	    1209.774	~7.530*10^-13
1700		1.1750	    1835.784	~7.822*10^-13
2000		1.2700	    2661.849	~8.252*10^-13


But those values are way off for the DT, unless I multiply the d-p-coefficient with 10^15.

Assuming the Power value needs to be subtracted by a static component (power usage when idle), the results change as follows:

For the little cluster (A7):
frequency(MHz)  Voltage(V)  P-dyn(mW)	Dynamic-power-coefficient
 200		0.9175	    36,381 	~2,160*10^-13
 400		0.9165	    73,438	~2,186*10^-13
 600		0.9638	    122,470	~2,197*10^-13
 800		1.0263	    184,135	~2,185*10^-13
1000		1.1000	    270,425	~2,234*10^-13
1200		1.1725	    367,121	~2,225*10^-13
1400		1.2713 	    513,989	~2,271*10^-13

For the big cluster (A15):
frequency(MHz)  Voltage(V)  P-dyn(mW)	Dynamic-power-coefficient
 200		0.9162	    99,834 	~5,945*10^-13
 500		0.9138	    244,651 	~5,860*10^-13
 800		0.9288	    401,986 	~5,825*10^-13
1100		1.0063	    664,565 	~5,966*10^-13
1400		1.0713	    985,268	~6,132*10^-13
1700		1.1750	    1494,173	~6,366*10^-13
2000		1.2700	    2086,273	~6,467*10^-13


While looking for examples in the kernel that calculate the dynamic-power-coefficient, I found this patch [1] by Caesar Wang that introduced this value for the rk3399 big cluster.
Unfortunately, I'm unable to reproduce the same results for the coefficient with the given values. My results are also with a 10^-13 factor and even when I scale them with 10^15, my results have a certain margin of error:

> frequency(MHz)  Voltage(V)  Current(mA) Dynamic-power-coefficient	(My) d-p-coefficient
> 24              0.8         15			
> 48              0.8         23          ~417				~598		
> 96              0.8         40          ~443				~520
> 216             0.8         82          ~438				~474
> 312             0.8         115         ~430				~460
> 408             0.8         150         ~455				~459


Is this the right approach, or am I missing something?
Hope someone can help me out.

Thanks in advance,
Oliver Effland

[1] https://patchwork.kernel.org/patch/9861505/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Computing the dynamic-power-coefficient on Exynos5422
  2018-07-20 14:15 Computing the dynamic-power-coefficient on Exynos5422 Oliver Effland
@ 2018-07-20 15:36 ` Russell King - ARM Linux
  2018-07-30 16:32   ` [Eas-dev] " Vincent Guittot
  2018-07-23  6:51 ` Steven Miao
  2018-07-23 15:29 ` Dietmar Eggemann
  2 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2018-07-20 15:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 20, 2018 at 04:15:30PM +0200, Oliver Effland wrote:
> Hello everyone,
> 
> I hope this is the right place to ask, otherwise please just point me in the right direction.
> 
> I'm currently testing the EAS patches [v4] on an ODROID-XU3 board, which has an Exynos5422 SoC. However, the corresponding DT is missing the "dynamic-power-coefficient" that is needed for an appropriate EM.
> So I'm trying to compute the dynamic-power-coefficient according to the formula:
> 
> Pdyn = dynamic-power-coefficient * V^2 * f
> 
> The frequency f is given by the DT.The actual Voltage and Power are determined by means of the on-chip sensors (returns the values for the specific cluster). When using the Voltage given in the DT, the differences for the d-p-coefficient are negligible.
> 
> So I'm calculating the d-p-coefficient (mW/MHz/uV^2) by reading out the following SoC sensor values.

Well, let's work this forward.  Let's take a simple, reasonable case.

V=1V, f = 200MHz.  Now let's select the smallest value that
dynamic-power-coefficient can be in DT, which, as it's an integer,
is 1.  We're told that V is in uV, and f is in MHz.  So, let's plug
the figures in:

Pdyn = 1 * (1000000)^2 * 200

That is 2 * 10^14mW, or 200GW.

Somehow, I think the binding documentation is very wrong.

> 
> For the little cluster (A7):
> frequency(MHz)  Voltage(V)  Power(mW)	Dynamic-power-coefficient
>  200		0.9175	     49.470	~2.938*10^-13
>  400		0.9165	     91.892	~2.736*10^-13
>  600		0.9638	    149.454	~2.682*10^-13
>  800		1.0263	    223.453	~2.652*10^-13
> 1000		1.1000	    327.707	~2.708*10^-13
> 1200		1.1725	    445.899	~2.703*10^-13
> 1400		1.2713	    627.010	~2.771*10^-13
> 
> For the big cluster (A15):
> frequency(MHz)  Voltage(V)  Power(mW)	Dynamic-power-coefficient
>  200		0.9162	     159.676	~9.510*10^-13
>  500		0.9138	     325.480	~7.797*10^-13
>  800		0.9288	     511.360	~7.410*10^-13
> 1100		1.0063	     828.020	~7.434*10^-13
> 1400		1.0713	    1209.774	~7.530*10^-13
> 1700		1.1750	    1835.784	~7.822*10^-13
> 2000		1.2700	    2661.849	~8.252*10^-13
> 
> 
> But those values are way off for the DT, unless I multiply the d-p-coefficient with 10^15.
> 
> Assuming the Power value needs to be subtracted by a static component (power usage when idle), the results change as follows:
> 
> For the little cluster (A7):
> frequency(MHz)  Voltage(V)  P-dyn(mW)	Dynamic-power-coefficient
>  200		0.9175	    36,381 	~2,160*10^-13
>  400		0.9165	    73,438	~2,186*10^-13
>  600		0.9638	    122,470	~2,197*10^-13
>  800		1.0263	    184,135	~2,185*10^-13
> 1000		1.1000	    270,425	~2,234*10^-13
> 1200		1.1725	    367,121	~2,225*10^-13
> 1400		1.2713 	    513,989	~2,271*10^-13
> 
> For the big cluster (A15):
> frequency(MHz)  Voltage(V)  P-dyn(mW)	Dynamic-power-coefficient
>  200		0.9162	    99,834 	~5,945*10^-13
>  500		0.9138	    244,651 	~5,860*10^-13
>  800		0.9288	    401,986 	~5,825*10^-13
> 1100		1.0063	    664,565 	~5,966*10^-13
> 1400		1.0713	    985,268	~6,132*10^-13
> 1700		1.1750	    1494,173	~6,366*10^-13
> 2000		1.2700	    2086,273	~6,467*10^-13
> 
> 
> While looking for examples in the kernel that calculate the dynamic-power-coefficient, I found this patch [1] by Caesar Wang that introduced this value for the rk3399 big cluster.
> Unfortunately, I'm unable to reproduce the same results for the coefficient with the given values. My results are also with a 10^-13 factor and even when I scale them with 10^15, my results have a certain margin of error:
> 
> > frequency(MHz)  Voltage(V)  Current(mA) Dynamic-power-coefficient	(My) d-p-coefficient
> > 24              0.8         15			
> > 48              0.8         23          ~417				~598		
> > 96              0.8         40          ~443				~520
> > 216             0.8         82          ~438				~474
> > 312             0.8         115         ~430				~460
> > 408             0.8         150         ~455				~459

Hmm.  Let's take your 48MHz values.

Pdyn (mW) = 0.8 (V) * 23 (mA) = 18.4mW

dynamic-power-coefficient = Pdyn / (V^2 * f)
	= 18.4 (mW) / (800000 * 800000 * 48)
	= 5.99 * 10^-13

Seems, again, to me that there is something very wrong with the
binding documentation.

Now, let's dig into the code:

 * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an opp
 * Return: voltage in micro volt corresponding to the opp, else
 * return 0

So this returns uV.

                voltage_mv = dev_pm_opp_get_voltage(opp) / 1000;

This is mV.

                u32 freq_mhz = freq_table[i].frequency / 1000;

MHz.

                power = (u64)capacitance * freq_mhz * voltage_mv * voltage_mv;
                do_div(power, 1000000000);

                /* power is stored in mW */
                freq_table[i].power = power;

So we have:

	power(mW) = dynamic-power-coefficient * f(MHz) * V(mV)^2 / 10^9

That 10^9 can't come from the fact that the calculation is using mV
instead of uV.  Let's see what happens if we use this:

	dynamic-power-coefficient = power(mW) * 10^9 / (f(MHz) * V(mV)^2)
		= 18.4 * 10^9 / (48 * 800 * 800)
		= 599

which, given that dynamic-power-coefficient is an integer, is a damn
sight more sensible.  This is equivalent to:

	dynamic-power-coefficient = power(mW) * 10^15 / (f(MHz) * V(uV)^2)

which means the binding documentation is wrong.

Now, one of the things to bear in mind is that if you're measuring the
voltage and current, and wanting "dynamic power" then you don't get
that from multiplying the voltage and current - that includes the
_static_ consumption.

	total power = static power + dynamic power
		    = V * (Ileakage + Idynamic)

and Idynamic will be based upon the frequency.

Taking your table:

> > frequency(MHz)  Voltage(V)  Current(mA) dpc    Pdyn Ptot Pstatic
> > 24              0.8         15			
> > 48              0.8         23          ~417   12.8 18.4 5.6
> > 96              0.8         40          ~443   27.2 32   4.8
> > 216             0.8         82          ~438   60.5 65.6 5.1
> > 312             0.8         115         ~430   85.9 92   6.1
> > 408             0.8         150         ~455   119  120  1

Pdyn comes from the dynamic-power-coefficient calculation, Ptot from
the voltage and current figures, and Pstatic being the difference
between Ptot and Pdyn.

Apart from the last, it looks like there's a static power of an average
5.4mW.  Plugging that back in:

	dynamic-power-coefficient = power(mW) * 10^9 / (f(MHz) * V(mV)^2)
		= (18.4 - 5.4) * 10^9 / (48 * 800 * 800)  = 423
		= (32 - 5.4) * 10^9 / (96 * 800 * 800)    = 433
		= (65.6 - 5.4) * 10^9 / (216 * 800 * 800) = 435
		= (92 - 5.4) * 10^9 / (312 * 800 * 800)   = 434
		= (120 - 5.4) * 10^9 / (408 * 800 * 800)  = 439

which is a bit more believable (even compared to the original post
of the table.)

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up
According to speedtest.net: 13Mbps down 490kbps up

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Eas-dev] Computing the dynamic-power-coefficient on Exynos5422
  2018-07-20 14:15 Computing the dynamic-power-coefficient on Exynos5422 Oliver Effland
  2018-07-20 15:36 ` Russell King - ARM Linux
@ 2018-07-23  6:51 ` Steven Miao
  2018-07-23 15:29 ` Dietmar Eggemann
  2 siblings, 0 replies; 5+ messages in thread
From: Steven Miao @ 2018-07-23  6:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi  Oliver,

Generally these dynamic co-efficiency and static leakage power comes
from hardware design team by running power estimation tool, however
you can tun these co-efficiency and parameters for better performance.

On Fri, Jul 20, 2018 at 10:16 PM Oliver Effland
<s5770874@msx.tu-dresden.de> wrote:
>
> Hello everyone,
>
> I hope this is the right place to ask, otherwise please just point me in the right direction.
>
> I'm currently testing the EAS patches [v4] on an ODROID-XU3 board, which has an Exynos5422 SoC. However, the corresponding DT is missing the "dynamic-power-coefficient" that is needed for an appropriate EM.
> So I'm trying to compute the dynamic-power-coefficient according to the formula:
>
> Pdyn = dynamic-power-coefficient * V^2 * f
>
> The frequency f is given by the DT.The actual Voltage and Power are determined by means of the on-chip sensors (returns the values for the specific cluster). When using the Voltage given in the DT, the differences for the d-p-coefficient are negligible.
>
> So I'm calculating the d-p-coefficient (mW/MHz/uV^2) by reading out the following SoC sensor values.
How did you get A7 or A15 power? Get Soc power or there's separate
sensor for A7/A15?
If you want to create cpu busy power model manually, you can:
1 leave 1 A7 + 1 A15 core online, keep other cores offline, disable
thermal zone, disable idle state for all cores
2 set A7 frequency to 200Mhz, move all the task to A15, run cpu
intensive task on A7(dhrystone, sysbench cpu test), read sensor to get
1 A7 power P1(read from A7 cluster sensor)
3 online 2 A7 core, run dhrystone on each core, and get power P2

we can get 1 A7 core power at 200Mhz ~= P2 - P1 (A7 power X 2 + static
power - A7 power X 1 - static power)

>
> For the little cluster (A7):
> frequency(MHz)  Voltage(V)  Power(mW)   Dynamic-power-coefficient
>  200            0.9175       49.470     ~2.938*10^-13
>  400            0.9165       91.892     ~2.736*10^-13
>  600            0.9638      149.454     ~2.682*10^-13
>  800            1.0263      223.453     ~2.652*10^-13
> 1000            1.1000      327.707     ~2.708*10^-13
> 1200            1.1725      445.899     ~2.703*10^-13
> 1400            1.2713      627.010     ~2.771*10^-13
>
> For the big cluster (A15):
> frequency(MHz)  Voltage(V)  Power(mW)   Dynamic-power-coefficient
>  200            0.9162       159.676    ~9.510*10^-13
>  500            0.9138       325.480    ~7.797*10^-13
>  800            0.9288       511.360    ~7.410*10^-13
> 1100            1.0063       828.020    ~7.434*10^-13
> 1400            1.0713      1209.774    ~7.530*10^-13
> 1700            1.1750      1835.784    ~7.822*10^-13
> 2000            1.2700      2661.849    ~8.252*10^-13
>
>
> But those values are way off for the DT, unless I multiply the d-p-coefficient with 10^15.
>
> Assuming the Power value needs to be subtracted by a static component (power usage when idle), the results change as follows:
>
> For the little cluster (A7):
> frequency(MHz)  Voltage(V)  P-dyn(mW)   Dynamic-power-coefficient
>  200            0.9175      36,381      ~2,160*10^-13
>  400            0.9165      73,438      ~2,186*10^-13
>  600            0.9638      122,470     ~2,197*10^-13
>  800            1.0263      184,135     ~2,185*10^-13
> 1000            1.1000      270,425     ~2,234*10^-13
> 1200            1.1725      367,121     ~2,225*10^-13
> 1400            1.2713      513,989     ~2,271*10^-13
>
> For the big cluster (A15):
> frequency(MHz)  Voltage(V)  P-dyn(mW)   Dynamic-power-coefficient
>  200            0.9162      99,834      ~5,945*10^-13
>  500            0.9138      244,651     ~5,860*10^-13
>  800            0.9288      401,986     ~5,825*10^-13
> 1100            1.0063      664,565     ~5,966*10^-13
> 1400            1.0713      985,268     ~6,132*10^-13
> 1700            1.1750      1494,173    ~6,366*10^-13
> 2000            1.2700      2086,273    ~6,467*10^-13
>
>
> While looking for examples in the kernel that calculate the dynamic-power-coefficient, I found this patch [1] by Caesar Wang that introduced this value for the rk3399 big cluster.
> Unfortunately, I'm unable to reproduce the same results for the coefficient with the given values. My results are also with a 10^-13 factor and even when I scale them with 10^15, my results have a certain margin of error:
>
> > frequency(MHz)  Voltage(V)  Current(mA) Dynamic-power-coefficient     (My) d-p-coefficient
> > 24              0.8         15
> > 48              0.8         23          ~417                          ~598
> > 96              0.8         40          ~443                          ~520
> > 216             0.8         82          ~438                          ~474
> > 312             0.8         115         ~430                          ~460
> > 408             0.8         150         ~455                          ~459
dynamic-power-coefficient ~= 400 - 500 is reasonable for big core
dynamic-power-coefficient  ~= 100 is reasonable for LITTLE core.
For IPA it can work effectively with a poor power model(not so
accurate), for EAS it just need power model of LITTLE core and big
core is proportional.
>
>
> Is this the right approach, or am I missing something?
> Hope someone can help me out.
>
> Thanks in advance,
> Oliver Effland
>
> [1] https://patchwork.kernel.org/patch/9861505/
>
> _______________________________________________
> eas-dev mailing list
> eas-dev at lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/eas-dev

-Steven

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Eas-dev] Computing the dynamic-power-coefficient on Exynos5422
  2018-07-20 14:15 Computing the dynamic-power-coefficient on Exynos5422 Oliver Effland
  2018-07-20 15:36 ` Russell King - ARM Linux
  2018-07-23  6:51 ` Steven Miao
@ 2018-07-23 15:29 ` Dietmar Eggemann
  2 siblings, 0 replies; 5+ messages in thread
From: Dietmar Eggemann @ 2018-07-23 15:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Oliver,

On 07/20/2018 04:15 PM, Oliver Effland wrote:
> Hello everyone,
> 
> I hope this is the right place to ask, otherwise please just point me in the right direction.
> 
> I'm currently testing the EAS patches [v4] on an ODROID-XU3 board, which has an Exynos5422 SoC. However, the corresponding DT is missing the "dynamic-power-coefficient" that is needed for an appropriate EM.
> So I'm trying to compute the dynamic-power-coefficient according to the formula:
> 
> Pdyn = dynamic-power-coefficient * V^2 * f
> 
> The frequency f is given by the DT.The actual Voltage and Power are determined by means of the on-chip sensors (returns the values for the specific cluster). When using the Voltage given in the DT, the differences for the d-p-coefficient are negligible.
> 
> So I'm calculating the d-p-coefficient (mW/MHz/uV^2) by reading out the following SoC sensor values.
> 
> For the little cluster (A7):
> frequency(MHz)  Voltage(V)  Power(mW)	Dynamic-power-coefficient
>   200		0.9175	     49.470	~2.938*10^-13
>   400		0.9165	     91.892	~2.736*10^-13
>   600		0.9638	    149.454	~2.682*10^-13
>   800		1.0263	    223.453	~2.652*10^-13
> 1000		1.1000	    327.707	~2.708*10^-13
> 1200		1.1725	    445.899	~2.703*10^-13
> 1400		1.2713	    627.010	~2.771*10^-13
> 
> For the big cluster (A15):
> frequency(MHz)  Voltage(V)  Power(mW)	Dynamic-power-coefficient
>   200		0.9162	     159.676	~9.510*10^-13
>   500		0.9138	     325.480	~7.797*10^-13
>   800		0.9288	     511.360	~7.410*10^-13
> 1100		1.0063	     828.020	~7.434*10^-13
> 1400		1.0713	    1209.774	~7.530*10^-13
> 1700		1.1750	    1835.784	~7.822*10^-13
> 2000		1.2700	    2661.849	~8.252*10^-13

We do support Arm's TC2 platform (2xA15 and 3xA7) with the EAS project. 
The latest EAS mainline integration includes Quentin's "[RFC PATCH v4 
00/12] Energy Aware Scheduling" https://lkml.org/lkml/2018/6/28/301 .

You can find the appropriate patch for TC2 dynamic-power-coefficient 
integration "arm: dts: vexpress-v2p-ca15_a7: Add 
dynamic-power-coefficient properties" under 
https://developer.arm.com/open-source/energy-aware-scheduling/eas-mainline-development 
. Follow the 'eas/next/integration' link. The patch header has a little 
bit of documentation about how we did it. We used the build-in TC2 
Energy Meter.

This is all in sync with what Russel and Steve posted on this thread before.

Thanks for taking EAS for a spin on another Arm 32bit machine!

-- Dietmar

[...]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Eas-dev] Computing the dynamic-power-coefficient on Exynos5422
  2018-07-20 15:36 ` Russell King - ARM Linux
@ 2018-07-30 16:32   ` Vincent Guittot
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Guittot @ 2018-07-30 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russel and Oliver,

On Fri, 20 Jul 2018 at 17:36, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
>
> On Fri, Jul 20, 2018 at 04:15:30PM +0200, Oliver Effland wrote:
> > Hello everyone,
> >
> > I hope this is the right place to ask, otherwise please just point me in the right direction.
> >
> > I'm currently testing the EAS patches [v4] on an ODROID-XU3 board, which has an Exynos5422 SoC. However, the corresponding DT is missing the "dynamic-power-coefficient" that is needed for an appropriate EM.
> > So I'm trying to compute the dynamic-power-coefficient according to the formula:
> >
> > Pdyn = dynamic-power-coefficient * V^2 * f
> >
> > The frequency f is given by the DT.The actual Voltage and Power are determined by means of the on-chip sensors (returns the values for the specific cluster). When using the Voltage given in the DT, the differences for the d-p-coefficient are negligible.
> >
> > So I'm calculating the d-p-coefficient (mW/MHz/uV^2) by reading out the following SoC sensor values.
>
> Well, let's work this forward.  Let's take a simple, reasonable case.
>
> V=1V, f = 200MHz.  Now let's select the smallest value that
> dynamic-power-coefficient can be in DT, which, as it's an integer,
> is 1.  We're told that V is in uV, and f is in MHz.  So, let's plug
> the figures in:
>
> Pdyn = 1 * (1000000)^2 * 200
>
> That is 2 * 10^14mW, or 200GW.
>
> Somehow, I think the binding documentation is very wrong.
>
> >
> > For the little cluster (A7):
> > frequency(MHz)  Voltage(V)  Power(mW) Dynamic-power-coefficient
> >  200          0.9175       49.470     ~2.938*10^-13
> >  400          0.9165       91.892     ~2.736*10^-13
> >  600          0.9638      149.454     ~2.682*10^-13
> >  800          1.0263      223.453     ~2.652*10^-13
> > 1000          1.1000      327.707     ~2.708*10^-13
> > 1200          1.1725      445.899     ~2.703*10^-13
> > 1400          1.2713      627.010     ~2.771*10^-13
> >
> > For the big cluster (A15):
> > frequency(MHz)  Voltage(V)  Power(mW) Dynamic-power-coefficient
> >  200          0.9162       159.676    ~9.510*10^-13
> >  500          0.9138       325.480    ~7.797*10^-13
> >  800          0.9288       511.360    ~7.410*10^-13
> > 1100          1.0063       828.020    ~7.434*10^-13
> > 1400          1.0713      1209.774    ~7.530*10^-13
> > 1700          1.1750      1835.784    ~7.822*10^-13
> > 2000          1.2700      2661.849    ~8.252*10^-13
> >
> >
> > But those values are way off for the DT, unless I multiply the d-p-coefficient with 10^15.
> >
> > Assuming the Power value needs to be subtracted by a static component (power usage when idle), the results change as follows:
> >
> > For the little cluster (A7):
> > frequency(MHz)  Voltage(V)  P-dyn(mW) Dynamic-power-coefficient
> >  200          0.9175      36,381      ~2,160*10^-13
> >  400          0.9165      73,438      ~2,186*10^-13
> >  600          0.9638      122,470     ~2,197*10^-13
> >  800          1.0263      184,135     ~2,185*10^-13
> > 1000          1.1000      270,425     ~2,234*10^-13
> > 1200          1.1725      367,121     ~2,225*10^-13
> > 1400          1.2713      513,989     ~2,271*10^-13
> >
> > For the big cluster (A15):
> > frequency(MHz)  Voltage(V)  P-dyn(mW) Dynamic-power-coefficient
> >  200          0.9162      99,834      ~5,945*10^-13
> >  500          0.9138      244,651     ~5,860*10^-13
> >  800          0.9288      401,986     ~5,825*10^-13
> > 1100          1.0063      664,565     ~5,966*10^-13
> > 1400          1.0713      985,268     ~6,132*10^-13
> > 1700          1.1750      1494,173    ~6,366*10^-13
> > 2000          1.2700      2086,273    ~6,467*10^-13
> >
> >
> > While looking for examples in the kernel that calculate the dynamic-power-coefficient, I found this patch [1] by Caesar Wang that introduced this value for the rk3399 big cluster.
> > Unfortunately, I'm unable to reproduce the same results for the coefficient with the given values. My results are also with a 10^-13 factor and even when I scale them with 10^15, my results have a certain margin of error:
> >
> > > frequency(MHz)  Voltage(V)  Current(mA) Dynamic-power-coefficient   (My) d-p-coefficient
> > > 24              0.8         15
> > > 48              0.8         23          ~417                                ~598
> > > 96              0.8         40          ~443                                ~520
> > > 216             0.8         82          ~438                                ~474
> > > 312             0.8         115         ~430                                ~460
> > > 408             0.8         150         ~455                                ~459
>
> Hmm.  Let's take your 48MHz values.
>
> Pdyn (mW) = 0.8 (V) * 23 (mA) = 18.4mW
>
> dynamic-power-coefficient = Pdyn / (V^2 * f)
>         = 18.4 (mW) / (800000 * 800000 * 48)
>         = 5.99 * 10^-13
>
> Seems, again, to me that there is something very wrong with the
> binding documentation.
>
> Now, let's dig into the code:
>
>  * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an opp
>  * Return: voltage in micro volt corresponding to the opp, else
>  * return 0
>
> So this returns uV.
>
>                 voltage_mv = dev_pm_opp_get_voltage(opp) / 1000;
>
> This is mV.
>
>                 u32 freq_mhz = freq_table[i].frequency / 1000;
>
> MHz.
>
>                 power = (u64)capacitance * freq_mhz * voltage_mv * voltage_mv;
>                 do_div(power, 1000000000);
>
>                 /* power is stored in mW */
>                 freq_table[i].power = power;
>
> So we have:
>
>         power(mW) = dynamic-power-coefficient * f(MHz) * V(mV)^2 / 10^9
>
> That 10^9 can't come from the fact that the calculation is using mV
> instead of uV.  Let's see what happens if we use this:
>
>         dynamic-power-coefficient = power(mW) * 10^9 / (f(MHz) * V(mV)^2)
>                 = 18.4 * 10^9 / (48 * 800 * 800)
>                 = 599
>
> which, given that dynamic-power-coefficient is an integer, is a damn
> sight more sensible.  This is equivalent to:
>
>         dynamic-power-coefficient = power(mW) * 10^15 / (f(MHz) * V(uV)^2)
>
> which means the binding documentation is wrong.

I came to similar conclusion on another thread:
https://patchwork.kernel.org/patch/10493615
the right unit of dynamic-power-coefficient is mW/V^2/Ghz

Regards,
Vincent

>
> Now, one of the things to bear in mind is that if you're measuring the
> voltage and current, and wanting "dynamic power" then you don't get
> that from multiplying the voltage and current - that includes the
> _static_ consumption.
>
>         total power = static power + dynamic power
>                     = V * (Ileakage + Idynamic)
>
> and Idynamic will be based upon the frequency.
>
> Taking your table:
>
> > > frequency(MHz)  Voltage(V)  Current(mA) dpc    Pdyn Ptot Pstatic
> > > 24              0.8         15
> > > 48              0.8         23          ~417   12.8 18.4 5.6
> > > 96              0.8         40          ~443   27.2 32   4.8
> > > 216             0.8         82          ~438   60.5 65.6 5.1
> > > 312             0.8         115         ~430   85.9 92   6.1
> > > 408             0.8         150         ~455   119  120  1
>
> Pdyn comes from the dynamic-power-coefficient calculation, Ptot from
> the voltage and current figures, and Pstatic being the difference
> between Ptot and Pdyn.
>
> Apart from the last, it looks like there's a static power of an average
> 5.4mW.  Plugging that back in:
>
>         dynamic-power-coefficient = power(mW) * 10^9 / (f(MHz) * V(mV)^2)
>                 = (18.4 - 5.4) * 10^9 / (48 * 800 * 800)  = 423
>                 = (32 - 5.4) * 10^9 / (96 * 800 * 800)    = 433
>                 = (65.6 - 5.4) * 10^9 / (216 * 800 * 800) = 435
>                 = (92 - 5.4) * 10^9 / (312 * 800 * 800)   = 434
>                 = (120 - 5.4) * 10^9 / (408 * 800 * 800)  = 439
>
> which is a bit more believable (even compared to the original post
> of the table.)
>
> --
> RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up
> According to speedtest.net: 13Mbps down 490kbps up
> _______________________________________________
> eas-dev mailing list
> eas-dev at lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/eas-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-30 16:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20 14:15 Computing the dynamic-power-coefficient on Exynos5422 Oliver Effland
2018-07-20 15:36 ` Russell King - ARM Linux
2018-07-30 16:32   ` [Eas-dev] " Vincent Guittot
2018-07-23  6:51 ` Steven Miao
2018-07-23 15:29 ` Dietmar Eggemann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.