Skip to contentSkip to conversation

RFC: device thermal limits represented in device tree nodes

DISCUSSION Eduardo Valentin 4 participants 17 messages Jul 22, 2013 – Aug 8, 2013

lore
Share & tools
lore
#0 lore raw

Hello Grant and Rob,

(Resending, as I got a message saying:
<[email protected]>: Recipient address rejected: User has moved to devicetree at vger.kernel.org)

I am writing this email to you specifically to ask your technical assessment with respect to representing device thermal limits as device tree nodes. I am proposing to introduce device tree nodes to describe these limits as thermal zones, their composition and their relations with cooling devices and other thermal zones (thermal data).

As you should know, device thermal limits are part of hardware specification. Considering your board layout, mechanics, power dissipation and composition of ICs, etc, that will impose thermal requirements on your system, and infringing these limits can lead to device damage, device life time reduction or even end user harm. Thus, the thermal data help to describe the hardware limits and what needs to be done if those limits are crosses, as part of your board design and non-functional requirements. Obviously that is very dependent on your hardware, and not all of them will have these non-functional requirements. Besides, describing these limits has *nothing* to do with how you actually find these limits.

In any case, there is a need to properly represent these requirements and I am proposing to have this representation in device tree. There were already couple of counter-arguments claiming this is actually about configuration and performance profile description. But I still stand against these two readings of this proposal and again state that if one interprets it as configuration or performance profile, that is a mis-understanding [0]. Let me state it clear (again [1]), my proposal is to describe hardware thermal limits, because these limits are part of a hardware specification; representing in device tree would not infringe the original purpose of this data structure ("The Device Tree is a data structure for describing hardware."[2]).

Before I explain my proposal, I want to highlight also that these data is represented elsewhere already and it is reused across different OS's. Thermal data is described using ACPI [3] and operating systems ACPI-aware do support the interpretation of thermal data. Linux is one example of such systems (I believe I do not need to enlist here all systems supporting ACPI). On the other hand, not all systems have ACPI or are specified to use ACPI. Thus, here is another reason to represent properly thermal data, so that we can scale across systems.

In the specific case of Linux, the common thermal concepts between ACPI systems and non-ACPI systems have been represented in the thermal framework (CONFIG_THERMAL). Today, on ACPI systems, thermal data is fetched from bootloader with help from the common ACPI parser. For non-ACPI systems, the thermal data is actually coded as part of device drivers.

So, to the point, a brief explanation of my proposal goes as follows:
i - trip points: a node to describe a point in the temperature domain
in which the system has to take an action. This node describes just the point, not the action. Properties here are temperature, hysteresis, and type (critical, hot, passive, active, etc).
ii - binding parameters: the bind_param node is a node to describe how actions (cooling devices) get assigned to trip points. Cooling devices are expected to be loaded in the target system. Properties here are:
cooling device name, weight, trip_mask and limits.
iii - thermal zones: the thermal_zone node is the node containing all the required info for describing a thermal zone with hardware thermal limitation, including its bindings with cooling devices. Properties here
are: type, passive_delay, polling_delay, governor. The thermal_zone node must contain, apart from its own properties, one node containing trip nodes and one node containing all the zone bind parameters.

Here is an example (on OMAP4430):

thermal_zone {
	type = "CPU";
	mask = <0x03>; /* trips writability */
	passive_delay = <250>; /* milliseconds */
	polling_delay = <1000>; /* milliseconds */
	governor = "step_wise";
	trips {
		alert@100000{
			temperature = <100000>; /* milliCelsius
			hysteresis = <2000>; /* milliCelsius */
			type = <THERMAL_TRIP_PASSIVE>;
		};
		crit@125000{
			temperature = <125000>; /* milliCelsius
			hysteresis = <2000>; /* milliCelsius */
			type = <THERMAL_TRIP_CRITICAL>;
		};
	};
	bind_params {
		action@0{
			cooling_device = "thermal-cpufreq";
			weight = <100>; /* percentage */
			mask = <0x01>;
			/* no limits, using defaults */
		};
	};
};

In this current proposal, a 'thermal_zone' node would be embedded inside a temperature sensor node, for simplicity. But other possible builds could embedded them in the device with thermal limits (CPU nodes, for instance) or they could be not embedded in any specific node.

A full documented description can be found here [4]. Also a branch containing:
(a) needed changes in order to have this DT parser;
(b) the DT parser with documentation
(c) examples on how drivers could be changes to use the parser can be found in my branch here [5]. I wrote the thermal DT parser to build thermal zones with the thermal framework API. However, if one does not want to do that, it can simple do not include a CONFIG_THERMAL_OF=y in her/his build, and the calls will be translated to nops, and the device tree thermal data can be parsed to somewhere else interested (other subsystem or even user land). A TODO on this implementation is that it still lacks the representation of thermal zones composed by several sensors. However, I believe it is better to take an incremental approach here. This series can already be used to improve most of the existing platform thermal drivers (most are CPU thermal drivers) and to reuse the existing code of some hwmon sensors to build thermal zones for board thermal requirements.

I have already posted a patch series with this proposal on [6], that contains a reference for the original RFC. But looks like my messages got moderated on device tree mailing list. Obviously, within PM forum, feedback was quite positive. However, we cannot proceed without proper assessment of other subsystems. lm-sensors folks (Guenter) seam to be strongly against this series, as there is a fear that this may introduce a mis-usage of DT. I still believe this is needed for hardware description, and thus not a infringement on DT purposes.

Please let me know your thoughts on this topic and apologize me if my previous messages on this topic did not reach you (hope they reach now).

All best,

Eduardo Valentin

[0] - https://lkml.org/lkml/2013/7/17/621
[1] - https://lkml.org/lkml/2013/7/18/279
[2] - www.devicetree.org
[3] - http://www.acpi.info/
[4] -
https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/diff/Documentation/devicetree/bindings/thermal/thermal.txt?h=thermal_work/thermal_core/dt_parser&id=405bf0b51457ed055a082af2653d7ce757bc2e91
[5] -
https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/log/?h=thermal_work/thermal_core/dt_parser
[6] - https://lkml.org/lkml/2013/7/17/923

Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw
Quoted 6 lines · Eduardo Valentin

Hello Grant and Rob,

(Resending, as I got a message saying:
<[email protected]>: Recipient address rejected:
User has moved to devicetree at vger.kernel.org)

Quoted 6 lines

I am writing this email to you specifically to ask your technical assessment with respect to representing device thermal limits as device tree nodes. I am proposing to introduce device tree nodes to describe these limits as thermal zones, their composition and their relations with cooling devices and other thermal zones (thermal data).

Given:
https://lkml.org/lkml/2013/7/20/69
[PATCH 3/3] MAINTAINERS: Refactor device tree maintainership

I'm explicitly CCing a few people besides Grant/Rob, and qouting the whole email.

From my perspective, the concept of including thermal limits in DT seems reasonable, although I haven't looked at the proposed binding itself in detail yet.

Quoted 105 lines

As you should know, device thermal limits are part of hardware specification. Considering your board layout, mechanics, power dissipation and composition of ICs, etc, that will impose thermal requirements on your system, and infringing these limits can lead to device damage, device life time reduction or even end user harm. Thus, the thermal data help to describe the hardware limits and what needs to be done if those limits are crosses, as part of your board design and non-functional requirements. Obviously that is very dependent on your hardware, and not all of them will have these non-functional requirements. Besides, describing these limits has *nothing* to do with how you actually find these limits.

In any case, there is a need to properly represent these requirements and I am proposing to have this representation in device tree. There were already couple of counter-arguments claiming this is actually about configuration and performance profile description. But I still stand against these two readings of this proposal and again state that if one interprets it as configuration or performance profile, that is a mis-understanding [0]. Let me state it clear (again [1]), my proposal is to describe hardware thermal limits, because these limits are part of a hardware specification; representing in device tree would not infringe the original purpose of this data structure ("The Device Tree is a data structure for describing hardware."[2]).

Before I explain my proposal, I want to highlight also that these data is represented elsewhere already and it is reused across different OS's. Thermal data is described using ACPI [3] and operating systems ACPI-aware do support the interpretation of thermal data. Linux is one example of such systems (I believe I do not need to enlist here all systems supporting ACPI). On the other hand, not all systems have ACPI or are specified to use ACPI. Thus, here is another reason to represent properly thermal data, so that we can scale across systems.

In the specific case of Linux, the common thermal concepts between ACPI systems and non-ACPI systems have been represented in the thermal framework (CONFIG_THERMAL). Today, on ACPI systems, thermal data is fetched from bootloader with help from the common ACPI parser. For non-ACPI systems, the thermal data is actually coded as part of device drivers.

So, to the point, a brief explanation of my proposal goes as
follows: i - trip points: a node to describe a point in the
temperature domain in which the system has to take an action. This node describes just the point, not the action. Properties here are temperature, hysteresis, and type (critical, hot, passive, active, etc). ii - binding parameters: the bind_param node is a node to describe how actions (cooling devices) get assigned to trip points. Cooling devices are expected to be loaded in the target system. Properties here are: cooling device name, weight, trip_mask and limits. iii - thermal zones: the thermal_zone node is the node containing all the required info for describing a thermal zone with hardware thermal limitation, including its bindings with cooling devices. Properties here are: type, passive_delay, polling_delay, governor. The thermal_zone node must contain, apart from its own properties, one node containing trip nodes and one node containing all the zone bind parameters.

Here is an example (on OMAP4430): thermal_zone { type = "CPU"; mask
= <0x03>; /* trips writability */ passive_delay = <250>; /*
milliseconds */ polling_delay = <1000>; /* milliseconds */ governor
= "step_wise"; trips { alert@100000{ temperature = <100000>; /*
milliCelsius hysteresis = <2000>; /* milliCelsius */ type > <THERMAL_TRIP_PASSIVE>; }; crit@125000{ temperature = <125000>; /* milliCelsius hysteresis = <2000>; /* milliCelsius */ type > <THERMAL_TRIP_CRITICAL>; }; }; bind_params { action@0{ cooling_device = "thermal-cpufreq"; weight = <100>; /* percentage
*/ mask = <0x01>; /* no limits, using defaults */ }; }; };

In this current proposal, a 'thermal_zone' node would be embedded inside a temperature sensor node, for simplicity. But other possible builds could embedded them in the device with thermal limits (CPU nodes, for instance) or they could be not embedded in any specific node.

A full documented description can be found here [4]. Also a branch
containing: (a) needed changes in order to have this DT parser; (b) the DT parser with documentation (c) examples on how drivers could be changes to use the parser can be found in my branch here [5]. I wrote the thermal DT parser to build thermal zones with the thermal framework API. However, if one does not want to do that, it can simple do not include a CONFIG_THERMAL_OF=y in her/his build, and the calls will be translated to nops, and the device tree thermal data can be parsed to somewhere else interested (other subsystem or even user land). A TODO on this implementation is that it still lacks the representation of thermal zones composed by several sensors. However, I believe it is better to take an incremental approach here. This series can already be used to improve most of the existing platform thermal drivers (most are CPU thermal drivers) and to reuse the existing code of some hwmon sensors to build thermal zones for board thermal requirements.

I have already posted a patch series with this proposal on [6], that contains a reference for the original RFC. But looks like my messages got moderated on device tree mailing list. Obviously, within PM forum, feedback was quite positive. However, we cannot proceed without proper assessment of other subsystems. lm-sensors folks (Guenter) seam to be strongly against this series, as there is a fear that this may introduce a mis-usage of DT. I still believe this is needed for hardware description, and thus not a infringement on DT purposes.

Please let me know your thoughts on this topic and apologize me if my previous messages on this topic did not reach you (hope they reach now).

Quoted 10 lines

All best,

Eduardo Valentin

[0] - https://lkml.org/lkml/2013/7/17/621 [1] -
https://lkml.org/lkml/2013/7/18/279 [2] - www.devicetree.org [3] -
http://www.acpi.info/ [4] -
https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/diff/Documentation/devicetree/bindings/thermal/thermal.txt?h=thermal_work/thermal_core/dt_parser&id@5bf0b51457ed055a082af2653d7ce757bc2e91

[5] -

Quoted 3 lines

https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/log/?h=thermal_work/thermal_core/dt_parser

[6] - https://lkml.org/lkml/2013/7/17/923

Quoted 2 lines

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
Quoted 18 lines · Stephen Warren
Quoted 6 lines · Eduardo Valentin

Hello Grant and Rob,

(Resending, as I got a message saying:
<[email protected]>: Recipient address rejected:
User has moved to devicetree at vger.kernel.org)

Quoted 6 lines

I am writing this email to you specifically to ask your technical assessment with respect to representing device thermal limits as device tree nodes. I am proposing to introduce device tree nodes to describe these limits as thermal zones, their composition and their relations with cooling devices and other thermal zones (thermal data).

Given:
https://lkml.org/lkml/2013/7/20/69
[PATCH 3/3] MAINTAINERS: Refactor device tree maintainership

Quoted 6 lines

I'm explicitly CCing a few people besides Grant/Rob, and qouting the whole email.

From my perspective, the concept of including thermal limits in DT seems reasonable, although I haven't looked at the proposed binding itself in detail yet.

The concept of defining hard thermal limits in DT certianly seems reasonable.

Quoted 1 line

From a quick look at the version on lkml [1], it seems like this leaks a

Linux implementation details (e.g. governer names) into the binding, and I think that the linkage of devices to thermal zones should be definedd more explicitly. A reposting of the series to devicetree (and lakml?) would be helpful for review.

Thanks,
Mark.

[1] https://lkml.org/lkml/2013/7/17/379

Quoted 127 lines
Quoted 108 lines

As you should know, device thermal limits are part of hardware specification. Considering your board layout, mechanics, power dissipation and composition of ICs, etc, that will impose thermal requirements on your system, and infringing these limits can lead to device damage, device life time reduction or even end user harm. Thus, the thermal data help to describe the hardware limits and what needs to be done if those limits are crosses, as part of your board design and non-functional requirements. Obviously that is very dependent on your hardware, and not all of them will have these non-functional requirements. Besides, describing these limits has *nothing* to do with how you actually find these limits.

In any case, there is a need to properly represent these requirements and I am proposing to have this representation in device tree. There were already couple of counter-arguments claiming this is actually about configuration and performance profile description. But I still stand against these two readings of this proposal and again state that if one interprets it as configuration or performance profile, that is a mis-understanding [0]. Let me state it clear (again [1]), my proposal is to describe hardware thermal limits, because these limits are part of a hardware specification; representing in device tree would not infringe the original purpose of this data structure ("The Device Tree is a data structure for describing hardware."[2]).

Before I explain my proposal, I want to highlight also that these data is represented elsewhere already and it is reused across different OS's. Thermal data is described using ACPI [3] and operating systems ACPI-aware do support the interpretation of thermal data. Linux is one example of such systems (I believe I do not need to enlist here all systems supporting ACPI). On the other hand, not all systems have ACPI or are specified to use ACPI. Thus, here is another reason to represent properly thermal data, so that we can scale across systems.

In the specific case of Linux, the common thermal concepts between ACPI systems and non-ACPI systems have been represented in the thermal framework (CONFIG_THERMAL). Today, on ACPI systems, thermal data is fetched from bootloader with help from the common ACPI parser. For non-ACPI systems, the thermal data is actually coded as part of device drivers.

So, to the point, a brief explanation of my proposal goes as
follows: i - trip points: a node to describe a point in the
temperature domain in which the system has to take an action. This node describes just the point, not the action. Properties here are temperature, hysteresis, and type (critical, hot, passive, active, etc). ii - binding parameters: the bind_param node is a node to describe how actions (cooling devices) get assigned to trip points. Cooling devices are expected to be loaded in the target system. Properties here are: cooling device name, weight, trip_mask and limits. iii - thermal zones: the thermal_zone node is the node containing all the required info for describing a thermal zone with hardware thermal limitation, including its bindings with cooling devices. Properties here are: type, passive_delay, polling_delay, governor. The thermal_zone node must contain, apart from its own properties, one node containing trip nodes and one node containing all the zone bind parameters.

Here is an example (on OMAP4430): thermal_zone { type = "CPU"; mask = <0x03>; /* trips writability */ passive_delay = <250>; /* milliseconds */ polling_delay = <1000>; /* milliseconds */ governor = "step_wise"; trips { alert@100000{ temperature = <100000>; /* milliCelsius hysteresis = <2000>; /* milliCelsius */ type = <THERMAL_TRIP_PASSIVE>; }; crit@125000{ temperature = <125000>; /* milliCelsius hysteresis = <2000>; /* milliCelsius */ type = <THERMAL_TRIP_CRITICAL>; }; }; bind_params { action@0{ cooling_device = "thermal-cpufreq"; weight = <100>; /* percentage */ mask = <0x01>; /* no limits, using defaults */ }; }; };

In this current proposal, a 'thermal_zone' node would be embedded inside a temperature sensor node, for simplicity. But other possible builds could embedded them in the device with thermal limits (CPU nodes, for instance) or they could be not embedded in any specific node.

A full documented description can be found here [4]. Also a branch
containing: (a) needed changes in order to have this DT parser; (b) the DT parser with documentation (c) examples on how drivers could be changes to use the parser can be found in my branch here [5]. I wrote the thermal DT parser to build thermal zones with the thermal framework API. However, if one does not want to do that, it can simple do not include a CONFIG_THERMAL_OF=y in her/his build, and the calls will be translated to nops, and the device tree thermal data can be parsed to somewhere else interested (other subsystem or even user land). A TODO on this implementation is that it still lacks the representation of thermal zones composed by several sensors. However, I believe it is better to take an incremental approach here. This series can already be used to improve most of the existing platform thermal drivers (most are CPU thermal drivers) and to reuse the existing code of some hwmon sensors to build thermal zones for board thermal requirements.

I have already posted a patch series with this proposal on [6], that contains a reference for the original RFC. But looks like my messages got moderated on device tree mailing list. Obviously, within PM forum, feedback was quite positive. However, we cannot proceed without proper assessment of other subsystems. lm-sensors folks (Guenter) seam to be strongly against this series, as there is a fear that this may introduce a mis-usage of DT. I still believe this is needed for hardware description, and thus not a infringement on DT purposes.

Please let me know your thoughts on this topic and apologize me if my previous messages on this topic did not reach you (hope they reach now).

Quoted 10 lines

All best,

Eduardo Valentin

[0] - https://lkml.org/lkml/2013/7/17/621 [1] -
https://lkml.org/lkml/2013/7/18/279 [2] - www.devicetree.org [3] -
http://www.acpi.info/ [4] -
https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/diff/Documentation/devicetree/bindings/thermal/thermal.txt?h=thermal_work/thermal_core/dt_parser&id=405bf0b51457ed055a082af2653d7ce757bc2e91

[5] -

Quoted 3 lines

https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/log/?h=thermal_work/thermal_core/dt_parser

[6] - https://lkml.org/lkml/2013/7/17/923

Quoted 2 lines
#3 lore raw
Quoted 22 lines · Mark Rutland
Quoted 21 lines · Stephen Warren
Quoted 6 lines · Eduardo Valentin

Hello Grant and Rob,

(Resending, as I got a message saying:
<[email protected]>: Recipient address rejected:
User has moved to devicetree at vger.kernel.org)

Quoted 6 lines

I am writing this email to you specifically to ask your technical assessment with respect to representing device thermal limits as device tree nodes. I am proposing to introduce device tree nodes to describe these limits as thermal zones, their composition and their relations with cooling devices and other thermal zones (thermal data).

Given:
https://lkml.org/lkml/2013/7/20/69
[PATCH 3/3] MAINTAINERS: Refactor device tree maintainership

I'm explicitly CCing a few people besides Grant/Rob, and qouting the whole email.

Quoted 6 lines
Quoted 3 lines

From my perspective, the concept of including thermal limits in DT seems reasonable, although I haven't looked at the proposed binding itself in detail yet.

The concept of defining hard thermal limits in DT certianly seems reasonable.

Good.

Quoted 7 lines
Quoted 2 lines

From a quick look at the version on lkml [1], it seems like this leaks a

Linux implementation details (e.g. governer names) into the binding, and I think that the linkage of devices to thermal zones should be definedd more explicitly. A reposting of the series to devicetree (and lakml?) would be helpful for review.

On governor names, here are different approaches:
(a) - name the property 'policy' and let OS decide to interpret it.
(b) - remove this property and let OS decide what to do with thermal zones by default.

On the linkage, there are essentially two other approaches, as I mentioned below in the original RFC. First would be to have the thermal_zone binding inside the node of the device requiring thermal limits, this way the linkage would be more obvious, I think. Other approach would be to link them by having a property on the sensor node to the monitored device node, as suggested in other email.

Quoted 134 lines

Thanks,
Mark.

[1] https://lkml.org/lkml/2013/7/17/379

Quoted 127 lines
Quoted 108 lines

As you should know, device thermal limits are part of hardware specification. Considering your board layout, mechanics, power dissipation and composition of ICs, etc, that will impose thermal requirements on your system, and infringing these limits can lead to device damage, device life time reduction or even end user harm. Thus, the thermal data help to describe the hardware limits and what needs to be done if those limits are crosses, as part of your board design and non-functional requirements. Obviously that is very dependent on your hardware, and not all of them will have these non-functional requirements. Besides, describing these limits has *nothing* to do with how you actually find these limits.

In any case, there is a need to properly represent these requirements and I am proposing to have this representation in device tree. There were already couple of counter-arguments claiming this is actually about configuration and performance profile description. But I still stand against these two readings of this proposal and again state that if one interprets it as configuration or performance profile, that is a mis-understanding [0]. Let me state it clear (again [1]), my proposal is to describe hardware thermal limits, because these limits are part of a hardware specification; representing in device tree would not infringe the original purpose of this data structure ("The Device Tree is a data structure for describing hardware."[2]).

Before I explain my proposal, I want to highlight also that these data is represented elsewhere already and it is reused across different OS's. Thermal data is described using ACPI [3] and operating systems ACPI-aware do support the interpretation of thermal data. Linux is one example of such systems (I believe I do not need to enlist here all systems supporting ACPI). On the other hand, not all systems have ACPI or are specified to use ACPI. Thus, here is another reason to represent properly thermal data, so that we can scale across systems.

In the specific case of Linux, the common thermal concepts between ACPI systems and non-ACPI systems have been represented in the thermal framework (CONFIG_THERMAL). Today, on ACPI systems, thermal data is fetched from bootloader with help from the common ACPI parser. For non-ACPI systems, the thermal data is actually coded as part of device drivers.

So, to the point, a brief explanation of my proposal goes as
follows: i - trip points: a node to describe a point in the
temperature domain in which the system has to take an action. This node describes just the point, not the action. Properties here are temperature, hysteresis, and type (critical, hot, passive, active, etc). ii - binding parameters: the bind_param node is a node to describe how actions (cooling devices) get assigned to trip points. Cooling devices are expected to be loaded in the target system. Properties here are: cooling device name, weight, trip_mask and limits. iii - thermal zones: the thermal_zone node is the node containing all the required info for describing a thermal zone with hardware thermal limitation, including its bindings with cooling devices. Properties here are: type, passive_delay, polling_delay, governor. The thermal_zone node must contain, apart from its own properties, one node containing trip nodes and one node containing all the zone bind parameters.

Here is an example (on OMAP4430): thermal_zone { type = "CPU"; mask = <0x03>; /* trips writability */ passive_delay = <250>; /* milliseconds */ polling_delay = <1000>; /* milliseconds */ governor = "step_wise"; trips { alert@100000{ temperature = <100000>; /* milliCelsius hysteresis = <2000>; /* milliCelsius */ type = <THERMAL_TRIP_PASSIVE>; }; crit@125000{ temperature = <125000>; /* milliCelsius hysteresis = <2000>; /* milliCelsius */ type = <THERMAL_TRIP_CRITICAL>; }; }; bind_params { action@0{ cooling_device = "thermal-cpufreq"; weight = <100>; /* percentage */ mask = <0x01>; /* no limits, using defaults */ }; }; };

In this current proposal, a 'thermal_zone' node would be embedded inside a temperature sensor node, for simplicity. But other possible builds could embedded them in the device with thermal limits (CPU nodes, for instance) or they could be not embedded in any specific node.

A full documented description can be found here [4]. Also a branch
containing: (a) needed changes in order to have this DT parser; (b) the DT parser with documentation (c) examples on how drivers could be changes to use the parser can be found in my branch here [5]. I wrote the thermal DT parser to build thermal zones with the thermal framework API. However, if one does not want to do that, it can simple do not include a CONFIG_THERMAL_OF=y in her/his build, and the calls will be translated to nops, and the device tree thermal data can be parsed to somewhere else interested (other subsystem or even user land). A TODO on this implementation is that it still lacks the representation of thermal zones composed by several sensors. However, I believe it is better to take an incremental approach here. This series can already be used to improve most of the existing platform thermal drivers (most are CPU thermal drivers) and to reuse the existing code of some hwmon sensors to build thermal zones for board thermal requirements.

I have already posted a patch series with this proposal on [6], that contains a reference for the original RFC. But looks like my messages got moderated on device tree mailing list. Obviously, within PM forum, feedback was quite positive. However, we cannot proceed without proper assessment of other subsystems. lm-sensors folks (Guenter) seam to be strongly against this series, as there is a fear that this may introduce a mis-usage of DT. I still believe this is needed for hardware description, and thus not a infringement on DT purposes.

Please let me know your thoughts on this topic and apologize me if my previous messages on this topic did not reach you (hope they reach now).

Quoted 10 lines

All best,

Eduardo Valentin

[0] - https://lkml.org/lkml/2013/7/17/621 [1] -
https://lkml.org/lkml/2013/7/18/279 [2] - www.devicetree.org [3] -
http://www.acpi.info/ [4] -
https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/diff/Documentation/devicetree/bindings/thermal/thermal.txt?h=thermal_work/thermal_core/dt_parser&id=405bf0b51457ed055a082af2653d7ce757bc2e91

[5] -

Quoted 3 lines

https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/log/?h=thermal_work/thermal_core/dt_parser

[6] - https://lkml.org/lkml/2013/7/17/923

Quoted 2 lines
Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin
#4 lore raw
In reply to Stephen Warren

Greeting,

Funnily enough I had this discussion couple a months ago and made my mind back then :-)

Quoted 4 lines · Eduardo Valentin
Quoted 3 lines

representing in device tree would not
infringe the original purpose of this data structure ("The Device Tree is a data structure for describing hardware."[2]).

I couldn't agree more, with a few remarks...

Quoted 5 lines
Quoted 5 lines

In this current proposal, a 'thermal_zone' node would be embedded inside a temperature sensor node, for simplicity. But other possible builds could embedded them in the device with thermal limits (CPU nodes, for instance) or they could be not embedded in any specific node.

So this is the detail that actually caused most of the disagreement :-)

My position on this can be summarized as follows:

1. As you have pointed out, the thermal limits are related to the *device being monitored*, not the sensor itself.

2. Therefore the tree should express relation between those two; a sensor mode should be connected (via phandle most likely) to the device being monitored, eg. (I'm not suggesting any property names, just trying to express the idea ;-) memory mapped PVT "sensor" monitoring a core (cpu) temperature could look like this:

	cpu0: cpu@0 {
	};

	sensor@xxxx {
		reg = <xxx>;
		device_monitored = <&cpu0>;
	};

while I2C or 1Wire sensor measuring temperature of the board (or even inside the device enclosure) would point at the root of the tree.

3. Basing on the above, the thermal limits of the device could be described in the tree (again, don't pay attention to naming):

	cpu0: cpu@0 {
		thermal_limits {
			cooling {
			};
			critical {
			};
		};
	};

or "hardcoded" in the device driver. After all, as you have pointed out, the limits are the device's characteristic, so I see no problem with the "SOC driver" registering the trip points on its own. I'm sure there will be situations when it's better to parametrize such data via Device Tree, so it makes perfect sense to have bindings defined for such occasion. Anyway, as long as the tree describes the relation between the monitored device, the sensor and the cooling device all should work.

Now, my personal opinion is that the tree should focus at "system level" data (ie. how is the device connected to others) and describe as little information that can be probed in runtime - a small (small!) array of silicon variants in the driver doesn't hurt (unless we're talking about hundreds of possibilities, where the device tree is obviously the place to have them). But this is just a rule of thumb I'm following.

Cheers!

Pawel

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#5 lore raw

Pawel,

Quoted 5 lines · Pawel Moll

Greeting,

Funnily enough I had this discussion couple a months ago and made my mind back then :-)

:-)

Quoted 7 lines
Quoted 4 lines · Eduardo Valentin
Quoted 3 lines

representing in device tree would not
infringe the original purpose of this data structure ("The Device Tree is a data structure for describing hardware."[2]).

I couldn't agree more, with a few remarks...

Nice.

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

In this current proposal, a 'thermal_zone' node would be embedded inside a temperature sensor node, for simplicity. But other possible builds could embedded them in the device with thermal limits (CPU nodes, for instance) or they could be not embedded in any specific node.

Quoted 7 lines

So this is the detail that actually caused most of the disagreement :-)

My position on this can be summarized as follows:

1. As you have pointed out, the thermal limits are related to the *device being monitored*, not the sensor itself.

Yeah, thinking of it now, this original proposal, it lacks a stronger relationship mapping between monitored and monitoring devices. But it does have it..

Quoted 2 lines

2. Therefore the tree should express relation between those two; a sensor mode should be connected (via phandle most likely) to the device

.. this is done, more or less, by means of the 'type' property (see original RFC binding).

Quoted 10 lines

being monitored, eg. (I'm not suggesting any property names, just trying to express the idea ;-) memory mapped PVT "sensor" monitoring a core (cpu) temperature could look like this:

	cpu0: cpu@0 {
	};

	sensor@xxxx {
		reg = <xxx>;
		device_monitored = <&cpu0>;
	};

To, this is not a sensor property. It could be a property in the thermal_zone node itself.

Quoted 13 lines

while I2C or 1Wire sensor measuring temperature of the board (or even inside the device enclosure) would point at the root of the tree.

3. Basing on the above, the thermal limits of the device could be described in the tree (again, don't pay attention to naming):

	cpu0: cpu@0 {
		thermal_limits {
			cooling {
			};
			critical {
			};
		};
	};
Quoted 1 line

or "hardcoded" in the device driver. After all, as you have pointed out,

For example:

cpu0: cpu@0 {
	/* ... cpu needed bindings  */

	thermal_zone {
		type = "CPU";

		monitoring_device = <&sensor@xxxx
				    &sensor@yyyy>;

		mask = <0x03>; /* trips writability */
		passive_delay = <250>; /* milliseconds */
		polling_delay = <1000>; /* milliseconds */
		policy = "step_wise";
		trips {
			alert@100000{
				temperature = <100000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_PASSIVE>;
			};
			crit@125000{
				temperature = <125000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_CRITICAL>;
			};
		};
		bind_params {
			action@0{
				cooling_device = "thermal-cpufreq";
				weight = <100>; /* percentage */
				mask = <0x01>;
				/* no limits, using defaults */
			};
		};
	};
};

/* .. other binding .. */

sensor@xxxx {
	reg = <xxx>;
	compatible = <xxx>;
};
sensor@yyyy {
	reg = <yyyy>;
	compatible = <yyyy>;
};

The above way, I think it is less intrusive to sensor bindings. Besides, it gives the flexibility to have more that one sensor monitoring a thermal zone. In Linux we don't have this support, but in practice, we do have this requirement. Durgadoss has proposed an improvement of the thermal framework as a RFC. So, the support to have several sensors per zone will come.

Another way, as I mentioned in the original RFC, an option would be to have the thermal_zone node not embedded in any device node. But them, we would need to firmly link it to other device nodes, to describe what is monitored and what is used for monitoring. Something like:

thermal_zone {
	type = "CPU";
	monitored_device = <&cpu0>;
	monitoring_device = <&sensor@xxxx
			    &sensor@yyyy>;
	mask = <0x03>; /* trips writability */
	passive_delay = <250>; /* milliseconds */
	polling_delay = <1000>; /* milliseconds */
	policy = "step_wise";
	trips {
		alert@100000{
			temperature = <100000>; /* milliCelsius
			hysteresis = <2000>; /* milliCelsius */
			type = <THERMAL_TRIP_PASSIVE>;
		};
		crit@125000{
			temperature = <125000>; /* milliCelsius
			hysteresis = <2000>; /* milliCelsius */
			type = <THERMAL_TRIP_CRITICAL>;
		};
	};
	bind_params {
		action@0{
			cooling_device = "thermal-cpufreq";
			weight = <100>; /* percentage */
			mask = <0x01>;
			/* no limits, using defaults */
		};
	};
};

With the above I believe we could have dts(i) files describing only thermal, for instance.

Quoted 21 lines

the limits are the device's characteristic, so I see no problem with the "SOC driver" registering the trip points on its own. I'm sure there will be situations when it's better to parametrize such data via Device Tree, so it makes perfect sense to have bindings defined for such occasion. Anyway, as long as the tree describes the relation between the monitored device, the sensor and the cooling device all should work.

Now, my personal opinion is that the tree should focus at "system level" data (ie. how is the device connected to others) and describe as little information that can be probed in runtime - a small (small!) array of silicon variants in the driver doesn't hurt (unless we're talking about hundreds of possibilities, where the device tree is obviously the place to have them). But this is just a rule of thumb I'm following.

Cheers!

Pawel

Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#6 lore raw
Quoted 7 lines · Eduardo Valentin
Quoted 3 lines

1. As you have pointed out, the thermal limits are related to the *device being monitored*, not the sensor itself.

Yeah, thinking of it now, this original proposal, it lacks a stronger relationship mapping between monitored and monitoring devices. But it does have it..

Quoted 5 lines
Quoted 2 lines

2. Therefore the tree should express relation between those two; a sensor mode should be connected (via phandle most likely) to the device

.. this is done, more or less, by means of the 'type' property (see original RFC binding).

I'm not sure what do you mean (regarding "type"), but I think I got what I wanted with the "monitoring_device" phandles (shouldn't it be "_device*s*" then? ;-).

Quoted 6 lines

For example:

cpu0: cpu@0 {
	/* ... cpu needed bindings  */

	thermal_zone {
		type = "CPU";

So what does this exactly mean? What is so special about CPU? What other types you've got there? (Am I just lazy not looking at the numerous links you provided? ;-)

Quoted 7 lines
		monitoring_device = <&sensor@xxxx
				    &sensor@yyyy>;

		mask = <0x03>; /* trips writability */
		passive_delay = <250>; /* milliseconds */
		polling_delay = <1000>; /* milliseconds */
		policy = "step_wise";

The word "policy" doesn't sound to me like a "hardware feature", wouldn't you agree?

Quoted 7 lines
		trips {
			alert@100000{
				temperature = <100000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_PASSIVE>;
			};
			crit@125000{
Quoted 8 lines
				temperature = <125000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_CRITICAL>;
			};
		};
		bind_params {
			action@0{
				cooling_device = "thermal-cpufreq";

Why is it a string? It seems very Linux-y... (cpufreq) Is there any particular reason not to have phandles to the fans that have any impact on the zone?

Quoted 1 line
				weight = <100>; /* percentage */

Does this mean: how "successful" will be the particular fan?

Quoted 4 lines

Another way, as I mentioned in the original RFC, an option would be to have the thermal_zone node not embedded in any device node. But them, we would need to firmly link it to other device nodes, to describe what is monitored and what is used for monitoring.

You mean the zone nodes would live at the top level of the tree? To my mind the root represents the device (the board, whatever you call it), which, I guess, may be what you want, if the zone "covers" the whole device? (as in: one fan and one sensor somewhere in the box and the only thing you may do is to check the ambient temperature and start the fan if it's to high)

Quoted 2 lines

With the above I believe we could have dts(i) files describing only thermal, for instance.

You can include a dtsi inside the device node, no problem with that:

/dts-v1/;

/ {     
        smb {                   
                compatible = "simple-bus";

                /include/ "vexpress-v2m-rs1.dtsi"
        };      
};     

Pawel

#7 lore raw
Quoted 7 lines · Pawel Moll
Quoted 4 lines

Another way, as I mentioned in the original RFC, an option would be to have the thermal_zone node not embedded in any device node. But them, we would need to firmly link it to other device nodes, to describe what is monitored and what is used for monitoring.

You mean the zone nodes would live at the top level of the tree? To my mind the root represents the device (the board, whatever you call it),

What I wanted to say was: ... so the zone would still be embedded in a device node :-)

Pawel

#8 lore raw
Quoted 6 lines · Pawel Moll
Quoted 5 lines · Pawel Moll
Quoted 4 lines

Another way, as I mentioned in the original RFC, an option would be to have the thermal_zone node not embedded in any device node. But them, we would need to firmly link it to other device nodes, to describe what is monitored and what is used for monitoring.

Quoted 6 lines
Quoted 2 lines

You mean the zone nodes would live at the top level of the tree? To my mind the root represents the device (the board, whatever you call it),

What I wanted to say was: ... so the zone would still be embedded in a device node :-)

ahh ok.. I see.

Quoted 5 lines

Pawel

Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#9 lore raw
In reply to Pawel Moll
Quoted 11 lines · Pawel Moll
Quoted 10 lines · Eduardo Valentin
Quoted 3 lines

1. As you have pointed out, the thermal limits are related to the *device being monitored*, not the sensor itself.

Yeah, thinking of it now, this original proposal, it lacks a stronger relationship mapping between monitored and monitoring devices. But it does have it..

Quoted 2 lines

2. Therefore the tree should express relation between those two; a sensor mode should be connected (via phandle most likely) to the device

Quoted 6 lines
Quoted 2 lines

.. this is done, more or less, by means of the 'type' property (see original RFC binding).

I'm not sure what do you mean (regarding "type"), but I think I got what I wanted with the "monitoring_device" phandles (shouldn't it be "_device*s*" then? ;-).

yes. it is supposed to be devices.

Quoted 11 lines
Quoted 7 lines

For example:

cpu0: cpu@0 {
	/* ... cpu needed bindings  */

	thermal_zone {
		type = "CPU";

So what does this exactly mean? What is so special about CPU? What other types you've got there? (Am I just lazy not looking at the numerous links you provided? ;-)

Hehehe. OK. Type is supposed to describe what your zone is representing.

Quoted 11 lines
Quoted 8 lines
		monitoring_device = <&sensor@xxxx
				    &sensor@yyyy>;

		mask = <0x03>; /* trips writability */
		passive_delay = <250>; /* milliseconds */
		polling_delay = <1000>; /* milliseconds */
		policy = "step_wise";

The word "policy" doesn't sound to me like a "hardware feature", wouldn't you agree?

Agreed. As I mentioned in other email, we can leave this to OS decide what to use, by default, for instance.

Quoted 17 lines
Quoted 16 lines
		trips {
			alert@100000{
				temperature = <100000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_PASSIVE>;
			};
			crit@125000{
				temperature = <125000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_CRITICAL>;
			};
		};
		bind_params {
			action@0{
				cooling_device = "thermal-cpufreq";
Quoted 4 lines

Why is it a string? It seems very Linux-y... (cpufreq) Is there any particular reason not to have phandles to the fans that have any impact on the zone?

Because fans are not the only way to cool your system, specially those systems that don't feature fans. Managing the speed of your CPU is one example of lowering temperature without fans. Managing the load on your system is another way. These are obviously, virtual concepts. And because we have physical ways and logical ways to cool the zone, then I didnt put a phandle to a device there.

Quoted 9 lines
Quoted 1 line
				weight = <100>; /* percentage */

Does this mean: how "successful" will be the particular fan?

Quoted 4 lines

Another way, as I mentioned in the original RFC, an option would be to have the thermal_zone node not embedded in any device node. But them, we would need to firmly link it to other device nodes, to describe what is monitored and what is used for monitoring.

Quoted 6 lines

You mean the zone nodes would live at the top level of the tree? To my mind the root represents the device (the board, whatever you call it), which, I guess, may be what you want, if the zone "covers" the whole device? (as in: one fan and one sensor somewhere in the box and the only thing you may do is to check the ambient temperature and start the fan if it's to high)

Yes, for cases that we want to map zones at board level, they could be not embedded to a specific device node.

Quoted 8 lines
Quoted 3 lines

With the above I believe we could have dts(i) files describing only thermal, for instance.

You can include a dtsi inside the device node, no problem with that:

/dts-v1/;

Quoted 7 lines
/ {     
        smb {                   
                compatible = "simple-bus";

                /include/ "vexpress-v2m-rs1.dtsi"
        };      
};     

OK. got your point. What I was trying to highlight is that we could have zones not inside device nodes, then we could write them in a thermal dtsi. And in that case, you probably dont want to include the complete file inside a device node.

Quoted 6 lines

Pawel

Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#10 lore raw
Quoted 8 lines · Eduardo Valentin
Quoted 6 lines
Quoted 2 lines
	thermal_zone {
		type = "CPU";

So what does this exactly mean? What is so special about CPU? What other types you've got there? (Am I just lazy not looking at the numerous links you provided? ;-)

Hehehe. OK. Type is supposed to describe what your zone is representing.

As in "a name"? So, for example "The board", "PSU"? What I meant to ask
was: does the string carry any meaning?

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
		monitoring_device = <&sensor@xxxx
				    &sensor@yyyy>;

		mask = <0x03>; /* trips writability */
		passive_delay = <250>; /* milliseconds */
		polling_delay = <1000>; /* milliseconds */
		policy = "step_wise";
Quoted 5 lines
Quoted 2 lines

The word "policy" doesn't sound to me like a "hardware feature", wouldn't you agree?

Agreed. As I mentioned in other email, we can leave this to OS decide what to use, by default, for instance.

Cool, I believe it is the right thing to do.

Quoted 21 lines
Quoted 17 lines
Quoted 16 lines
		trips {
			alert@100000{
				temperature = <100000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_PASSIVE>;
			};
			crit@125000{
				temperature = <125000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_CRITICAL>;
			};
		};
		bind_params {
			action@0{
				cooling_device = "thermal-cpufreq";
Quoted 3 lines

Why is it a string? It seems very Linux-y... (cpufreq) Is there any particular reason not to have phandles to the fans that have any impact on the zone?

Quoted 6 lines

Because fans are not the only way to cool your system, specially those systems that don't feature fans. Managing the speed of your CPU is one example of lowering temperature without fans. Managing the load on your system is another way. These are obviously, virtual concepts. And because we have physical ways and logical ways to cool the zone, then I didnt put a phandle to a device there.

"virtual concepts"... This is where my problem lies... It's not hardware so it doesn't seem to belong in the tree at the first sight. Shouldn't it focus on "physical data" instead? As in: point at devices that have some impact on the conditions? For example, you can say "please, do the right thing to cool your environment down" to both CPU and fan, can't you? The "cooling driver" for the CPU would know that it has to slow down, while a driver for the fan would know that it has to speed up ;-)

What I'm trying to say is that in my opinion the tree should simply link the object, the sensor and the actuator. Nothing more, nothing less.

Thanks for your time!

Pawel

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#11 lore raw
Quoted 57 lines · Pawel Moll
Quoted 8 lines · Eduardo Valentin
Quoted 6 lines
Quoted 2 lines
	thermal_zone {
		type = "CPU";

So what does this exactly mean? What is so special about CPU? What other types you've got there? (Am I just lazy not looking at the numerous links you provided? ;-)

Hehehe. OK. Type is supposed to describe what your zone is representing.

As in "a name"? So, for example "The board", "PSU"? What I meant to ask
was: does the string carry any meaning?

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
		monitoring_device = <&sensor@xxxx
				    &sensor@yyyy>;

		mask = <0x03>; /* trips writability */
		passive_delay = <250>; /* milliseconds */
		polling_delay = <1000>; /* milliseconds */
		policy = "step_wise";
Quoted 5 lines
Quoted 2 lines

The word "policy" doesn't sound to me like a "hardware feature", wouldn't you agree?

Agreed. As I mentioned in other email, we can leave this to OS decide what to use, by default, for instance.

Cool, I believe it is the right thing to do.

Quoted 21 lines
Quoted 17 lines
Quoted 16 lines
		trips {
			alert@100000{
				temperature = <100000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_PASSIVE>;
			};
			crit@125000{
				temperature = <125000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_CRITICAL>;
			};
		};
		bind_params {
			action@0{
				cooling_device = "thermal-cpufreq";
Quoted 3 lines

Why is it a string? It seems very Linux-y... (cpufreq) Is there any particular reason not to have phandles to the fans that have any impact on the zone?

Quoted 6 lines

Because fans are not the only way to cool your system, specially those systems that don't feature fans. Managing the speed of your CPU is one example of lowering temperature without fans. Managing the load on your system is another way. These are obviously, virtual concepts. And because we have physical ways and logical ways to cool the zone, then I didnt put a phandle to a device there.

Quoted 2 lines

"virtual concepts"... This is where my problem lies... It's not hardware so it doesn't seem to belong in the tree at the first sight. Shouldn't

Yeah, in fact, this is exactly the point that creates most of the disagreement. You may check Guenter's arguments against this proposal (in my original RFC email, there is a link to it).

Well, if one don't want to see this as a 'virtual concept' it could say the cooling device is the cpu itself:

		cooling_device = <&cpu0>;
Quoted 8 lines

it focus on "physical data" instead? As in: point at devices that have some impact on the conditions? For example, you can say "please, do the right thing to cool your environment down" to both CPU and fan, can't you? The "cooling driver" for the CPU would know that it has to slow down, while a driver for the fan would know that it has to speed up ;-)

What I'm trying to say is that in my opinion the tree should simply link the object, the sensor and the actuator. Nothing more, nothing less.

OK. I think it would be a little unfair to have only links, without describing what this link is supposed to be or how it is supposed to be used. In previous discussions, I have mentioned two similar examples already existing in DT. Here are they: regulator bindings, one does not describe only which device connects to which regulator, but also needs to describe, voltage limits, current limits, offsets, and other properties. And an existing 'virtual concept' would be predefined CPU OPPs, that feed the opp layer. Those are configurations of the hardware that define a 'virtual' concept of operating point.

So, saying we need to describe only physical connections or touchable things would be a little unfair, IMO. Besides, thermal is still physical :-).

Quoted 2 lines

Thanks for your time!

Thanks for the input!

Quoted 6 lines

Pawel

Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#12 lore raw

Apologies about the delay, I was "otherwise engaged" for a week...

I hope you haven't lost all motivation to work on this subject, as it's really worth the while!

Quoted 5 lines · Eduardo Valentin
Quoted 4 lines · Pawel Moll
Quoted 3 lines · Eduardo Valentin
Quoted 3 lines
Quoted 2 lines
	thermal_zone {
		type = "CPU";
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

So what does this exactly mean? What is so special about CPU? What other types you've got there? (Am I just lazy not looking at the numerous links you provided? ;-)

Hehehe. OK. Type is supposed to describe what your zone is representing.

As in "a name"? So, for example "The board", "PSU"? What I meant to ask
was: does the string carry any meaning?

You haven't commended on this...

Quoted 30 lines
Quoted 27 lines
Quoted 20 lines
Quoted 16 lines
Quoted 7 lines
		trips {
			alert@100000{
				temperature = <100000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_PASSIVE>;
			};
			crit@125000{
Quoted 8 lines
				temperature = <125000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_CRITICAL>;
			};
		};
		bind_params {
			action@0{
				cooling_device = "thermal-cpufreq";
Quoted 3 lines

Why is it a string? It seems very Linux-y... (cpufreq) Is there any particular reason not to have phandles to the fans that have any impact on the zone?

Quoted 6 lines

Because fans are not the only way to cool your system, specially those systems that don't feature fans. Managing the speed of your CPU is one example of lowering temperature without fans. Managing the load on your system is another way. These are obviously, virtual concepts. And because we have physical ways and logical ways to cool the zone, then I didnt put a phandle to a device there.

Quoted 2 lines

"virtual concepts"... This is where my problem lies... It's not hardware so it doesn't seem to belong in the tree at the first sight. Shouldn't

Quoted 7 lines

Yeah, in fact, this is exactly the point that creates most of the disagreement. You may check Guenter's arguments against this proposal (in my original RFC email, there is a link to it).

Well, if one don't want to see this as a 'virtual concept' it could say the cooling device is the cpu itself:

		cooling_device = <&cpu0>;

Would this create any particular problem at the driver/framework side?

Quoted 19 lines
Quoted 8 lines

it focus on "physical data" instead? As in: point at devices that have some impact on the conditions? For example, you can say "please, do the right thing to cool your environment down" to both CPU and fan, can't you? The "cooling driver" for the CPU would know that it has to slow down, while a driver for the fan would know that it has to speed up ;-)

What I'm trying to say is that in my opinion the tree should simply link the object, the sensor and the actuator. Nothing more, nothing less.

OK. I think it would be a little unfair to have only links, without describing what this link is supposed to be or how it is supposed to be used. In previous discussions, I have mentioned two similar examples already existing in DT. Here are they: regulator bindings, one does not describe only which device connects to which regulator, but also needs to describe, voltage limits, current limits, offsets, and other properties. And an existing 'virtual concept' would be predefined CPU OPPs, that feed the opp layer. Those are configurations of the hardware that define a 'virtual' concept of operating point.

Quoted 3 lines

So, saying we need to describe only physical connections or touchable things would be a little unfair, IMO. Besides, thermal is still physical :-).

Believe me, I'm trying to be as fair as possible :-) and I see a lot of value in describing the thermal properties of the platforms in the tree. It's just that we really want to focus on describing the hardware, not policies. And as you have already spent so much time on the matter, you are in the best position to find the best set of *physical* properties that would allow to make the right decision in the code. Could you, please, try to make one step back and have another look at the problem? What input data (as in: numbers :-) would you need to get what you want? Are those numbers characteristic to the specific device (they probably should live in the driver than) or to the board/platform (tree without a doubt).

Thanks!

Pawel

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#13 lore raw

Pawel, all,

Quoted 2 lines · Pawel Moll

Apologies about the delay, I was "otherwise engaged" for a week...

I do also excuse for my delay, as I was also "engaged" for a week or so.

Quoted 2 lines

I hope you haven't lost all motivation to work on this subject, as it's really worth the while!

Not really! quite the opposite. Although I was looking at some other stuff, I got this series also tested on different boards and wrote down a couple of improvements I will be working in the coming days. Indeed, it is worth moving forward with this work.

Quoted 11 lines · Eduardo Valentin
Quoted 9 lines · Pawel Moll
Quoted 8 lines · Eduardo Valentin
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
	thermal_zone {
		type = "CPU";

So what does this exactly mean? What is so special about CPU? What other types you've got there? (Am I just lazy not looking at the numerous links you provided? ;-)

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

Hehehe. OK. Type is supposed to describe what your zone is representing.

As in "a name"? So, for example "The board", "PSU"? What I meant to ask
was: does the string carry any meaning?

You haven't commended on this...

The string is supposed to carry meaning, yes. Couple of common used:
CPU, GPU, PCB, LCD

Quoted 35 lines
Quoted 35 lines
Quoted 28 lines
Quoted 21 lines
Quoted 17 lines
Quoted 16 lines
		trips {
			alert@100000{
				temperature = <100000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_PASSIVE>;
			};
			crit@125000{
				temperature = <125000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_CRITICAL>;
			};
		};
		bind_params {
			action@0{
				cooling_device = "thermal-cpufreq";
Quoted 3 lines

Why is it a string? It seems very Linux-y... (cpufreq) Is there any particular reason not to have phandles to the fans that have any impact on the zone?

Quoted 6 lines

Because fans are not the only way to cool your system, specially those systems that don't feature fans. Managing the speed of your CPU is one example of lowering temperature without fans. Managing the load on your system is another way. These are obviously, virtual concepts. And because we have physical ways and logical ways to cool the zone, then I didnt put a phandle to a device there.

Quoted 2 lines

"virtual concepts"... This is where my problem lies... It's not hardware so it doesn't seem to belong in the tree at the first sight. Shouldn't

Yeah, in fact, this is exactly the point that creates most of the disagreement. You may check Guenter's arguments against this proposal (in my original RFC email, there is a link to it).

Quoted 5 lines
Quoted 3 lines

Well, if one don't want to see this as a 'virtual concept' it could say the cooling device is the cpu itself:

		cooling_device = <&cpu0>;

Would this create any particular problem at the driver/framework side?

In this case, I believe CPUfreq driver must be thermal aware in this case. And we need to cook a way to, whenever there is such link, the cpufreq driver instantiates the cooling mechanism. But I need to think a little bit more on this, will come back on this point soon.

Quoted 24 lines
Quoted 20 lines
Quoted 9 lines

it focus on "physical data" instead? As in: point at devices that have some impact on the conditions? For example, you can say "please, do the right thing to cool your environment down" to both CPU and fan, can't you? The "cooling driver" for the CPU would know that it has to slow down, while a driver for the fan would know that it has to speed up ;-)

What I'm trying to say is that in my opinion the tree should simply link the object, the sensor and the actuator. Nothing more, nothing less.

OK. I think it would be a little unfair to have only links, without describing what this link is supposed to be or how it is supposed to be used. In previous discussions, I have mentioned two similar examples already existing in DT. Here are they: regulator bindings, one does not describe only which device connects to which regulator, but also needs to describe, voltage limits, current limits, offsets, and other properties. And an existing 'virtual concept' would be predefined CPU OPPs, that feed the opp layer. Those are configurations of the hardware that define a 'virtual' concept of operating point.

Quoted 3 lines

So, saying we need to describe only physical connections or touchable things would be a little unfair, IMO. Besides, thermal is still physical :-).

Quoted 11 lines

Believe me, I'm trying to be as fair as possible :-) and I see a lot of value in describing the thermal properties of the platforms in the tree. It's just that we really want to focus on describing the hardware, not policies. And as you have already spent so much time on the matter, you are in the best position to find the best set of *physical* properties that would allow to make the right decision in the code. Could you, please, try to make one step back and have another look at the problem? What input data (as in: numbers :-) would you need to get what you want? Are those numbers characteristic to the specific device (they probably should live in the driver than) or to the board/platform (tree without a doubt).

Ok. My point was just that linking objects without telling when (in temperature domain) to start using this link, may be incomplete, because trip points are really HW dependent, because your power dissipation profile changes from HW design to HW design. In other words, one can say, "use device fan to cool the GPU", but depending on your GPU, you may start using your fan when the sensor is 100C, 85C, 110C (just picking numbers), it is really HW dependent. Besides, the same IP may be used immersed in different ambient condition, which may cause variance on its leakage level, and thus changes its thermal dissipation profile, resulting in different trip points. Thus, mapping all this HW characteristics inside specific drivers does not sound the right path to me. That is why I believe pointing which trips to use is part of HW description.

I must agree that, saying which governor to use, then again, is pure policy definition though.

I will go through our discussion, consider the points risen and repost the series as soon as possible. I will not let this one fall into the cracks, no worries.

Thanks for your inputs, BTW.

Quoted 8 lines

Thanks!

Pawel

Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#14 lore raw
Quoted 29 lines · Eduardo Valentin

Pawel, all,

Quoted 2 lines · Pawel Moll

Apologies about the delay, I was "otherwise engaged" for a week...

I do also excuse for my delay, as I was also "engaged" for a week or so.

Quoted 2 lines

I hope you haven't lost all motivation to work on this subject, as it's really worth the while!

Not really! quite the opposite. Although I was looking at some other stuff, I got this series also tested on different boards and wrote down a couple of improvements I will be working in the coming days. Indeed, it is worth moving forward with this work.

Quoted 13 lines · Eduardo Valentin
Quoted 11 lines · Pawel Moll
Quoted 10 lines · Eduardo Valentin
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
	thermal_zone {
		type = "CPU";

So what does this exactly mean? What is so special about CPU? What other types you've got there? (Am I just lazy not looking at the numerous links you provided? ;-)

Hehehe. OK. Type is supposed to describe what your zone is representing.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

As in "a name"? So, for example "The board", "PSU"? What I meant to ask
was: does the string carry any meaning?

You haven't commended on this...

The string is supposed to carry meaning, yes. Couple of common used:
CPU, GPU, PCB, LCD

I think the point Pawel was getting at is that the string doesn't have a *well-defined* meaning that always allows an OS to figure out the set of relevant devices. If we have a thermal zone for "LCD", and have multiple LCDs, which LCDs are covered? If we have a "PCB" zone, does this cover all the devices attached to the PCB, a subset thereof, or the substrate of the PCB itself?

A phandle list to the concerned devices for example would *always* allow the OS to figure out the set of concerned devices.

Quoted 40 lines
Quoted 40 lines
Quoted 39 lines
Quoted 29 lines
Quoted 22 lines
Quoted 18 lines
Quoted 17 lines

		trips {
			alert@100000{
				temperature = <100000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_PASSIVE>;
			};
			crit@125000{
				temperature = <125000>; /* milliCelsius
				hysteresis = <2000>; /* milliCelsius */
				type = <THERMAL_TRIP_CRITICAL>;
			};
		};
		bind_params {
			action@0{
				cooling_device = "thermal-cpufreq";
Quoted 3 lines

Why is it a string? It seems very Linux-y... (cpufreq) Is there any particular reason not to have phandles to the fans that have any impact on the zone?

Quoted 6 lines

Because fans are not the only way to cool your system, specially those systems that don't feature fans. Managing the speed of your CPU is one example of lowering temperature without fans. Managing the load on your system is another way. These are obviously, virtual concepts. And because we have physical ways and logical ways to cool the zone, then I didnt put a phandle to a device there.

Quoted 2 lines

"virtual concepts"... This is where my problem lies... It's not hardware so it doesn't seem to belong in the tree at the first sight. Shouldn't

Yeah, in fact, this is exactly the point that creates most of the disagreement. You may check Guenter's arguments against this proposal (in my original RFC email, there is a link to it).

Well, if one don't want to see this as a 'virtual concept' it could say the cooling device is the cpu itself:

		cooling_device = <&cpu0>;
Quoted 6 lines
Quoted 1 line

Would this create any particular problem at the driver/framework side?

In this case, I believe CPUfreq driver must be thermal aware in this case. And we need to cook a way to, whenever there is such link, the cpufreq driver instantiates the cooling mechanism. But I need to think a little bit more on this, will come back on this point soon.

For the CPU case at least, if we have a thermal zone with an attached sensor and no real thermal device, I don't think it's too much of a stretch for the OS to figure out that the only thing it can do is some cpufreq-like scaling and limiting to attempt to keep below the limits.

I don't think we need to describe the cpu as a cooling device for a cpu, and I certainly don't think we need to describe a particular mechanism by which the thermal limits should be maintained (though when we have a fan, or other active cooling device, describing to the OS that this may be used is sensible).

Quoted 37 lines
Quoted 25 lines
Quoted 21 lines
Quoted 10 lines

it focus on "physical data" instead? As in: point at devices that have some impact on the conditions? For example, you can say "please, do the right thing to cool your environment down" to both CPU and fan, can't you? The "cooling driver" for the CPU would know that it has to slow down, while a driver for the fan would know that it has to speed up ;-)

What I'm trying to say is that in my opinion the tree should simply link the object, the sensor and the actuator. Nothing more, nothing less.

OK. I think it would be a little unfair to have only links, without describing what this link is supposed to be or how it is supposed to be used. In previous discussions, I have mentioned two similar examples already existing in DT. Here are they: regulator bindings, one does not describe only which device connects to which regulator, but also needs to describe, voltage limits, current limits, offsets, and other properties. And an existing 'virtual concept' would be predefined CPU OPPs, that feed the opp layer. Those are configurations of the hardware that define a 'virtual' concept of operating point.

Quoted 3 lines

So, saying we need to describe only physical connections or touchable things would be a little unfair, IMO. Besides, thermal is still physical :-).

Quoted 11 lines

Believe me, I'm trying to be as fair as possible :-) and I see a lot of value in describing the thermal properties of the platforms in the tree. It's just that we really want to focus on describing the hardware, not policies. And as you have already spent so much time on the matter, you are in the best position to find the best set of *physical* properties that would allow to make the right decision in the code. Could you, please, try to make one step back and have another look at the problem? What input data (as in: numbers :-) would you need to get what you want? Are those numbers characteristic to the specific device (they probably should live in the driver than) or to the board/platform (tree without a doubt).

Quoted 13 lines

Ok. My point was just that linking objects without telling when (in temperature domain) to start using this link, may be incomplete, because trip points are really HW dependent, because your power dissipation profile changes from HW design to HW design. In other words, one can say, "use device fan to cool the GPU", but depending on your GPU, you may start using your fan when the sensor is 100C, 85C, 110C (just picking numbers), it is really HW dependent. Besides, the same IP may be used immersed in different ambient condition, which may cause variance on its leakage level, and thus changes its thermal dissipation profile, resulting in different trip points. Thus, mapping all this HW characteristics inside specific drivers does not sound the right path to me. That is why I believe pointing which trips to use is part of HW description.

This sounds like the case we have with OPPs in that the information required to figure out the valid points at which an OS can drive the hardware is driven by rather complex interactions between various components, and it's not clear whether describing all that information is worthwhile. That said, I'm not sure what my opinion on the matter is.

Quoted 3 lines

I must agree that, saying which governor to use, then again, is pure policy definition though.

Sounds like we agree there :)

Thanks,
Mark.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#15 lore raw

T24gVGh1LCAyMDEzLTA4LTA4IGF0IDA5OjUzICswMTAwLCBNYXJrIFJ1dGxhbmQgd3JvdGU6Cj4g T24gV2VkLCBBdWcgMDcsIDIwMTMgYXQgMDk6MTg6MjlQTSArMDEwMCwgRWR1YXJkbyBWYWxlbnRp biB3cm90ZToKPiA+IFBhd2VsLCBhbGwsCj4gPiAKPiA+IE9uIDA2LTA4LTIwMTMgMDc6MTQsIFBh d2VsIE1vbGwgd3JvdGU6Cj4gPiA+IEFwb2xvZ2llcyBhYm91dCB0aGUgZGVsYXksIEkgd2FzICJv dGhlcndpc2UgZW5nYWdlZCIgZm9yIGEgd2Vlay4uLgo+ID4gPiAKPiA+IAo+ID4gSSBkbyBhbHNv IGV4Y3VzZSBmb3IgbXkgZGVsYXksIGFzIEkgd2FzIGFsc28gImVuZ2FnZWQiIGZvciBhIHdlZWsg b3Igc28uCj4gPiAKPiA+ID4gSSBob3BlIHlvdSBoYXZlbid0IGxvc3QgYWxsIG1vdGl2YXRpb24g dG8gd29yayBvbiB0aGlzIHN1YmplY3QsIGFzIGl0J3MKPiA+ID4gcmVhbGx5IHdvcnRoIHRoZSB3 aGlsZSEKPiA+IAo+ID4gTm90IHJlYWxseSEgcXVpdGUgdGhlIG9wcG9zaXRlLiBBbHRob3VnaCBJ IHdhcyBsb29raW5nIGF0IHNvbWUgb3RoZXIKPiA+IHN0dWZmLCBJIGdvdCB0aGlzIHNlcmllcyBh bHNvIHRlc3RlZCBvbiBkaWZmZXJlbnQgYm9hcmRzIGFuZCB3cm90ZSBkb3duCj4gPiBhIGNvdXBs ZSBvZiBpbXByb3ZlbWVudHMgSSB3aWxsIGJlIHdvcmtpbmcgaW4gdGhlIGNvbWluZyBkYXlzLiBJ bmRlZWQsCj4gPiBpdCBpcyB3b3J0aCBtb3ZpbmcgZm9yd2FyZCB3aXRoIHRoaXMgd29yay4KPiA+ IAo+ID4gPiAKPiA+ID4gT24gRnJpLCAyMDEzLTA3LTI2IGF0IDIwOjU1ICswMTAwLCBFZHVhcmRv IFZhbGVudGluIHdyb3RlOgo+ID4gPj4gT24gMjUtMDctMjAxMyAxMzozMywgUGF3ZWwgTW9sbCB3 cm90ZToKPiA+ID4+PiBPbiBUaHUsIDIwMTMtMDctMjUgYXQgMTg6MjAgKzAxMDAsIEVkdWFyZG8g VmFsZW50aW4gd3JvdGU6Cj4gPiA+Pj4+Pj4gCXRoZXJtYWxfem9uZSB7Cj4gPiA+Pj4+Pj4gCQl0 eXBlID0gIkNQVSI7Cj4gPiA+Pj4+Pgo+ID4gPj4+Pj4gU28gd2hhdCBkb2VzIHRoaXMgZXhhY3Rs eSBtZWFuPyBXaGF0IGlzIHNvIHNwZWNpYWwgYWJvdXQgQ1BVPyBXaGF0IG90aGVyCj4gPiA+Pj4+ PiB0eXBlcyB5b3UndmUgZ290IHRoZXJlPyAoQW0gSSBqdXN0IGxhenkgbm90IGxvb2tpbmcgYXQg dGhlIG51bWVyb3VzCj4gPiA+Pj4+PiBsaW5rcyB5b3UgcHJvdmlkZWQ/IDstKQo+ID4gPj4+Pgo+ ID4gPj4+PiBIZWhlaGUuIE9LLiBUeXBlIGlzIHN1cHBvc2VkIHRvIGRlc2NyaWJlIHdoYXQgeW91 ciB6b25lIGlzIHJlcHJlc2VudGluZy4KPiA+ID4+Pgo+ID4gPj4+IEFzIGluICJhIG5hbWUiPyBT bywgZm9yIGV4YW1wbGUgIlRoZSBib2FyZCIsICJQU1UiPyBXaGF0IEkgbWVhbnQgdG8gYXNrCj4g PiA+Pj4gd2FzOiBkb2VzIHRoZSBzdHJpbmcgY2FycnkgYW55IG1lYW5pbmc/Cj4gPiA+IAo+ID4g PiBZb3UgaGF2ZW4ndCBjb21tZW5kZWQgb24gdGhpcy4uLgo+ID4gCj4gPiBUaGUgc3RyaW5nIGlz IHN1cHBvc2VkIHRvIGNhcnJ5IG1lYW5pbmcsIHllcy4gQ291cGxlIG9mIGNvbW1vbiB1c2VkOgo+ ID4gQ1BVLCBHUFUsIFBDQiwgTENECj4gCj4gSSB0aGluayB0aGUgcG9pbnQgUGF3ZWwgd2FzIGdl dHRpbmcgYXQgaXMgdGhhdCB0aGUgc3RyaW5nIGRvZXNuJ3QgaGF2ZSBhCj4gKndlbGwtZGVmaW5l ZCogbWVhbmluZyB0aGF0IGFsd2F5cyBhbGxvd3MgYW4gT1MgdG8gZmlndXJlIG91dCB0aGUgc2V0 IG9mCj4gcmVsZXZhbnQgZGV2aWNlcy4gSWYgd2UgaGF2ZSBhIHRoZXJtYWwgem9uZSBmb3IgIkxD RCIsIGFuZCBoYXZlIG11bHRpcGxlCj4gTENEcywgd2hpY2ggTENEcyBhcmUgY292ZXJlZD8gSWYg d2UgaGF2ZSBhICJQQ0IiIHpvbmUsIGRvZXMgdGhpcyBjb3ZlciBhbGwKPiB0aGUgZGV2aWNlcyBh dHRhY2hlZCB0byB0aGUgUENCLCBhIHN1YnNldCB0aGVyZW9mLCBvciB0aGUgc3Vic3RyYXRlIG9m Cj4gdGhlIFBDQiBpdHNlbGY/CgpPcjogd2hhdCBoYXBwZW5zIGlmIEkgdHlwZSAibGNkIiBpbnN0 ZWFkIG9mICJMQ0QiPyBXb3VsZCB0aGVyZSBiZSBhbnkKZGVjaXNpb24gbWFkZSBiYXNlZCBvbiB0 aGlzIHN0cmluZz8gT3IgaXMgaXQganVzdCBhIGxhYmVsIHRvIGJlIHVzZWQKc29tZXdoZXJlIGlu IGRlYnVnZ2luZyBtZXNzYWdlcz8KClBhd2XFggoKCgpfX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fXwpsbS1zZW5zb3JzIG1haWxpbmcgbGlzdApsbS1zZW5zb3Jz QGxtLXNlbnNvcnMub3JnCmh0dHA6Ly9saXN0cy5sbS1zZW5zb3JzLm9yZy9tYWlsbWFuL2xpc3Rp bmZvL2xtLXNlbnNvcnM

#16 lore raw
In reply to Stephen Warren
Quoted 14 lines · Stephen Warren
Quoted 6 lines · Eduardo Valentin

Hello Grant and Rob,

(Resending, as I got a message saying:
<[email protected]>: Recipient address rejected:
User has moved to devicetree at vger.kernel.org)

Quoted 6 lines

I am writing this email to you specifically to ask your technical assessment with respect to representing device thermal limits as device tree nodes. I am proposing to introduce device tree nodes to describe these limits as thermal zones, their composition and their relations with cooling devices and other thermal zones (thermal data).

Quoted 7 lines

Given:
https://lkml.org/lkml/2013/7/20/69
[PATCH 3/3] MAINTAINERS: Refactor device tree maintainership

I'm explicitly CCing a few people besides Grant/Rob, and qouting the whole email.

OK. Cool. In case thermal limits specification finds its way into DT, I am willing to volunteer to be maintainer for the resulting bindings, in case there is this need.

Quoted 3 lines
Quoted 1 line

From my perspective, the concept of including thermal limits in DT

seems reasonable, although I haven't looked at the proposed binding itself in detail yet.

Yeah, thanks Warren for your support.

Quoted 128 lines
Quoted 108 lines

As you should know, device thermal limits are part of hardware specification. Considering your board layout, mechanics, power dissipation and composition of ICs, etc, that will impose thermal requirements on your system, and infringing these limits can lead to device damage, device life time reduction or even end user harm. Thus, the thermal data help to describe the hardware limits and what needs to be done if those limits are crosses, as part of your board design and non-functional requirements. Obviously that is very dependent on your hardware, and not all of them will have these non-functional requirements. Besides, describing these limits has *nothing* to do with how you actually find these limits.

In any case, there is a need to properly represent these requirements and I am proposing to have this representation in device tree. There were already couple of counter-arguments claiming this is actually about configuration and performance profile description. But I still stand against these two readings of this proposal and again state that if one interprets it as configuration or performance profile, that is a mis-understanding [0]. Let me state it clear (again [1]), my proposal is to describe hardware thermal limits, because these limits are part of a hardware specification; representing in device tree would not infringe the original purpose of this data structure ("The Device Tree is a data structure for describing hardware."[2]).

Before I explain my proposal, I want to highlight also that these data is represented elsewhere already and it is reused across different OS's. Thermal data is described using ACPI [3] and operating systems ACPI-aware do support the interpretation of thermal data. Linux is one example of such systems (I believe I do not need to enlist here all systems supporting ACPI). On the other hand, not all systems have ACPI or are specified to use ACPI. Thus, here is another reason to represent properly thermal data, so that we can scale across systems.

In the specific case of Linux, the common thermal concepts between ACPI systems and non-ACPI systems have been represented in the thermal framework (CONFIG_THERMAL). Today, on ACPI systems, thermal data is fetched from bootloader with help from the common ACPI parser. For non-ACPI systems, the thermal data is actually coded as part of device drivers.

So, to the point, a brief explanation of my proposal goes as
follows: i - trip points: a node to describe a point in the
temperature domain in which the system has to take an action. This node describes just the point, not the action. Properties here are temperature, hysteresis, and type (critical, hot, passive, active, etc). ii - binding parameters: the bind_param node is a node to describe how actions (cooling devices) get assigned to trip points. Cooling devices are expected to be loaded in the target system. Properties here are: cooling device name, weight, trip_mask and limits. iii - thermal zones: the thermal_zone node is the node containing all the required info for describing a thermal zone with hardware thermal limitation, including its bindings with cooling devices. Properties here are: type, passive_delay, polling_delay, governor. The thermal_zone node must contain, apart from its own properties, one node containing trip nodes and one node containing all the zone bind parameters.

Here is an example (on OMAP4430): thermal_zone { type = "CPU"; mask = <0x03>; /* trips writability */ passive_delay = <250>; /* milliseconds */ polling_delay = <1000>; /* milliseconds */ governor = "step_wise"; trips { alert@100000{ temperature = <100000>; /* milliCelsius hysteresis = <2000>; /* milliCelsius */ type = <THERMAL_TRIP_PASSIVE>; }; crit@125000{ temperature = <125000>; /* milliCelsius hysteresis = <2000>; /* milliCelsius */ type = <THERMAL_TRIP_CRITICAL>; }; }; bind_params { action@0{ cooling_device = "thermal-cpufreq"; weight = <100>; /* percentage */ mask = <0x01>; /* no limits, using defaults */ }; }; };

In this current proposal, a 'thermal_zone' node would be embedded inside a temperature sensor node, for simplicity. But other possible builds could embedded them in the device with thermal limits (CPU nodes, for instance) or they could be not embedded in any specific node.

A full documented description can be found here [4]. Also a branch
containing: (a) needed changes in order to have this DT parser; (b) the DT parser with documentation (c) examples on how drivers could be changes to use the parser can be found in my branch here [5]. I wrote the thermal DT parser to build thermal zones with the thermal framework API. However, if one does not want to do that, it can simple do not include a CONFIG_THERMAL_OF=y in her/his build, and the calls will be translated to nops, and the device tree thermal data can be parsed to somewhere else interested (other subsystem or even user land). A TODO on this implementation is that it still lacks the representation of thermal zones composed by several sensors. However, I believe it is better to take an incremental approach here. This series can already be used to improve most of the existing platform thermal drivers (most are CPU thermal drivers) and to reuse the existing code of some hwmon sensors to build thermal zones for board thermal requirements.

I have already posted a patch series with this proposal on [6], that contains a reference for the original RFC. But looks like my messages got moderated on device tree mailing list. Obviously, within PM forum, feedback was quite positive. However, we cannot proceed without proper assessment of other subsystems. lm-sensors folks (Guenter) seam to be strongly against this series, as there is a fear that this may introduce a mis-usage of DT. I still believe this is needed for hardware description, and thus not a infringement on DT purposes.

Please let me know your thoughts on this topic and apologize me if my previous messages on this topic did not reach you (hope they reach now).

Quoted 10 lines

All best,

Eduardo Valentin

[0] - https://lkml.org/lkml/2013/7/17/621 [1] -
https://lkml.org/lkml/2013/7/18/279 [2] - www.devicetree.org [3] -
http://www.acpi.info/ [4] -
https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/diff/Documentation/devicetree/bindings/thermal/thermal.txt?h=thermal_work/thermal_core/dt_parser&id=405bf0b51457ed055a082af2653d7ce757bc2e91

[5] -

Quoted 3 lines

https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux.git/log/?h=thermal_work/thermal_core/dt_parser

[6] - https://lkml.org/lkml/2013/7/17/923

Quoted 2 lines
Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors