Skip to contentSkip to conversation

arm64: dts: rockchip: Fix multiple thermal zones conflict in rk3399.dtsi

PATCH In review Daniel Lezcano 5 participants 14 messages Jun 4, 2019 – Jun 26, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm64: dts: rockchip: Fix multiple thermal zones conflict in rk3399.dtsi

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------
 1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -9
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
 					type = "critical";
 				};
 			};
-
-			cooling-maps {
-				map0 {
-					trip = <&gpu_alert0>;
-					cooling-device =
-						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-						<&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-				};
-			};
 		};
 	};
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 arm64: dts: rockchip: Define values for the IPA governor for rock960

Currently the default thermal values for the rk3399-rock960 board is inherited from the generic definition in rk3399.dtsi.

In order to ensure the rock960 has more room for througput before being capped by the thermal framework and is correctly supported by the IPA governor, let's define the power values and the right trip points for better performances:

- sustainable power is tested to be 1550mW

- increase the first mitigation point to 75°C in order to get better performances

- the first trip point is 65°C in order to let the IPA to collect enough data for the PID regulation when it reaches 75°C

- restrict the cooling device to the big CPUs as the little CPUs contribution to the heating effect can be considered negligible

The intelligent power allocator PID coefficient to be set in sysfs are:

    k_d: 0
    k_po: 79
    k_i: 10
    k_pu: 50
---
 .../boot/dts/rockchip/rk3399-rock960.dts      | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +39 -0
index 12285c51cceb..701d5b5fad46 100644
@@ -114,6 +114,45 @@
 	};
 };
 
+&thermal_zones {
+	cpu_thermal: cpu {
+		polling-delay-passive = <100>;
+		polling-delay = <1000>;
+		thermal-sensors = <&tsadc 0>;
+		sustainable-power = <1550>;
+
+		trips {
+			cpu_alert0: cpu_alert0 {
+				    temperature = <65000>;
+				    hysteresis = <2000>;
+				    type = "passive";
+			};
+
+			cpu_alert1: cpu_alert1 {
+				    temperature = <75000>;
+				    hysteresis = <2000>;
+				    type = "passive";
+			};
+
+			cpu_crit: cpu_crit {
+				  temperature = <95000>;
+				  hysteresis = <2000>;
+				  type = "critical";
+			};
+		};
+
+		cooling-maps {
+			     map0 {
+
+			     trip = <&cpu_alert1>;
+			     cooling-device =
+					<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
+	};
+};
+
 &usbdrd_dwc3_0 {
 	dr_mode = "otg";
 };
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] arm64: dts: rockchip: Define values for the IPA governor for rock960

Quoted 7 lines · Daniel Lezcano

The intelligent power allocator PID coefficient to be set in sysfs are:

    k_d: 0
    k_po: 79
    k_i: 10
    k_pu: 50

With all the other interesting parametrization in the device tree I kind of wonder why the PID regulator constants defaults are not set up from device tree?

Any specific reason?

To me it seems like the kind of stuff userpace will invariably just get wrong or forget about (somebody just runs a different distribution without the extra magic to set sysfs right) unless we supply good defaults.

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH 2/2] arm64: dts: rockchip: Define values for the IPA governor for rock960

Quoted 10 lines · Linus Walleij
Quoted 7 lines · Daniel Lezcano

The intelligent power allocator PID coefficient to be set in sysfs are:

    k_d: 0
    k_po: 79
    k_i: 10
    k_pu: 50
Quoted 5 lines

With all the other interesting parametrization in the device tree I kind of wonder why the PID regulator constants defaults are not set up from device tree?

Any specific reason?

None I'm aware of. I guess these constants are considered as tweak values and not hardware related.

Quoted 4 lines

To me it seems like the kind of stuff userpace will invariably just get wrong or forget about (somebody just runs a different distribution without the extra magic to set sysfs right) unless we supply good defaults.

I agree.

Signature · 11 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#4 lore raw
In reply to Daniel Lezcano

Hi all,

is there any comment on these two patches?

Quoted 38 lines · Daniel Lezcano

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------
 1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -9
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
 					type = "critical";
 				};
 			};
-
-			cooling-maps {
-				map0 {
-					trip = <&gpu_alert0>;
-					cooling-device =
-						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-						<&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-				};
-			};
 		};
 	};
 
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
maintainer
#5 lore raw
In reply to Daniel Lezcano

Hi Daniel,

Am Dienstag, 4. Juni 2019, 18:57:57 CEST schrieb Daniel Lezcano:

Quoted 26 lines

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------
 1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -1
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
 					type = "critical";
 				};
 			};
-

arch/arm64/boot/dts/rockchip/rk3399.dtsi line 825

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -8
-			cooling-maps {
-				map0 {
-					trip = <&gpu_alert0>;
-					cooling-device =
-						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-						<&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-				};
-			};
 		};
 	};

my knowledge of the thermal framework is not that big, but what about the rk3399-devices which further detail the cooling-maps like rk3399-gru-kevin and the rk3399-nanopc-t4 with its fan-handling in the cooling-maps?

Heiko

#6 lore raw
Quoted 35 lines · Heiko Stuebner

Hi Daniel,

Am Dienstag, 4. Juni 2019, 18:57:57 CEST schrieb Daniel Lezcano:

Quoted 32 lines

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------
  1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -7
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
  					type = "critical";
  				};
  			};
-
-			cooling-maps {
-				map0 {
-					trip = <&gpu_alert0>;
-					cooling-device =
-						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-						<&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
Quoted 8 lines

arch/arm64/boot/dts/rockchip/rk3399.dtsi line 825

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -2
-				};
-			};
  		};
  	};

my knowledge of the thermal framework is not that big, but what about the rk3399-devices which further detail the cooling-maps like rk3399-gru-kevin and the rk3399-nanopc-t4 with its fan-handling in the cooling-maps?

FWIW, my knowledge of thermal is probably even less :)

For NanoPC-T4 I think I more or less just took Odroid-XU3/4 as the best pwm-fan example and adapted that into the existing RK3399 zones in the manner which seemed most logical to my interpretation - if what was there wasn't right to begin with, then I may well have done that wrong too.

Robin.

#7 lore raw
In reply to Heiko Stuebner
Quoted 35 lines · Heiko Stuebner

Hi Daniel,

Am Dienstag, 4. Juni 2019, 18:57:57 CEST schrieb Daniel Lezcano:

Quoted 32 lines

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------
 1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -7
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
 					type = "critical";
 				};
 			};
-
-			cooling-maps {
-				map0 {
-					trip = <&gpu_alert0>;
-					cooling-device =
-						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-						<&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
Quoted 8 lines

arch/arm64/boot/dts/rockchip/rk3399.dtsi line 825

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -2
-				};
-			};
 		};
 	};

my knowledge of the thermal framework is not that big, but what about the rk3399-devices which further detail the cooling-maps like rk3399-gru-kevin and the rk3399-nanopc-t4 with its fan-handling in the cooling-maps?

The rk3399-gru-kevin is correct.

The rk3399-nanopc-t4 is not correct because the cpu and the gpu are sharing the same cooling device (the fan). There are different configurations:

1. The cpu cooling device for the CPU and the fan for the GPU

2. Different trip points on the CPU thermal zone, eg. one to for the CPU cooling device and another one for the fan.

There are some variant for the above. If this board is not on battery, you may want to give priority to the throughput, so activate the fan first and then cool down the CPU. Or if you are on battery, you may want to invert the trip points.

In any case, it is not possible to share the same cooling device for different thermal zones.

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#8 lore raw
Quoted 56 lines · Daniel Lezcano
Quoted 35 lines · Heiko Stuebner

Hi Daniel,

Am Dienstag, 4. Juni 2019, 18:57:57 CEST schrieb Daniel Lezcano:

Quoted 32 lines

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------
  1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -7
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
  					type = "critical";
  				};
  			};
-
-			cooling-maps {
-				map0 {
-					trip = <&gpu_alert0>;
-					cooling-device =
-						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-						<&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
Quoted 8 lines

arch/arm64/boot/dts/rockchip/rk3399.dtsi line 825

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -2
-				};
-			};
  		};
  	};

my knowledge of the thermal framework is not that big, but what about the rk3399-devices which further detail the cooling-maps like rk3399-gru-kevin and the rk3399-nanopc-t4 with its fan-handling in the cooling-maps?

The rk3399-gru-kevin is correct.

The rk3399-nanopc-t4 is not correct because the cpu and the gpu are sharing the same cooling device (the fan). There are different configurations:

1. The cpu cooling device for the CPU and the fan for the GPU

2. Different trip points on the CPU thermal zone, eg. one to for the CPU cooling device and another one for the fan.

Quoted 7 lines

There are some variant for the above. If this board is not on battery, you may want to give priority to the throughput, so activate the fan first and then cool down the CPU. Or if you are on battery, you may want to invert the trip points.

In any case, it is not possible to share the same cooling device for different thermal zones.

OK, thanks for the clarification. I'll get my board set up again to figure out the best fix for rk3399-nanopc-t4 (FWIW most users are probably just using passive cooling or a plain DC fan anyway). You might want to raise this issue with the maintainers of arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi, since the everything-shared-by-everything approach in there was what I used as a reference.

Robin.

#9 lore raw
Quoted 68 lines · Robin Murphy
Quoted 59 lines · Daniel Lezcano
Quoted 38 lines · Heiko Stuebner

Hi Daniel,

Am Dienstag, 4. Juni 2019, 18:57:57 CEST schrieb Daniel Lezcano:

Quoted 35 lines

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------

  1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -9
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
                       type = "critical";
                   };
               };
-
-            cooling-maps {
-                map0 {
-                    trip = <&gpu_alert0>;
-                    cooling-device =
-                        <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                        <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-                };
-            };
Quoted 8 lines

arch/arm64/boot/dts/rockchip/rk3399.dtsi line 825

Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -0
           };
       };

my knowledge of the thermal framework is not that big, but what about the
rk3399-devices which further detail the cooling-maps like rk3399-gru-kevin
and the rk3399-nanopc-t4 with its fan-handling in the cooling-maps?

The rk3399-gru-kevin is correct.

The rk3399-nanopc-t4 is not correct because the cpu and the gpu are sharing the same cooling device (the fan). There are different configurations:

1. The cpu cooling device for the CPU and the fan for the GPU

2. Different trip points on the CPU thermal zone, eg. one to for the CPU cooling device and another one for the fan.

Quoted 7 lines

There are some variant for the above. If this board is not on battery, you may want to give priority to the throughput, so activate the fan first and then cool down the CPU. Or if you are on battery, you may want to invert the trip points.

In any case, it is not possible to share the same cooling device for different thermal zones.

Quoted 7 lines

OK, thanks for the clarification. I'll get my board set up again to figure out the best fix for rk3399-nanopc-t4 (FWIW most users are probably just using passive cooling or a plain DC fan anyway). You might want to raise this issue with the maintainers of arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi, since the everything-shared-by-everything approach in there was what I used as a reference.

Cc'ed: Kukjin Kim and Krzysztof Kozlowski

Easy :)

Signature · 11 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#10 lore raw
Quoted 77 lines · Daniel Lezcano
Quoted 68 lines · Robin Murphy
Quoted 59 lines · Daniel Lezcano
Quoted 38 lines · Heiko Stuebner

Hi Daniel,

Am Dienstag, 4. Juni 2019, 18:57:57 CEST schrieb Daniel Lezcano:

Quoted 35 lines

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------

  1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -9
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
                       type = "critical";
                   };
               };
-
-            cooling-maps {
-                map0 {
-                    trip = <&gpu_alert0>;
-                    cooling-device =
-                        <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                        <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-                };
-            };
Quoted 8 lines

arch/arm64/boot/dts/rockchip/rk3399.dtsi line 825

Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -0
           };
       };

my knowledge of the thermal framework is not that big, but what about the
rk3399-devices which further detail the cooling-maps like rk3399-gru-kevin
and the rk3399-nanopc-t4 with its fan-handling in the cooling-maps?

The rk3399-gru-kevin is correct.

The rk3399-nanopc-t4 is not correct because the cpu and the gpu are sharing the same cooling device (the fan). There are different configurations:

1. The cpu cooling device for the CPU and the fan for the GPU

2. Different trip points on the CPU thermal zone, eg. one to for the CPU cooling device and another one for the fan.

Quoted 7 lines

There are some variant for the above. If this board is not on battery, you may want to give priority to the throughput, so activate the fan first and then cool down the CPU. Or if you are on battery, you may want to invert the trip points.

In any case, it is not possible to share the same cooling device for different thermal zones.

Quoted 7 lines

OK, thanks for the clarification. I'll get my board set up again to figure out the best fix for rk3399-nanopc-t4 (FWIW most users are probably just using passive cooling or a plain DC fan anyway). You might want to raise this issue with the maintainers of arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi, since the everything-shared-by-everything approach in there was what I used as a reference.

Quoted 4 lines

Cc'ed: Kukjin Kim and Krzysztof Kozlowski

Easy :)

Assuming that all trip-points are the same between thermal zones, I understand that solution could be to have one thermal zone with thermal multiple sensors (some time ago bindings did not support it) and all cooling devices? Then only one governor would be assigned?

Best regards,
Krzysztof

#11 lore raw
Quoted 80 lines · Krzysztof Kozlowski
Quoted 79 lines · Daniel Lezcano
Quoted 68 lines · Robin Murphy
Quoted 59 lines · Daniel Lezcano
Quoted 38 lines · Heiko Stuebner

Hi Daniel,

Am Dienstag, 4. Juni 2019, 18:57:57 CEST schrieb Daniel Lezcano:

Quoted 35 lines

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------

  1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -9
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
                       type = "critical";
                   };
               };
-
-            cooling-maps {
-                map0 {
-                    trip = <&gpu_alert0>;
-                    cooling-device =
-                        <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                        <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-                };
-            };
Quoted 8 lines

arch/arm64/boot/dts/rockchip/rk3399.dtsi line 825

Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -0
           };
       };

my knowledge of the thermal framework is not that big, but what about the
rk3399-devices which further detail the cooling-maps like rk3399-gru-kevin
and the rk3399-nanopc-t4 with its fan-handling in the cooling-maps?

The rk3399-gru-kevin is correct.

The rk3399-nanopc-t4 is not correct because the cpu and the gpu are sharing the same cooling device (the fan). There are different configurations:

1. The cpu cooling device for the CPU and the fan for the GPU

2. Different trip points on the CPU thermal zone, eg. one to for the CPU cooling device and another one for the fan.

Quoted 7 lines

There are some variant for the above. If this board is not on battery, you may want to give priority to the throughput, so activate the fan first and then cool down the CPU. Or if you are on battery, you may want to invert the trip points.

In any case, it is not possible to share the same cooling device for different thermal zones.

Quoted 7 lines

OK, thanks for the clarification. I'll get my board set up again to figure out the best fix for rk3399-nanopc-t4 (FWIW most users are probably just using passive cooling or a plain DC fan anyway). You might want to raise this issue with the maintainers of arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi, since the everything-shared-by-everything approach in there was what I used as a reference.

Cc'ed: Kukjin Kim and Krzysztof Kozlowski

Quoted 7 lines
Quoted 2 lines

Easy :)

Assuming that all trip-points are the same between thermal zones, I understand that solution could be to have one thermal zone with thermal multiple sensors (some time ago bindings did not support it) and all cooling devices? Then only one governor would be assigned?

The multiple sensors, multiple thermal zones and governors dealing with different group of them is not implemented [yet]. Basically, you can consider there is a 1:1 relationship between each of them.

one thermal zone = one sensor = one cooling device

Given the configuration and the hardware, it would make sense to create one thermal zone per cluster.

There is one clock line per cluster. It is possible to create two CPU cooling devices, one for each cluster.

IMO, the fan definition is correct except it should be assigned to one thermal zone only.

One configuration could be:

thermal-zones {
	little-thermal-zone: little-thermal-zone {
		thermal-sensors = <&tmu_cpu0 0>;
                polling-delay-passive = <250>;
                polling-delay = <0>;

		trips {
			ltz_alert0: ltz-alert-0 {
				temperature = <50000>;
				hysteresis = <5000>;
                        	type = "active";
			};

			ltz_alert1: cpu-alert-1 {
				temperature = <60000>;
				hysteresis = <5000>;
				type = "active";
			};

			ltz_alert2: ltz-alert-2 {
				temperature = <70000>;
				hysteresis = <5000>;
				type = "active";
			};

			ltz_alert3: ltz-alert-3 {
				temperature = <75000>;
				hysteresis = <10000>;
				type = "passive";
			};

			ltz_crit0: ltz-crit-0 {
				temperature = <120000>;
				hysteresis = <0>;
				type = "critical";
			};
		};

		cooling-maps {
			map0 {
				trip = <&ltz_alert0>;
				cooling-device = <&fan0 0 1>;
			};

			map1 {
				trip = <&ltz_alert1>;
				cooling-device = <&fan0 1 2>;
			};

			map2 {
				trip = <&ltz_alert2>;
				cooling-device = <&fan0 2 3>;
			};

			map3 {
				trip = <&ltz_alert3>;
				cooling-device = <&cpu0
						THERMAL_NO_LIMIT
						THERMAL_NO_LIMIT>,

						 <&cpu1
						THERMAL_NO_LIMIT
						THERMAL_NO_LIMIT>,

						 <&cpu2
						THERMAL_NO_LIMIT
						THERMAL_NO_LIMIT>,

						 <&cpu3
						THERMAL_NO_LIMIT
						THERMAL_NO_LIMIT>,
			};
		};
	};

	big-thermal-zone: big-thermal-zone {

		/* The same as little, except the sensor and the cpu
		  cooling &cpu4, &cpu5, &cpu6, &cpu7 */

	};
};

That said, the idle injection cooling device is for the moment being developed and that would be a good opportunity to test a real per cpu cooling device as the exynos5422 has a per core sensor.

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#12 lore raw
In reply to Daniel Lezcano

Gentle ping ...

Quoted 38 lines · Daniel Lezcano

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 ---------
 1 file changed, 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -9
index 196ac9b78076..e1357e0f60f7 100644
@@ -821,15 +821,6 @@
 					type = "critical";
 				};
 			};
-
-			cooling-maps {
-				map0 {
-					trip = <&gpu_alert0>;
-					cooling-device =
-						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-						<&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-				};
-			};
 		};
 	};
 
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
maintainer
#13 lore raw
In reply to Daniel Lezcano

Am Dienstag, 4. Juni 2019, 18:57:57 CEST schrieb Daniel Lezcano:

Quoted 5 lines

Currently the common thermal zones definitions for the rk3399 assumes multiple thermal zones are supported by the governors. This is not the case and each thermal zone has its own governor instance acting individually without collaboration with other governors.

Quoted 8 lines

As the cooling device for the CPU and the GPU thermal zones is the same, each governors take different decisions for the same cooling device leading to conflicting instructions and an erratic behavior.

As the cooling-maps is about to become an optional property, let's remove the cpu cooling device map from the GPU thermal zone.

applied both patches for 5.3

Thanks
Heiko