linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
@ 2023-11-27  8:15 Lukasz Luba
  2023-11-27  9:42 ` Heiko Stübner
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Lukasz Luba @ 2023-11-27  8:15 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, devicetree, linux-arm-kernel
  Cc: lukasz.luba, robh+dt, krzysztof.kozlowski+dt, heiko, conor+dt,
	daniel.lezcano

Add dynamic-power-coefficient to the GPU node. That will create Energy
Model for the GPU based on the coefficient and OPP table information.
It will enable mechanism such as DTMP or IPA to work with the GPU DVFS.
In similar way the Energy Model for CPUs in rk3399 is created, so both
are aligned in power scale. The maximum power used from this coefficient
is 1.5W at 600MHz.

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 9da0b6d77c8d..87cfdf570b19 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -2113,6 +2113,7 @@ gpu: gpu@ff9a0000 {
 		interrupt-names = "job", "mmu", "gpu";
 		clocks = <&cru ACLK_GPU>;
 		#cooling-cells = <2>;
+		dynamic-power-coefficient = <2640>;
 		power-domains = <&power RK3399_PD_GPU>;
 		status = "disabled";
 	};
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
  2023-11-27  8:15 [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU Lukasz Luba
@ 2023-11-27  9:42 ` Heiko Stübner
  2023-11-27 10:00   ` Lukasz Luba
  2023-11-27 10:02 ` Chen-Yu Tsai
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Heiko Stübner @ 2023-11-27  9:42 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, devicetree, linux-arm-kernel,
	Lukasz Luba
  Cc: lukasz.luba, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	daniel.lezcano

Hi Lukasz,

Am Montag, 27. November 2023, 09:15:11 CET schrieb Lukasz Luba:
> Add dynamic-power-coefficient to the GPU node. That will create Energy
> Model for the GPU based on the coefficient and OPP table information.
> It will enable mechanism such as DTMP or IPA to work with the GPU DVFS.
> In similar way the Energy Model for CPUs in rk3399 is created, so both
> are aligned in power scale. The maximum power used from this coefficient
> is 1.5W at 600MHz.

2640 is a pretty arbitary value, so it would be really helpful to describe
in the commit message, how you arrived with that specific value.


Thanks
Heiko


> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> ---
>  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> index 9da0b6d77c8d..87cfdf570b19 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> @@ -2113,6 +2113,7 @@ gpu: gpu@ff9a0000 {
>  		interrupt-names = "job", "mmu", "gpu";
>  		clocks = <&cru ACLK_GPU>;
>  		#cooling-cells = <2>;
> +		dynamic-power-coefficient = <2640>;
>  		power-domains = <&power RK3399_PD_GPU>;
>  		status = "disabled";
>  	};
> 





_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
  2023-11-27  9:42 ` Heiko Stübner
@ 2023-11-27 10:00   ` Lukasz Luba
  0 siblings, 0 replies; 8+ messages in thread
From: Lukasz Luba @ 2023-11-27 10:00 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: robh+dt, krzysztof.kozlowski+dt, linux-arm-kernel, devicetree,
	linux-rockchip, conor+dt, linux-kernel, daniel.lezcano

Hi Heiko,

On 11/27/23 09:42, Heiko Stübner wrote:
> Hi Lukasz,
> 
> Am Montag, 27. November 2023, 09:15:11 CET schrieb Lukasz Luba:
>> Add dynamic-power-coefficient to the GPU node. That will create Energy
>> Model for the GPU based on the coefficient and OPP table information.
>> It will enable mechanism such as DTMP or IPA to work with the GPU DVFS.
>> In similar way the Energy Model for CPUs in rk3399 is created, so both
>> are aligned in power scale. The maximum power used from this coefficient
>> is 1.5W at 600MHz.
> 
> 2640 is a pretty arbitary value, so it would be really helpful to describe
> in the commit message, how you arrived with that specific value.

It's in the above patch header. The power at 600MHz is ~1.5Watts, so for
max freq and max voltage you get the coefficient. The DT schema
describes quite well how the coefficient is calculated. IMO, there is no
need to duplicate that description here [1].

Have you checked that documentation? Is there still anything unclear?
I might elaborate a bit more why it's important for GPU to take the top
OPP for considerations (due to thermal operating mostly on top-half
OPPs, but the curve is a bit constraining). Unfortunately, this simple
model doesn't allow to reflect the leakage impact over time. It doesn't
also address the chip binning lottery. Although, it will be possible in
near future to address those [2].

Regards,
Lukasz

[1] 
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/gpu/arm,mali-midgard.yaml#L94
[2] 
https://lore.kernel.org/lkml/20230925081139.1305766-1-lukasz.luba@arm.com/


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
  2023-11-27  8:15 [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU Lukasz Luba
  2023-11-27  9:42 ` Heiko Stübner
@ 2023-11-27 10:02 ` Chen-Yu Tsai
  2023-11-27 10:17   ` Lukasz Luba
  2023-12-07 11:07 ` Lukasz Luba
  2023-12-07 20:30 ` Heiko Stuebner
  3 siblings, 1 reply; 8+ messages in thread
From: Chen-Yu Tsai @ 2023-11-27 10:02 UTC (permalink / raw)
  To: Lukasz Luba
  Cc: linux-kernel, linux-rockchip, devicetree, linux-arm-kernel,
	robh+dt, krzysztof.kozlowski+dt, heiko, conor+dt, daniel.lezcano

On Mon, Nov 27, 2023 at 4:14 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
> Add dynamic-power-coefficient to the GPU node. That will create Energy
> Model for the GPU based on the coefficient and OPP table information.
> It will enable mechanism such as DTMP or IPA to work with the GPU DVFS.
> In similar way the Energy Model for CPUs in rk3399 is created, so both
> are aligned in power scale. The maximum power used from this coefficient
> is 1.5W at 600MHz.
>
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> ---
>  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> index 9da0b6d77c8d..87cfdf570b19 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> @@ -2113,6 +2113,7 @@ gpu: gpu@ff9a0000 {
>                 interrupt-names = "job", "mmu", "gpu";
>                 clocks = <&cru ACLK_GPU>;
>                 #cooling-cells = <2>;
> +               dynamic-power-coefficient = <2640>;

For reference, in the ChromeOS downstrean v5.10 kernel we have:

gpu_power_model: power_model {
        compatible = "arm,mali-simple-power-model";
        static-coefficient = <411522>;
        dynamic-coefficient = <977>;
        ts = <32000 4700 (-80) 2>;
        thermal-zone = "gpu";
};

This is for the Mali kbase.

ChenYu

>                 power-domains = <&power RK3399_PD_GPU>;
>                 status = "disabled";
>         };
> --
> 2.25.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
  2023-11-27 10:02 ` Chen-Yu Tsai
@ 2023-11-27 10:17   ` Lukasz Luba
  0 siblings, 0 replies; 8+ messages in thread
From: Lukasz Luba @ 2023-11-27 10:17 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: linux-kernel, linux-rockchip, devicetree, linux-arm-kernel,
	robh+dt, krzysztof.kozlowski+dt, heiko, conor+dt, daniel.lezcano



On 11/27/23 10:02, Chen-Yu Tsai wrote:
> On Mon, Nov 27, 2023 at 4:14 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>>
>> Add dynamic-power-coefficient to the GPU node. That will create Energy
>> Model for the GPU based on the coefficient and OPP table information.
>> It will enable mechanism such as DTMP or IPA to work with the GPU DVFS.
>> In similar way the Energy Model for CPUs in rk3399 is created, so both
>> are aligned in power scale. The maximum power used from this coefficient
>> is 1.5W at 600MHz.
>>
>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
>> ---
>>   arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
>> index 9da0b6d77c8d..87cfdf570b19 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
>> @@ -2113,6 +2113,7 @@ gpu: gpu@ff9a0000 {
>>                  interrupt-names = "job", "mmu", "gpu";
>>                  clocks = <&cru ACLK_GPU>;
>>                  #cooling-cells = <2>;
>> +               dynamic-power-coefficient = <2640>;
> 
> For reference, in the ChromeOS downstrean v5.10 kernel we have:
> 
> gpu_power_model: power_model {
>          compatible = "arm,mali-simple-power-model";
>          static-coefficient = <411522>;
>          dynamic-coefficient = <977>;
>          ts = <32000 4700 (-80) 2>;
>          thermal-zone = "gpu";
> };
> 
> This is for the Mali kbase.

That's downstream driver for downstream IPA thermal governor, which is
different. As you can see there, there is a split of the total power
to 'static power' and 'dynamic power' and thus those 2 coefficients:
'static-coefficient' and 'dynamic-coefficient'. There is also
polynomial for the exponential curve approximating temperature impact
to the increasing leakage (static power).

This is totally not upstream code and quite complex to derive thus
fly upstream. Therefore, in upstream we have very simple power
model right now, but it will be possible to update it at runtime
when the leakage is increased. I hope the new v5 version that
I'm going to send, will get into mainline soon [1].

Regards,
Lukasz

[1] 
https://lore.kernel.org/lkml/20230925081139.1305766-1-lukasz.luba@arm.com/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
  2023-11-27  8:15 [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU Lukasz Luba
  2023-11-27  9:42 ` Heiko Stübner
  2023-11-27 10:02 ` Chen-Yu Tsai
@ 2023-12-07 11:07 ` Lukasz Luba
  2023-12-07 20:30 ` Heiko Stuebner
  3 siblings, 0 replies; 8+ messages in thread
From: Lukasz Luba @ 2023-12-07 11:07 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, devicetree, linux-arm-kernel
  Cc: robh+dt, krzysztof.kozlowski+dt, heiko, conor+dt, daniel.lezcano



On 11/27/23 08:15, Lukasz Luba wrote:
> Add dynamic-power-coefficient to the GPU node. That will create Energy
> Model for the GPU based on the coefficient and OPP table information.
> It will enable mechanism such as DTMP or IPA to work with the GPU DVFS.
> In similar way the Energy Model for CPUs in rk3399 is created, so both
> are aligned in power scale. The maximum power used from this coefficient
> is 1.5W at 600MHz.
> 
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> ---
>   arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 +
>   1 file changed, 1 insertion(+)
> 


Gentle ping. What's the status of this?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
  2023-11-27  8:15 [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU Lukasz Luba
                   ` (2 preceding siblings ...)
  2023-12-07 11:07 ` Lukasz Luba
@ 2023-12-07 20:30 ` Heiko Stuebner
  2023-12-08  7:58   ` Lukasz Luba
  3 siblings, 1 reply; 8+ messages in thread
From: Heiko Stuebner @ 2023-12-07 20:30 UTC (permalink / raw)
  To: linux-arm-kernel, devicetree, linux-kernel, linux-rockchip,
	Lukasz Luba
  Cc: Heiko Stuebner, daniel.lezcano, krzysztof.kozlowski+dt, robh+dt,
	conor+dt

On Mon, 27 Nov 2023 08:15:11 +0000, Lukasz Luba wrote:
> Add dynamic-power-coefficient to the GPU node. That will create Energy
> Model for the GPU based on the coefficient and OPP table information.
> It will enable mechanism such as DTMP or IPA to work with the GPU DVFS.
> In similar way the Energy Model for CPUs in rk3399 is created, so both
> are aligned in power scale. The maximum power used from this coefficient
> is 1.5W at 600MHz.
> 
> [...]

Applied, thanks!

[1/1] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
      commit: 381d48fbada9b5b39f5a811bb8fe76365d6bdd5c

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
  2023-12-07 20:30 ` Heiko Stuebner
@ 2023-12-08  7:58   ` Lukasz Luba
  0 siblings, 0 replies; 8+ messages in thread
From: Lukasz Luba @ 2023-12-08  7:58 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: daniel.lezcano, krzysztof.kozlowski+dt, robh+dt, conor+dt,
	linux-arm-kernel, linux-rockchip, devicetree, linux-kernel



On 12/7/23 20:30, Heiko Stuebner wrote:
> On Mon, 27 Nov 2023 08:15:11 +0000, Lukasz Luba wrote:
>> Add dynamic-power-coefficient to the GPU node. That will create Energy
>> Model for the GPU based on the coefficient and OPP table information.
>> It will enable mechanism such as DTMP or IPA to work with the GPU DVFS.
>> In similar way the Energy Model for CPUs in rk3399 is created, so both
>> are aligned in power scale. The maximum power used from this coefficient
>> is 1.5W at 600MHz.
>>
>> [...]
> 
> Applied, thanks!

Thank you Heiko!

> 
> [1/1] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU
>        commit: 381d48fbada9b5b39f5a811bb8fe76365d6bdd5c
> 
> Best regards,

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-12-08  7:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-27  8:15 [PATCH] arm64: dts: rockchip: Add dynamic-power-coefficient to rk3399 GPU Lukasz Luba
2023-11-27  9:42 ` Heiko Stübner
2023-11-27 10:00   ` Lukasz Luba
2023-11-27 10:02 ` Chen-Yu Tsai
2023-11-27 10:17   ` Lukasz Luba
2023-12-07 11:07 ` Lukasz Luba
2023-12-07 20:30 ` Heiko Stuebner
2023-12-08  7:58   ` Lukasz Luba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).