Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1366170 > unrolled thread

[PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220

Started byLeo Yan <leo.yan@linaro.org>
First post2016-03-29 13:30 +0200
Last post2016-03-30 17:20 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220 Leo Yan <leo.yan@linaro.org> - 2016-03-29 13:30 +0200
    [PATCH v3 4/4] arm64: dts: register Hi6220's thermal zone for power allocator Leo Yan <leo.yan@linaro.org> - 2016-03-29 13:30 +0200
    [PATCH v3 3/4] arm64: dts: register Hi6220's thermal sensor Leo Yan <leo.yan@linaro.org> - 2016-03-29 13:30 +0200
    [PATCH v3 2/4] thermal: hisilicon: fix IRQ imbalance enabling Leo Yan <leo.yan@linaro.org> - 2016-03-29 13:30 +0200
    Re: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for  Hi6220 Eduardo Valentin <edubezval@gmail.com> - 2016-03-29 17:50 +0200
      Re: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for  Hi6220 Leo Yan <leo.yan@linaro.org> - 2016-03-30 05:00 +0200
        Re: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for  Hi6220 Wei Xu <xuwei5@hisilicon.com> - 2016-03-30 17:20 +0200

#1366170 — [PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220

FromLeo Yan <leo.yan@linaro.org>
Date2016-03-29 13:30 +0200
Subject[PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220
Message-ID<ri00q-5tz-11@gated-at.bofh.it>
Hi6220 has octa-core so it has quite high power consumption when run
benchmark and introduces high temperature for SoC. So need enable
thermal governor to control temperature and also cannot hurt much for
performance after impose cooling operations on CPU.

This patch series is to enable power allocator for Hi6220. Patch 1 is to
change "hysteresis" as optional property for trip points, so when enable
power allocator governor we can ignore this property.

During profiling also found two issues for thermal sensor's driver. The
power allocator just uses only one sensor, so patch 2 is to fix sensor
driver to let it can initialize driver successfully with only enabling
one sensor; patch 3 is to dismiss warning of IRQ imbalance enabling.

After profiling on Hikey, the power model has been simplized with only
dynamic coefficient, and now it's convienence to pass it from CPU node.
So patch 4 and 5 bind sensor and pass power model parameters.

This patch series have been tested on 96boards Hikey.

Changes from v2:
* Discarded patch for changing "hysteresis" as optional property
* Added back "hysteresis" property

Changes from v1:
* According to Javi's review, removed unecessary properties for DT
* Added patch 1 for change "hysteresis" as optional property
* Added patch 3 to fix IRQ imbalance enabling issue


Leo Yan (4):
  thermal: hisilicon: support to use any sensor
  thermal: hisilicon: fix IRQ imbalance enabling
  arm64: dts: register Hi6220's thermal sensor
  arm64: dts: register Hi6220's thermal zone for power allocator

 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 44 +++++++++++++++++++++++++++++++
 drivers/thermal/hisi_thermal.c            | 40 +++++++++++++++++-----------
 2 files changed, 68 insertions(+), 16 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1366172 — [PATCH v3 4/4] arm64: dts: register Hi6220's thermal zone for power allocator

FromLeo Yan <leo.yan@linaro.org>
Date2016-03-29 13:30 +0200
Subject[PATCH v3 4/4] arm64: dts: register Hi6220's thermal zone for power allocator
Message-ID<ri00q-5tz-23@gated-at.bofh.it>
In reply to#1366170
With profiling Hi6220's power modeling so get dynamic coefficient and
sustainable power. So pass these parameters from DT.

Now enable power allocator with only one actor for CPU part, so directly
use cluster0's thermal sensor for monitoring temperature.

Reviewed-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 35 +++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 50ba1b0..1c7b133 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -6,6 +6,7 @@
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/hi6220-clock.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	compatible = "hisilicon,hi6220";
@@ -87,6 +88,7 @@
 			cooling-max-level = <0>;
 			#cooling-cells = <2>; /* min followed by max */
 			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
+			dynamic-power-coefficient = <311>;
 		};
 
 		cpu1: cpu@1 {
@@ -322,5 +324,38 @@
 			clock-names = "thermal_clk";
 			#thermal-sensor-cells = <1>;
 		};
+
+		thermal-zones {
+
+			cls0: cls0 {
+				polling-delay = <1000>;
+				polling-delay-passive = <100>;
+				sustainable-power = <3326>;
+
+				/* sensor ID */
+				thermal-sensors = <&tsensor 2>;
+
+				trips {
+					threshold: trip-point@0 {
+						temperature = <65000>;
+						hysteresis = <0>;
+						type = "passive";
+					};
+
+					target: trip-point@1 {
+						temperature = <75000>;
+						hysteresis = <0>;
+						type = "passive";
+					};
+				};
+
+				cooling-maps {
+					map0 {
+						trip = <&target>;
+						cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					};
+				};
+			};
+		};
 	};
 };
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1366174 — [PATCH v3 3/4] arm64: dts: register Hi6220's thermal sensor

FromLeo Yan <leo.yan@linaro.org>
Date2016-03-29 13:30 +0200
Subject[PATCH v3 3/4] arm64: dts: register Hi6220's thermal sensor
Message-ID<ri00r-5tz-29@gated-at.bofh.it>
In reply to#1366170
Bind thermal sensor driver for Hi6220.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index f588be9..50ba1b0 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -313,5 +313,14 @@
 			interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
 			#mbox-cells = <3>;
 		};
+
+		tsensor: tsensor@0,f7030700 {
+			compatible = "hisilicon,tsensor";
+			reg = <0x0 0xf7030700 0x0 0x1000>;
+			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&sys_ctrl 22>;
+			clock-names = "thermal_clk";
+			#thermal-sensor-cells = <1>;
+		};
 	};
 };
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1366176 — [PATCH v3 2/4] thermal: hisilicon: fix IRQ imbalance enabling

FromLeo Yan <leo.yan@linaro.org>
Date2016-03-29 13:30 +0200
Subject[PATCH v3 2/4] thermal: hisilicon: fix IRQ imbalance enabling
Message-ID<ri00r-5tz-39@gated-at.bofh.it>
In reply to#1366170
When register sensors into thermal zone during initialization phase, it
reports error for IRQ imbalance enabling:

[    2.040713] WARNING: at kernel/irq/manage.c:513
[    2.040719] Modules linked in:
[    2.040721]
[    2.040729] CPU: 1 PID: 804 Comm: irq/33-hisi_the Not tainted 4.5.0-rc4+ #505
[    2.040732] Hardware name: HiKey Development Board (DT)
[    2.040736] task: ffffffc03ae82580 ti: ffffffc0379c8000 task.ti: ffffffc0379c8000
[    2.040745] PC is at __enable_irq+0x74/0x84
[    2.040749] LR is at __enable_irq+0x74/0x84

This warning is for IRQ imbalance enabling, which is caused by
enable_irq() twice. During sensor's initialization it tries to enable
IRQ, the driver will call thermal_zone_of_sensor_register() to bind
sensors and read sensor's temperature. But at this moment the flag
"data->irq_enabled" has been not initialized as correct state, so it
finally introduces the function enabled_irq() to be called twice. In
essentially this is caused by the flag "data->irq_enabled" is
inconsistent with real hardware IRQ enabling state.

So this patch is to fix this issue, firstly init "irq_enabled" flag
before binding sensors to thermal zone. Also change to use the function
irq_get_irqchip_state() to read back real interrupt line state.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 drivers/thermal/hisi_thermal.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 0fed5cf..4fef1b3 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -343,6 +343,10 @@ static int hisi_thermal_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	hisi_thermal_enable_bind_irq_sensor(data);
+	irq_get_irqchip_state(data->irq, IRQCHIP_STATE_MASKED,
+			      &data->irq_enabled);
+
 	for (i = 0; i < HISI_MAX_SENSORS; ++i) {
 		ret = hisi_thermal_register_sensor(pdev, data,
 						   &data->sensors[i], i);
@@ -353,9 +357,6 @@ static int hisi_thermal_probe(struct platform_device *pdev)
 			hisi_thermal_toggle_sensor(&data->sensors[i], true);
 	}
 
-	hisi_thermal_enable_bind_irq_sensor(data);
-	data->irq_enabled = true;
-
 	return 0;
 }
 
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1366410 — Re: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-29 17:50 +0200
SubjectRe: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220
Message-ID<ri443-8nF-37@gated-at.bofh.it>
In reply to#1366170
On Tue, Mar 29, 2016 at 07:27:11PM +0800, Leo Yan wrote:
> Hi6220 has octa-core so it has quite high power consumption when run
> benchmark and introduces high temperature for SoC. So need enable
> thermal governor to control temperature and also cannot hurt much for
> performance after impose cooling operations on CPU.
> 
> This patch series is to enable power allocator for Hi6220. Patch 1 is to
> change "hysteresis" as optional property for trip points, so when enable
> power allocator governor we can ignore this property.
> 
> During profiling also found two issues for thermal sensor's driver. The
> power allocator just uses only one sensor, so patch 2 is to fix sensor
> driver to let it can initialize driver successfully with only enabling
> one sensor; patch 3 is to dismiss warning of IRQ imbalance enabling.
> 
> After profiling on Hikey, the power model has been simplized with only
> dynamic coefficient, and now it's convienence to pass it from CPU node.
> So patch 4 and 5 bind sensor and pass power model parameters.
> 
> This patch series have been tested on 96boards Hikey.

Applied patches 1 and 2 in my fixes branch. Patches 3 and 4 need to go
via the hisi platform tree. You may add my

Acked-by: Eduardo Valentin <edubezval@gmail.com>

on patches 3 and 4 if you want.

[toc] | [prev] | [next] | [standalone]


#1366876 — Re: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220

FromLeo Yan <leo.yan@linaro.org>
Date2016-03-30 05:00 +0200
SubjectRe: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220
Message-ID<riewp-7nA-3@gated-at.bofh.it>
In reply to#1366410
On Tue, Mar 29, 2016 at 08:45:59AM -0700, Eduardo Valentin wrote:
> On Tue, Mar 29, 2016 at 07:27:11PM +0800, Leo Yan wrote:
> > Hi6220 has octa-core so it has quite high power consumption when run
> > benchmark and introduces high temperature for SoC. So need enable
> > thermal governor to control temperature and also cannot hurt much for
> > performance after impose cooling operations on CPU.
> > 
> > This patch series is to enable power allocator for Hi6220. Patch 1 is to
> > change "hysteresis" as optional property for trip points, so when enable
> > power allocator governor we can ignore this property.
> > 
> > During profiling also found two issues for thermal sensor's driver. The
> > power allocator just uses only one sensor, so patch 2 is to fix sensor
> > driver to let it can initialize driver successfully with only enabling
> > one sensor; patch 3 is to dismiss warning of IRQ imbalance enabling.
> > 
> > After profiling on Hikey, the power model has been simplized with only
> > dynamic coefficient, and now it's convienence to pass it from CPU node.
> > So patch 4 and 5 bind sensor and pass power model parameters.
> > 
> > This patch series have been tested on 96boards Hikey.
> 
> Applied patches 1 and 2 in my fixes branch. Patches 3 and 4 need to go
> via the hisi platform tree. You may add my
> 
> Acked-by: Eduardo Valentin <edubezval@gmail.com>
> 
> on patches 3 and 4 if you want.

Thanks, Eduardo.

Hi Wei,

Could you help pick up patches 3/4 for enabling thermal in dts?

Thanks,
Leo Yan

[toc] | [prev] | [next] | [standalone]


#1367285 — Re: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220

FromWei Xu <xuwei5@hisilicon.com>
Date2016-03-30 17:20 +0200
SubjectRe: [PATCH v3 0/4] thermal: hisilicon: enable power allocator for Hi6220
Message-ID<riq4x-7jq-5@gated-at.bofh.it>
In reply to#1366876
Hi Leo,

On 30/03/2016 03:53, Leo Yan wrote:
> On Tue, Mar 29, 2016 at 08:45:59AM -0700, Eduardo Valentin wrote:
>> On Tue, Mar 29, 2016 at 07:27:11PM +0800, Leo Yan wrote:
>>> Hi6220 has octa-core so it has quite high power consumption when run
>>> benchmark and introduces high temperature for SoC. So need enable
>>> thermal governor to control temperature and also cannot hurt much for
>>> performance after impose cooling operations on CPU.
>>>
>>> This patch series is to enable power allocator for Hi6220. Patch 1 is to
>>> change "hysteresis" as optional property for trip points, so when enable
>>> power allocator governor we can ignore this property.
>>>
>>> During profiling also found two issues for thermal sensor's driver. The
>>> power allocator just uses only one sensor, so patch 2 is to fix sensor
>>> driver to let it can initialize driver successfully with only enabling
>>> one sensor; patch 3 is to dismiss warning of IRQ imbalance enabling.
>>>
>>> After profiling on Hikey, the power model has been simplized with only
>>> dynamic coefficient, and now it's convienence to pass it from CPU node.
>>> So patch 4 and 5 bind sensor and pass power model parameters.
>>>
>>> This patch series have been tested on 96boards Hikey.
>>
>> Applied patches 1 and 2 in my fixes branch. Patches 3 and 4 need to go
>> via the hisi platform tree. You may add my
>>
>> Acked-by: Eduardo Valentin <edubezval@gmail.com>
>>
>> on patches 3 and 4 if you want.
> 
> Thanks, Eduardo.
> 
> Hi Wei,
> 
> Could you help pick up patches 3/4 for enabling thermal in dts?

Applied 3 & 4.
Thanks!

Best Regards,
Wei

> 
> Thanks,
> Leo Yan
> 
> .
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web