* RE: [linux-pm] [RFC] the generic thermal layer enhancement
2012-05-30 10:30 ` Eduardo Valentin
@ 2012-05-30 11:05 ` R, Durgadoss
2012-05-30 11:17 ` Eduardo Valentin
2012-05-31 3:27 ` Zhang Rui
2012-05-31 2:20 ` [linux-pm] " Zhang Rui
2012-05-31 5:16 ` Amit Kachhap
2 siblings, 2 replies; 23+ messages in thread
From: R, Durgadoss @ 2012-05-30 11:05 UTC (permalink / raw)
To: eduardo.valentin@ti.com, Zhang, Rui
Cc: Matthew Garrett, Brown, Len, amit.kachhap@linaro.org,
Jean Delvare, linux-acpi@vger.kernel.org, linux-pm
Hi Eduardo,
>
> For G1+G2, I agree with your proposal. I had some discussion with Amit
> regarding this. In his series of patches we increase / decrease the cooling
> device state linearly and steadily.
>
> But if we would have what you are saying, we could bind cooling device
> set of states with trip points.
True, We want to bind the levels of cooling with the trips points a thermal zone has.
But we might not get a 1-1 mapping always.
>
> I fully support this option and could cook up something on this.
> The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
> Should probably go away from the registration function that we have
> currently.
I realize I just said the same thing :-)
>
> We could have generic trending computation though. Based on timestamping
> and temperature reads, and make it available for zones that want to used it.
Agree, but I would like this go into the platform thermal drivers. And then when
those drivers notify the framework they can specify the trend also. This sort of
notification is not there, but that is what I am implementing these days..
Hope to submit this patch in a week's time..
> > > case THERMAL_TRIP_ACTIVE:
> > > case THERMAL_TRIP_PASSIVE:
> > > ...
> > > tz->ops->get_trend();
>
> Would the get_trend take into account if we are cooling with active or passive
> cooling device?
To me, it does not matter. It is up to the framework to decide and throttle,
the respective cooling devices according to the trend.
>
> > > if (trend == HEATING)
> > > cdev->ops->set_cur_state(cdev, cur_state++);
> > > else if (trend == COOLING)
> > > cdev->ops->set_cur_state(cdev, cur_state--);
> > > break;
>
> I believe we should have something for temperature stabilization there as well.
>
> Besides, if we go with this generic policy, then the zone update would be much
> simpler no?
Yes, and that’s what we want too :-)
> Here are some other thoughts:
> G6. Another point is, would it make sense to allow for policy extension? Meaning,
> the zone update would call a callback to request for update from the zone
> device driver?
>
> G7. How do we solve cooling devices being shared between different thermal
> zones?
> Should we have a better cooling device constraint management?
This is another thing that was haunting me for quite some time.
And What I have in mind is a mapping kind of thing in the platform layer,
that will provide details about which cooling device is shared with whom.
The framework can then use this and figure out the association among various devices.
I am testing it out, and will submit once it comes to a good shape.
Thanks,
Durga
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] the generic thermal layer enhancement
2012-05-30 11:05 ` R, Durgadoss
@ 2012-05-30 11:17 ` Eduardo Valentin
2012-05-31 3:32 ` [linux-pm] " Zhang Rui
2012-05-31 3:27 ` Zhang Rui
1 sibling, 1 reply; 23+ messages in thread
From: Eduardo Valentin @ 2012-05-30 11:17 UTC (permalink / raw)
To: R, Durgadoss
Cc: Jean Delvare, Brown, Len, linux-acpi@vger.kernel.org, linux-pm
Hello Durga,
On Wed, May 30, 2012 at 11:05:18AM +0000, R, Durgadoss wrote:
> Hi Eduardo,
>
> >
> > For G1+G2, I agree with your proposal. I had some discussion with Amit
> > regarding this. In his series of patches we increase / decrease the cooling
> > device state linearly and steadily.
> >
> > But if we would have what you are saying, we could bind cooling device
> > set of states with trip points.
>
> True, We want to bind the levels of cooling with the trips points a thermal zone has.
> But we might not get a 1-1 mapping always.
Just to make sure we are all taking the same thing.
In this case a cooling device would have 1-N states. And this set could
be partitioned and each partition would be assigned to a specific trip point
of a thermal zone, right?
>
> >
> > I fully support this option and could cook up something on this.
> > The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
> > Should probably go away from the registration function that we have
> > currently.
>
> I realize I just said the same thing :-)
Cool :-)
>
> >
> > We could have generic trending computation though. Based on timestamping
> > and temperature reads, and make it available for zones that want to used it.
>
> Agree, but I would like this go into the platform thermal drivers. And then when
> those drivers notify the framework they can specify the trend also. This sort of
> notification is not there, but that is what I am implementing these days..
> Hope to submit this patch in a week's time..
Nice, I actually have something being cooked for the same thing. We should probably
align to avoid work duplication...
>
> > > > case THERMAL_TRIP_ACTIVE:
> > > > case THERMAL_TRIP_PASSIVE:
> > > > ...
> > > > tz->ops->get_trend();
> >
> > Would the get_trend take into account if we are cooling with active or passive
> > cooling device?
>
> To me, it does not matter. It is up to the framework to decide and throttle,
> the respective cooling devices according to the trend.
OK. For me it doesn't really matter as well. Having a simplified zone update is better.
>
> >
> > > > if (trend == HEATING)
> > > > cdev->ops->set_cur_state(cdev, cur_state++);
> > > > else if (trend == COOLING)
> > > > cdev->ops->set_cur_state(cdev, cur_state--);
> > > > break;
> >
> > I believe we should have something for temperature stabilization there as well.
> >
> > Besides, if we go with this generic policy, then the zone update would be much
> > simpler no?
>
> Yes, and that’s what we want too :-)
Nice!
>
> > Here are some other thoughts:
> > G6. Another point is, would it make sense to allow for policy extension? Meaning,
> > the zone update would call a callback to request for update from the zone
> > device driver?
> >
> > G7. How do we solve cooling devices being shared between different thermal
> > zones?
> > Should we have a better cooling device constraint management?
>
> This is another thing that was haunting me for quite some time.
> And What I have in mind is a mapping kind of thing in the platform layer,
> that will provide details about which cooling device is shared with whom.
> The framework can then use this and figure out the association among various devices.
> I am testing it out, and will submit once it comes to a good shape.
Right, I am not sure we want to go in this direction?
Maybe a better way would be to have sort of pm/thermal contraint framework, which
would map these per device, at LDM level?
I am copying Jean-Pihet, he has been working in this front. Jean, any thoughts?
>
> Thanks,
> Durga
>
All Best,
--
Eduardo
_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [linux-pm] [RFC] the generic thermal layer enhancement
2012-05-30 11:17 ` Eduardo Valentin
@ 2012-05-31 3:32 ` Zhang Rui
2012-05-31 11:06 ` Eduardo Valentin
0 siblings, 1 reply; 23+ messages in thread
From: Zhang Rui @ 2012-05-31 3:32 UTC (permalink / raw)
To: eduardo.valentin
Cc: R, Durgadoss, Matthew Garrett, Brown, Len,
amit.kachhap@linaro.org, jean.pihet, Jean Delvare,
linux-acpi@vger.kernel.org, linux-pm
On 三, 2012-05-30 at 14:17 +0300, Eduardo Valentin wrote:
> Hello Durga,
>
> On Wed, May 30, 2012 at 11:05:18AM +0000, R, Durgadoss wrote:
> > Hi Eduardo,
> >
> > >
> > > For G1+G2, I agree with your proposal. I had some discussion with Amit
> > > regarding this. In his series of patches we increase / decrease the cooling
> > > device state linearly and steadily.
> > >
> > > But if we would have what you are saying, we could bind cooling device
> > > set of states with trip points.
> >
> > True, We want to bind the levels of cooling with the trips points a thermal zone has.
> > But we might not get a 1-1 mapping always.
>
> Just to make sure we are all taking the same thing.
>
> In this case a cooling device would have 1-N states. And this set could
> be partitioned and each partition would be assigned to a specific trip point
> of a thermal zone, right?
>
yep.
BTW, Overlaps should be possible and we should handle this as well.
>
>
> >
> > >
> > > I fully support this option and could cook up something on this.
> > > The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
> > > Should probably go away from the registration function that we have
> > > currently.
> >
> > I realize I just said the same thing :-)
>
> Cool :-)
>
> >
> > >
> > > We could have generic trending computation though. Based on timestamping
> > > and temperature reads, and make it available for zones that want to used it.
> >
> > Agree, but I would like this go into the platform thermal drivers. And then when
> > those drivers notify the framework they can specify the trend also. This sort of
> > notification is not there, but that is what I am implementing these days..
> > Hope to submit this patch in a week's time..
>
> Nice, I actually have something being cooked for the same thing. We should probably
> align to avoid work duplication...
>
Hah, seems a lot of work is in progress in this area.
> >
> > > > > case THERMAL_TRIP_ACTIVE:
> > > > > case THERMAL_TRIP_PASSIVE:
> > > > > ...
> > > > > tz->ops->get_trend();
> > >
> > > Would the get_trend take into account if we are cooling with active or passive
> > > cooling device?
> >
> > To me, it does not matter. It is up to the framework to decide and throttle,
> > the respective cooling devices according to the trend.
>
> OK. For me it doesn't really matter as well. Having a simplified zone update is better.
>
> >
> > >
> > > > > if (trend == HEATING)
> > > > > cdev->ops->set_cur_state(cdev, cur_state++);
> > > > > else if (trend == COOLING)
> > > > > cdev->ops->set_cur_state(cdev, cur_state--);
> > > > > break;
> > >
> > > I believe we should have something for temperature stabilization there as well.
> > >
> > > Besides, if we go with this generic policy, then the zone update would be much
> > > simpler no?
> >
> > Yes, and that’s what we want too :-)
>
> Nice!
>
> >
> > > Here are some other thoughts:
> > > G6. Another point is, would it make sense to allow for policy extension? Meaning,
> > > the zone update would call a callback to request for update from the zone
> > > device driver?
> > >
> > > G7. How do we solve cooling devices being shared between different thermal
> > > zones?
> > > Should we have a better cooling device constraint management?
> >
> > This is another thing that was haunting me for quite some time.
> > And What I have in mind is a mapping kind of thing in the platform layer,
> > that will provide details about which cooling device is shared with whom.
> > The framework can then use this and figure out the association among various devices.
> > I am testing it out, and will submit once it comes to a good shape.
>
> Right, I am not sure we want to go in this direction?
>
> Maybe a better way would be to have sort of pm/thermal contraint framework, which
> would map these per device, at LDM level?
>
> I am copying Jean-Pihet, he has been working in this front. Jean, any thoughts?
>
Durga and I are investigating how to introduce some concepts like
"influence/weight" to generic thermal layer. :)
thanks,
rui
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [linux-pm] [RFC] the generic thermal layer enhancement
2012-05-31 3:32 ` [linux-pm] " Zhang Rui
@ 2012-05-31 11:06 ` Eduardo Valentin
2012-05-31 11:14 ` R, Durgadoss
0 siblings, 1 reply; 23+ messages in thread
From: Eduardo Valentin @ 2012-05-31 11:06 UTC (permalink / raw)
To: Zhang Rui
Cc: eduardo.valentin, R, Durgadoss, Matthew Garrett, Brown, Len,
amit.kachhap@linaro.org, jean.pihet, Jean Delvare,
linux-acpi@vger.kernel.org, linux-pm
hello,
On Thu, May 31, 2012 at 11:32:41AM +0800, Zhang Rui wrote:
> On 三, 2012-05-30 at 14:17 +0300, Eduardo Valentin wrote:
> > Hello Durga,
> >
> > On Wed, May 30, 2012 at 11:05:18AM +0000, R, Durgadoss wrote:
> > > Hi Eduardo,
> > >
> > > >
> > > > For G1+G2, I agree with your proposal. I had some discussion with Amit
> > > > regarding this. In his series of patches we increase / decrease the cooling
> > > > device state linearly and steadily.
> > > >
> > > > But if we would have what you are saying, we could bind cooling device
> > > > set of states with trip points.
> > >
> > > True, We want to bind the levels of cooling with the trips points a thermal zone has.
> > > But we might not get a 1-1 mapping always.
> >
> > Just to make sure we are all taking the same thing.
> >
> > In this case a cooling device would have 1-N states. And this set could
> > be partitioned and each partition would be assigned to a specific trip point
> > of a thermal zone, right?
> >
> yep.
> BTW, Overlaps should be possible and we should handle this as well.
> >
> >
> > >
> > > >
> > > > I fully support this option and could cook up something on this.
> > > > The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
> > > > Should probably go away from the registration function that we have
> > > > currently.
> > >
> > > I realize I just said the same thing :-)
> >
> > Cool :-)
> >
> > >
> > > >
> > > > We could have generic trending computation though. Based on timestamping
> > > > and temperature reads, and make it available for zones that want to used it.
> > >
> > > Agree, but I would like this go into the platform thermal drivers. And then when
> > > those drivers notify the framework they can specify the trend also. This sort of
> > > notification is not there, but that is what I am implementing these days..
> > > Hope to submit this patch in a week's time..
> >
> > Nice, I actually have something being cooked for the same thing. We should probably
> > align to avoid work duplication...
> >
> Hah, seems a lot of work is in progress in this area.
>
> > >
> > > > > > case THERMAL_TRIP_ACTIVE:
> > > > > > case THERMAL_TRIP_PASSIVE:
> > > > > > ...
> > > > > > tz->ops->get_trend();
> > > >
> > > > Would the get_trend take into account if we are cooling with active or passive
> > > > cooling device?
> > >
> > > To me, it does not matter. It is up to the framework to decide and throttle,
> > > the respective cooling devices according to the trend.
> >
> > OK. For me it doesn't really matter as well. Having a simplified zone update is better.
> >
> > >
> > > >
> > > > > > if (trend == HEATING)
> > > > > > cdev->ops->set_cur_state(cdev, cur_state++);
> > > > > > else if (trend == COOLING)
> > > > > > cdev->ops->set_cur_state(cdev, cur_state--);
> > > > > > break;
> > > >
> > > > I believe we should have something for temperature stabilization there as well.
> > > >
> > > > Besides, if we go with this generic policy, then the zone update would be much
> > > > simpler no?
> > >
> > > Yes, and that’s what we want too :-)
> >
> > Nice!
> >
> > >
> > > > Here are some other thoughts:
> > > > G6. Another point is, would it make sense to allow for policy extension? Meaning,
> > > > the zone update would call a callback to request for update from the zone
> > > > device driver?
> > > >
> > > > G7. How do we solve cooling devices being shared between different thermal
> > > > zones?
> > > > Should we have a better cooling device constraint management?
> > >
> > > This is another thing that was haunting me for quite some time.
> > > And What I have in mind is a mapping kind of thing in the platform layer,
> > > that will provide details about which cooling device is shared with whom.
> > > The framework can then use this and figure out the association among various devices.
> > > I am testing it out, and will submit once it comes to a good shape.
> >
> > Right, I am not sure we want to go in this direction?
> >
> > Maybe a better way would be to have sort of pm/thermal contraint framework, which
> > would map these per device, at LDM level?
> >
> > I am copying Jean-Pihet, he has been working in this front. Jean, any thoughts?
> >
> Durga and I are investigating how to introduce some concepts like
> "influence/weight" to generic thermal layer. :)
What do you mean here? Describing the cooling devices effectiveness on each zone and
derive algorithms to act accordingly?
>
> thanks,
> rui
>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] the generic thermal layer enhancement
2012-05-31 11:06 ` Eduardo Valentin
@ 2012-05-31 11:14 ` R, Durgadoss
0 siblings, 0 replies; 23+ messages in thread
From: R, Durgadoss @ 2012-05-31 11:14 UTC (permalink / raw)
To: eduardo.valentin@ti.com, Zhang, Rui
Cc: Jean Delvare, Brown, Len, linux-acpi@vger.kernel.org, linux-pm
Hi Eduardo,
[A big cut]
> > >
> > > Maybe a better way would be to have sort of pm/thermal contraint
> framework, which
> > > would map these per device, at LDM level?
> > >
> > > I am copying Jean-Pihet, he has been working in this front. Jean, any
> thoughts?
> > >
> > Durga and I are investigating how to introduce some concepts like
> > "influence/weight" to generic thermal layer. :)
>
> What do you mean here? Describing the cooling devices effectiveness on each
> zone and
> derive algorithms to act accordingly?
Yes. something like that..
Thanks,
Durga
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] the generic thermal layer enhancement
2012-05-30 11:05 ` R, Durgadoss
2012-05-30 11:17 ` Eduardo Valentin
@ 2012-05-31 3:27 ` Zhang Rui
1 sibling, 0 replies; 23+ messages in thread
From: Zhang Rui @ 2012-05-31 3:27 UTC (permalink / raw)
To: R, Durgadoss
Cc: Jean Delvare, Brown, Len, linux-acpi@vger.kernel.org, linux-pm
On 三, 2012-05-30 at 05:05 -0600, R, Durgadoss wrote:
> Hi Eduardo,
>
> >
> > For G1+G2, I agree with your proposal. I had some discussion with Amit
> > regarding this. In his series of patches we increase / decrease the cooling
> > device state linearly and steadily.
> >
> > But if we would have what you are saying, we could bind cooling device
> > set of states with trip points.
>
> True, We want to bind the levels of cooling with the trips points a thermal zone has.
> But we might not get a 1-1 mapping always.
>
> >
> > I fully support this option and could cook up something on this.
> > The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
> > Should probably go away from the registration function that we have
> > currently.
>
> I realize I just said the same thing :-)
>
> >
> > We could have generic trending computation though. Based on timestamping
> > and temperature reads, and make it available for zones that want to used it.
>
> Agree, but I would like this go into the platform thermal drivers.
But at least we need a dummy function in thermal_sys.c, as a backup.
> And then when
> those drivers notify the framework they can specify the trend also. This sort of
> notification is not there, but that is what I am implementing these days..
> Hope to submit this patch in a week's time..
>
You are also working on this?
here is the prototype patch I made for this.
Surely we can change the logic in thermal_get_trend() in thermal_sys.c
It would be great if you can attach your patch as well.
---
drivers/acpi/thermal.c | 36 ++++++++++++++++++++++++++++++++++++
drivers/thermal/thermal_sys.c | 24 ++++++++++++++++++------
include/linux/thermal.h | 9 +++++++++
3 files changed, 63 insertions(+), 6 deletions(-)
Index: rtd3/drivers/acpi/thermal.c
===================================================================
--- rtd3.orig/drivers/acpi/thermal.c
+++ rtd3/drivers/acpi/thermal.c
@@ -706,6 +706,41 @@ static int thermal_get_crit_temp(struct
return -EINVAL;
}
+static int thermal_get_trend(struct thermal_zone_device *thermal,
+ int trip, enum thermal_trend *trend)
+{
+ struct acpi_thermal *tz = thermal->devdata;
+ enum thermal_trip_type type;
+ unsigned long trip_temp;
+ int i;
+
+ if (thermal_get_trip_type(thermal, trip, &type))
+ return -EINVAL;
+
+ /* Only ACTIVE and PASSIVE trip points need TREND */
+ if (type != THERMAL_TRIP_PASSIVE && type != THERMAL_TRIP_ACTIVE)
+ return -EINVAL;
+ /* */
+ if (type == THERMAL_TRIP_ACTIVE) {
+ *trend = THERMAL_TREND_RAISING;
+ return 0;
+ }
+
+ if (thermal_get_trip_temp(thermal, trip, &trip_temp))
+ return -EINVAL;
+
+ /*
+ * tz->temperature has already been updated by generic thermal layer,
+ * before this callback being invoked
+ */
+ i = (tz->trips.passive.tc1 * (tz->temperature - tz->last_temperature))
+ + (tz->trips.passive.tc2 * (tz->temperature - trip_temp));
+
+ *trend = i > 0 ? THERMAL_TREND_RAISING :
+ (i < 0 ? THERMAL_TREND_DROPPING : THERMAL_TREND_NONE);
+ return 0;
+}
+
static int thermal_notify(struct thermal_zone_device *thermal, int trip,
enum thermal_trip_type trip_type)
{
@@ -821,6 +856,7 @@ static const struct thermal_zone_device_
.get_trip_type = thermal_get_trip_type,
.get_trip_temp = thermal_get_trip_temp,
.get_crit_temp = thermal_get_crit_temp,
+ .get_trend = thermal_get_trend,
.notify = thermal_notify,
};
Index: rtd3/drivers/thermal/thermal_sys.c
===================================================================
--- rtd3.orig/drivers/thermal/thermal_sys.c
+++ rtd3/drivers/thermal/thermal_sys.c
@@ -650,6 +650,19 @@ thermal_remove_hwmon_sysfs(struct therma
}
#endif
+static void thermal_get_trend(struct thermal_zone_device *tz,
+ enum thermal_trip_type type, enum thermal_trend *trend)
+{
+ if (!tz->ops->get_trend) {
+ trend = THERMAL_TREND_DEFAULT;
+ return;
+ }
+
+ if (tz->ops->get_trend(tz, type, trend))
+ trend = THERMAL_TREND_DEFAULT;
+ return;
+}
+
static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
int delay)
{
@@ -669,10 +682,11 @@ static void thermal_zone_device_set_poll
static void thermal_zone_device_passive(struct thermal_zone_device *tz,
int temp, int trip_temp, int trip)
{
- int trend = 0;
+ enum thermal_trend trend = THERMAL_TREND_DEFAULT;
struct thermal_cooling_device_instance *instance;
struct thermal_cooling_device *cdev;
long state, max_state;
+ int ret =
/*
* Above Trip?
@@ -684,11 +698,9 @@ static void thermal_zone_device_passive(
if (temp >= trip_temp) {
tz->passive = true;
- trend = (tz->tc1 * (temp - tz->last_temperature)) +
- (tz->tc2 * (temp - trip_temp));
+ thermal_get_trend(tz, trip, &trend);
- /* Heating up? */
- if (trend > 0) {
+ if (trend == THERMAL_TREND_RAISING) {
list_for_each_entry(instance, &tz->cooling_devices,
node) {
if (instance->trip != trip)
@@ -699,7 +711,7 @@ static void thermal_zone_device_passive(
if (state++ < max_state)
cdev->ops->set_cur_state(cdev, state);
}
- } else if (trend < 0) { /* Cooling off? */
+ } else if (trend == THERMAL_TREND_DROPPING) {
list_for_each_entry(instance, &tz->cooling_devices,
node) {
if (instance->trip != trip)
Index: rtd3/include/linux/thermal.h
===================================================================
--- rtd3.orig/include/linux/thermal.h
+++ rtd3/include/linux/thermal.h
@@ -44,6 +44,13 @@ enum thermal_trip_type {
THERMAL_TRIP_CRITICAL,
};
+enum thermal_trend {
+ THERMAL_TREND_NONE,
+ THERMAL_TREND_RAISING,
+ THERMAL_TREND_DROPPING,
+ THERMAL_TREND_DEFAULT = THERMAL_TREND_RAISING, /* aggressive cooling */
+};
+
struct thermal_zone_device_ops {
int (*bind) (struct thermal_zone_device *,
struct thermal_cooling_device *);
@@ -59,6 +66,8 @@ struct thermal_zone_device_ops {
int (*get_trip_temp) (struct thermal_zone_device *, int,
unsigned long *);
int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
+ int (*get_trend) (struct thermal_zone_device *, int,
+ enum thermal_trend *);
int (*notify) (struct thermal_zone_device *, int,
enum thermal_trip_type);
};
> > > > case THERMAL_TRIP_ACTIVE:
> > > > case THERMAL_TRIP_PASSIVE:
> > > > ...
> > > > tz->ops->get_trend();
> >
> > Would the get_trend take into account if we are cooling with active or passive
> > cooling device?
>
> To me, it does not matter. It is up to the framework to decide and throttle,
> the respective cooling devices according to the trend.
>
> >
> > > > if (trend == HEATING)
> > > > cdev->ops->set_cur_state(cdev, cur_state++);
> > > > else if (trend == COOLING)
> > > > cdev->ops->set_cur_state(cdev, cur_state--);
> > > > break;
> >
> > I believe we should have something for temperature stabilization there as well.
> >
> > Besides, if we go with this generic policy, then the zone update would be much
> > simpler no?
>
> Yes, and that’s what we want too :-)
>
> > Here are some other thoughts:
> > G6. Another point is, would it make sense to allow for policy extension? Meaning,
> > the zone update would call a callback to request for update from the zone
> > device driver?
> >
> > G7. How do we solve cooling devices being shared between different thermal
> > zones?
> > Should we have a better cooling device constraint management?
>
> This is another thing that was haunting me for quite some time.
> And What I have in mind is a mapping kind of thing in the platform layer,
> that will provide details about which cooling device is shared with whom.
> The framework can then use this and figure out the association among various devices.
> I am testing it out, and will submit once it comes to a good shape.
>
I think this is your answer for G11 rather than G7, no?
thanks,
rui
_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [linux-pm] [RFC] the generic thermal layer enhancement
2012-05-30 10:30 ` Eduardo Valentin
2012-05-30 11:05 ` R, Durgadoss
@ 2012-05-31 2:20 ` Zhang Rui
2012-05-31 5:16 ` Amit Kachhap
2 siblings, 0 replies; 23+ messages in thread
From: Zhang Rui @ 2012-05-31 2:20 UTC (permalink / raw)
To: eduardo.valentin
Cc: Matthew Garrett, Brown, Len, amit.kachhap, Jean Delvare,
linux-acpi@vger.kernel.org, linux-pm
Hi, Eduardo,
On 三, 2012-05-30 at 13:30 +0300, Eduardo Valentin wrote:
> > >
> > > G1. supporting multiple cooling states for active cooling devices.
> > >
> > > The current active cooling device supports two cooling states only,
> > > please refer to the code below, in driver/thermal/thermal_sys.c
> > > case THERMAL_TRIP_ACTIVE:
> > > ...
> > > if (temp >= trip_temp)
> > > cdev->ops->set_cur_state(cdev, 1);
> > > else
> > > cdev->ops->set_cur_state(cdev, 0);
> > > break;
> > >
> > > This is an ACPI specific thing, as our ACPI FAN used to support
> > > ON/OFF only.
> > > I think it is reasonable to support multiple active cooling states
> > > as they are common on many platforms, and note that this is also
> > > true for ACPI 3.0 FAN device (_FPS).
> > >
> > > G2. introduce cooling states range for a certain trip point
> > >
> > > This problem comes with the first one.
> > > If the cooling devices support multiple cooling states, and surely
> > > we may want only several cooling states for a certain trip point,
> > > and other cooling states for other active trip points.
> > > To do this, we should be able to describe the cooling device
> > > behavior for a certain trip point, rather than for the entire
> > > thermal zone.
>
> For G1+G2, I agree with your proposal. I had some discussion with Amit
> regarding this. In his series of patches we increase / decrease the cooling
> device state linearly and steadily.
>
> But if we would have what you are saying, we could bind cooling device
> set of states with trip points.
>
Great.
But further more, IMO, with G3/G4 solved, this patch set can use passive
trip points instead of active trip points for processors, right?
> > >
> > > G3. kernel thermal passive cooling algorithm
> > >
> > > Currently, tc1 and tc2 are hard requirements for kernel passive
> > > cooling. But non-ACPI platforms do not have this information
> > > (please correct me if I'm wrong).
> > > Say, for the patches here
> > > http://marc.info/?l=linux-acpi&m=133681581305341&w=2
> >
> > Sorry, forgot to cc Amit, the author of this patch set.
> >
> > thanks,
> > rui
> > > They just want to slow down the processor when current temperature
> > > is higher than the trip point and speed up the processor when the
> > > temperature is lower than the trip point.
> > >
> > > According to Matthew, the platform drivers are responsible to
> > > provide proper tc1 and tc2 values to use kernel passive cooling.
> > > But I'm just wondering if we can use something instead.
> > > Say, introduce .get_trend() in thermal_zone_device_ops.
> > > And we set cur_state++ or cur_state-- based on the value returned
> > > by .get_trend(), instead of using tc1 and tc2.
>
> I fully support this option and could cook up something on this.
> The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
> Should probably go away from the registration function that we have
> currently.
>
> We could have generic trending computation though. Based on timestamping
> and temperature reads, and make it available for zones that want to used it.
>
Agreed.
I already have this patch in hand.
> > >
> > > G4. Multiple passive trip points
> > >
> > > I get this idea also from the patches at
> > > http://marc.info/?l=linux-acpi&m=133681581305341&w=2
> > >
> > > IMO, they want to get an acceptable performance at a tolerable
> > > temperature.
> > > Say, a platform with four P-states. P3 is really low.
> > > And I'm okay with the temperature at 60C, but 80C? No.
> > > With G2 resolved, we can use processor P0~P2 for Passive trip point
> > > 0 (50C), and P3 for Passive trip point 1 (70C). And then the
> > > temperature may be jumping at around 60C or even 65C, without
> > > entering P3.
>
> Yeah, I guess we need to solve G1+G2 first to allow this.
yes.
> But I also agree
> that ideally, there should be possibility to have multiple passive trip points.
>
I think this is still an open question for Amit.
As I mentioned above, the idea comes from Amit's patch set, and what I'm
doing here is to try to make the passive cooling implementation works
well on exynos platforms.
As we know, in his patch set, MONITOR_ZONE and WARN_ZONE are mapped to
active trip points. But actually, with G2/G3/G4 solved, they SHOULD be
passive trip points as all the cooling devices are processors, right?
So, my question, and probably this is also the question from Matthew,
would be:
Why we need two passive trip points?
What if we use all p-state for MONITOR_ZONE and discard the WARN_ZONE?
I'd like to see Amit's explanation on this. :)
> > >
> > > Further more, IMO, this also works for ACPI platforms.
> > > Say, we can easily change p-state to cool the system, but using
> > > t-state is definitely what we do not want to see. The current
> > > implementation does not expose this difference to the generic
> > > thermal layer, but if we can have two passive trip points, and use
> > > p-state for the first one only... (this works if we start polling
> > > after entering passive cooling mode, without hardware notification)
> > >
> > > G5. unify active cooling and passive cooling code
> > >
> > > If G4 and G5 are resolved, a new problem to me is that there is no
> > > difference between passive cooling and active cooling except the
> > > cooling policy.
>
> OK...
>
> > > Then we can share the same code for both active and passive cooling.
> > > maybe something like:
> > >
> > > case THERMAL_TRIP_ACTIVE:
> > > case THERMAL_TRIP_PASSIVE:
> > > ...
> > > tz->ops->get_trend();
>
> Would the get_trend take into account if we are cooling with active or passive
> cooling device?
>
YES.
We need this as a hint for active/passive cooling management.
But how it actually works depends on the implementation of
the .get_trend callback in the platform driver.
Say, for active trip points,
.get_trend can always return HEATING, so that fan will start to run
faster and faster when the temperature keeps higher than the trip point.
Or it can return COOLING when cur_temperature < last_temperature, so
that the fan will slow down when the temperature is dropping, but still
higher than the trip point.
> > > if (trend == HEATING)
> > > cdev->ops->set_cur_state(cdev, cur_state++);
> > > else if (trend == COOLING)
> > > cdev->ops->set_cur_state(cdev, cur_state--);
> > > break;
>
> I believe we should have something for temperature stabilization there as well.
>
> Besides, if we go with this generic policy, then the zone update would be much
> simpler no?
>
Agree with Durga.
> > >
> > > Here are the gaps in my point of view, I'd like to get your ideas about
> > > which are reasonable and which are not.
>
> Here are some other thoughts:
> G6. Another point is, would it make sense to allow for policy extension? Meaning,
> the zone update would call a callback to request for update from the zone
> device driver?
>
I'm not against this idea. But do we really have a request for such a
case?
And BTW, if we really have such a request, I think the first thing to do
is to investigate if this is a general request that should be
implemented in the generic thermal layer, rather than go to the zone
device driver directly?
> G7. How do we solve cooling devices being shared between different thermal zones?
> Should we have a better cooling device constraint management?
>
Maybe we just need a simple Arbitrator in kernel?
When changing a cooling device state, it can only override the cur_state
value for the current cooling device instance!
And the code should parse all the cooling device instance of this
cooling device, and choose the deepest cooling state.
what do you think?
> G8. On same topic as G7, how are we currently making sure that thermal constraints
> don't get overwritten by, let's say, userspace APIs?
what kind of userspace APIs can change this?
> I guess the generic CPU cooling
> propose by Amit suffers of an issue. If user sets cpufreq governor to userspace
> and sets the frequency to its maximum, say in a busy loop, the thermal cooling
> could potentially be ruined.
>
that's true, but I don't think that's the case we need to cover.
Setting cpufreq governor to "Userspace" means user needs to be
responsible for the p-state controlling. If the system overheats, that's
the thing that the user needs to worry about.
> G9. Is there any possibility to have multiple sensors per thermal zone?
>
I do not think we need to consider this situation, until there is such
an requirement.
> G10. Do we want to represent other sensing stimuli other that temperature? Say,
> current sensing?
>
what do you mean by "current sensing"?
> G11. Do we want to allow for cross zoning policies? Sometimes a policy may use
> temperature from different thermal zone in order to better represent what
> is going on in its thermal zone.
>
Good question. This bothered me a lot actually.
Each zone device just represents a certain part of the overall system,
and these different zones may interact with each other.
But the current implementation does not take care of this.
Unfortunately I do not have any ideas about this yet. :)
> > >
> > > Any comments are appreciated! Thanks!
>
>
> Thanks to you for starting this up! The above are points that come to my mind now.
> I will keep updating the list if something else come to my mind.
>
They are all good points, thank you for your valuable feedback, Eduardo!
-rui
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [linux-pm] [RFC] the generic thermal layer enhancement
2012-05-30 10:30 ` Eduardo Valentin
2012-05-30 11:05 ` R, Durgadoss
2012-05-31 2:20 ` [linux-pm] " Zhang Rui
@ 2012-05-31 5:16 ` Amit Kachhap
2012-05-31 6:13 ` Zhang Rui
2012-05-31 11:13 ` Eduardo Valentin
2 siblings, 2 replies; 23+ messages in thread
From: Amit Kachhap @ 2012-05-31 5:16 UTC (permalink / raw)
To: eduardo.valentin
Cc: Zhang Rui, Matthew Garrett, Brown, Len, Jean Delvare,
linux-acpi@vger.kernel.org, linux-pm
On 30 May 2012 18:30, Eduardo Valentin <eduardo.valentin@ti.com> wrote:
> Hello Rui,
>
> Now I copied Amit, for real :-)
>
> I like your proposal, some comments as follow.
>
> On Wed, May 30, 2012 at 04:51:00PM +0800, Zhang Rui wrote:
>> On 三, 2012-05-30 at 16:49 +0800, Zhang Rui wrote:
>> > Hi, all,
>> >
>> > It is great to see more and more users of the generic thermal layer.
>> > But as we know, the original design of the generic thermal layer comes
>> > from ACPI thermal management, and some of its implementation seems to be
>> > too ACPI specific nowadays.
>
>
> Good. We have also basic OMAP support, on top of Amit's work. I sent
> recently a very basic support. I will be pushing them, while they evolve.
>
>> >
>> > Recently I'm thinking of enhance the generic thermal layer so that it
>> > works well for more platforms.
>
> As you said, for non-ACPI support, the "generic" layer needs some
> extension and refactoring to be more generic :-).
>
>> >
>> > Below are some thoughts of mine, after reading the patches from Amit
>> > Daniel Kachhap, and ACPI 3.0 thermal model. Actually, I have started
>> > coding some RFC patches. But I do really want to get feedback from you
>> > before going on.
>
> OK.
>
>> >
>> > G1. supporting multiple cooling states for active cooling devices.
>> >
>> > The current active cooling device supports two cooling states only,
>> > please refer to the code below, in driver/thermal/thermal_sys.c
>> > case THERMAL_TRIP_ACTIVE:
>> > ...
>> > if (temp >= trip_temp)
>> > cdev->ops->set_cur_state(cdev, 1);
>> > else
>> > cdev->ops->set_cur_state(cdev, 0);
>> > break;
>> >
>> > This is an ACPI specific thing, as our ACPI FAN used to support
>> > ON/OFF only.
>> > I think it is reasonable to support multiple active cooling states
>> > as they are common on many platforms, and note that this is also
>> > true for ACPI 3.0 FAN device (_FPS).
>> >
>> > G2. introduce cooling states range for a certain trip point
>> >
>> > This problem comes with the first one.
>> > If the cooling devices support multiple cooling states, and surely
>> > we may want only several cooling states for a certain trip point,
>> > and other cooling states for other active trip points.
>> > To do this, we should be able to describe the cooling device
>> > behavior for a certain trip point, rather than for the entire
>> > thermal zone.
>
> For G1+G2, I agree with your proposal. I had some discussion with Amit
> regarding this. In his series of patches we increase / decrease the cooling
> device state linearly and steadily.
>
> But if we would have what you are saying, we could bind cooling device
> set of states with trip points.
>
>> >
>> > G3. kernel thermal passive cooling algorithm
>> >
>> > Currently, tc1 and tc2 are hard requirements for kernel passive
>> > cooling. But non-ACPI platforms do not have this information
>> > (please correct me if I'm wrong).
>> > Say, for the patches here
>> > http://marc.info/?l=linux-acpi&m=133681581305341&w=2
>>
>> Sorry, forgot to cc Amit, the author of this patch set.
>>
>> thanks,
>> rui
>> > They just want to slow down the processor when current temperature
>> > is higher than the trip point and speed up the processor when the
>> > temperature is lower than the trip point.
>> >
>> > According to Matthew, the platform drivers are responsible to
>> > provide proper tc1 and tc2 values to use kernel passive cooling.
>> > But I'm just wondering if we can use something instead.
>> > Say, introduce .get_trend() in thermal_zone_device_ops.
>> > And we set cur_state++ or cur_state-- based on the value returned
>> > by .get_trend(), instead of using tc1 and tc2.
>
> I fully support this option and could cook up something on this.
> The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
> Should probably go away from the registration function that we have
> currently.
>
> We could have generic trending computation though. Based on timestamping
> and temperature reads, and make it available for zones that want to used it.
>
>> >
>> > G4. Multiple passive trip points
>> >
>> > I get this idea also from the patches at
>> > http://marc.info/?l=linux-acpi&m=133681581305341&w=2
>> >
>> > IMO, they want to get an acceptable performance at a tolerable
>> > temperature.
>> > Say, a platform with four P-states. P3 is really low.
>> > And I'm okay with the temperature at 60C, but 80C? No.
>> > With G2 resolved, we can use processor P0~P2 for Passive trip point
>> > 0 (50C), and P3 for Passive trip point 1 (70C). And then the
>> > temperature may be jumping at around 60C or even 65C, without
>> > entering P3.
>
> Yeah, I guess we need to solve G1+G2 first to allow this. But I also agree
> that ideally, there should be possibility to have multiple passive trip points.
>
>> >
>> > Further more, IMO, this also works for ACPI platforms.
>> > Say, we can easily change p-state to cool the system, but using
>> > t-state is definitely what we do not want to see. The current
>> > implementation does not expose this difference to the generic
>> > thermal layer, but if we can have two passive trip points, and use
>> > p-state for the first one only... (this works if we start polling
>> > after entering passive cooling mode, without hardware notification)
>> >
>> > G5. unify active cooling and passive cooling code
>> >
>> > If G4 and G5 are resolved, a new problem to me is that there is no
>> > difference between passive cooling and active cooling except the
>> > cooling policy.
>
> OK...
>
>> > Then we can share the same code for both active and passive cooling.
>> > maybe something like:
>> >
>> > case THERMAL_TRIP_ACTIVE:
>> > case THERMAL_TRIP_PASSIVE:
>> > ...
>> > tz->ops->get_trend();
>
> Would the get_trend take into account if we are cooling with active or passive
> cooling device?
>
>> > if (trend == HEATING)
>> > cdev->ops->set_cur_state(cdev, cur_state++);
>> > else if (trend == COOLING)
>> > cdev->ops->set_cur_state(cdev, cur_state--);
>> > break;
>
> I believe we should have something for temperature stabilization there as well.
I also agree that thermal stablization is important. I have observed
that too much state change is happening around the trip point. But yes
the trend callback may take care of this and set the COOLING trend
different from HEATING trend.
>
> Besides, if we go with this generic policy, then the zone update would be much
> simpler no?
>
>> >
>> > Here are the gaps in my point of view, I'd like to get your ideas about
>> > which are reasonable and which are not.
>
> Here are some other thoughts:
> G6. Another point is, would it make sense to allow for policy extension? Meaning,
> the zone update would call a callback to request for update from the zone
> device driver?
This may a simple work with adding notifiers like done for CRITICAL,
HOT trip type.
>
> G7. How do we solve cooling devices being shared between different thermal zones?
> Should we have a better cooling device constraint management?
>
> G8. On same topic as G7, how are we currently making sure that thermal constraints
> don't get overwritten by, let's say, userspace APIs? I guess the generic CPU cooling
> propose by Amit suffers of an issue. If user sets cpufreq governor to userspace
> and sets the frequency to its maximum, say in a busy loop, the thermal cooling
> could potentially be ruined.
Yes I agree that is a problem in my implementation but I guess the
current cpufreq framework does not have anything to stop this. May be
with cpufreq_max pmqos patches this will be taken care.
>
> G9. Is there any possibility to have multiple sensors per thermal zone?
>
> G10. Do we want to represent other sensing stimuli other that temperature? Say,
> current sensing?
Yes this is good field to look into.
>
> G11. Do we want to allow for cross zoning policies? Sometimes a policy may use
> temperature from different thermal zone in order to better represent what
> is going on in its thermal zone.
>
>> >
>> > Any comments are appreciated! Thanks!
>
>
> Thanks to you for starting this up! The above are points that come to my mind now.
> I will keep updating the list if something else come to my mind.
>
>> >
>> > -rui
>> >
>> > _______________________________________________
>> > linux-pm mailing list
>> > linux-pm@lists.linux-foundation.org
>> > https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
>>
>>
>> _______________________________________________
>> linux-pm mailing list
>> linux-pm@lists.linux-foundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
>
> All best,
>
> ---
> Eduardo Valentin
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] the generic thermal layer enhancement
2012-05-31 5:16 ` Amit Kachhap
@ 2012-05-31 6:13 ` Zhang Rui
2012-05-31 11:13 ` Eduardo Valentin
1 sibling, 0 replies; 23+ messages in thread
From: Zhang Rui @ 2012-05-31 6:13 UTC (permalink / raw)
To: Amit Kachhap
Cc: Jean Delvare, Brown, Len, linux-acpi@vger.kernel.org, linux-pm
> >> > G5. unify active cooling and passive cooling code
> >> >
> >> > If G4 and G5 are resolved, a new problem to me is that there is no
> >> > difference between passive cooling and active cooling except the
> >> > cooling policy.
> >
> > OK...
> >
> >> > Then we can share the same code for both active and passive cooling.
> >> > maybe something like:
> >> >
> >> > case THERMAL_TRIP_ACTIVE:
> >> > case THERMAL_TRIP_PASSIVE:
> >> > ...
> >> > tz->ops->get_trend();
> >
> > Would the get_trend take into account if we are cooling with active or passive
> > cooling device?
> >
> >> > if (trend == HEATING)
> >> > cdev->ops->set_cur_state(cdev, cur_state++);
> >> > else if (trend == COOLING)
> >> > cdev->ops->set_cur_state(cdev, cur_state--);
> >> > break;
> >
> > I believe we should have something for temperature stabilization there as well.
> I also agree that thermal stablization is important. I have observed
> that too much state change is happening around the trip point. But yes
> the trend callback may take care of this and set the COOLING trend
> different from HEATING trend.
that's why Matthew and I are asking you to try to fit into the current
passive cooling implementation first, as the current algorithm is really
a good one, if you can make use of it.
.get_trend() is just a backup for this.
thanks,
rui
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] the generic thermal layer enhancement
2012-05-31 5:16 ` Amit Kachhap
2012-05-31 6:13 ` Zhang Rui
@ 2012-05-31 11:13 ` Eduardo Valentin
2012-06-01 9:05 ` [linux-pm] " Jean Pihet
1 sibling, 1 reply; 23+ messages in thread
From: Eduardo Valentin @ 2012-05-31 11:13 UTC (permalink / raw)
To: Amit Kachhap
Cc: Jean Delvare, Brown, Len, linux-acpi@vger.kernel.org, linux-pm
Hello,
On Thu, May 31, 2012 at 01:16:37PM +0800, Amit Kachhap wrote:
> On 30 May 2012 18:30, Eduardo Valentin <eduardo.valentin@ti.com> wrote:
> > Hello Rui,
> >
> > Now I copied Amit, for real :-)
> >
> > I like your proposal, some comments as follow.
> >
> > On Wed, May 30, 2012 at 04:51:00PM +0800, Zhang Rui wrote:
> >> On 三, 2012-05-30 at 16:49 +0800, Zhang Rui wrote:
> >> > Hi, all,
> >> >
> >> > It is great to see more and more users of the generic thermal layer.
> >> > But as we know, the original design of the generic thermal layer comes
> >> > from ACPI thermal management, and some of its implementation seems to be
> >> > too ACPI specific nowadays.
> >
> >
> > Good. We have also basic OMAP support, on top of Amit's work. I sent
> > recently a very basic support. I will be pushing them, while they evolve.
> >
> >> >
> >> > Recently I'm thinking of enhance the generic thermal layer so that it
> >> > works well for more platforms.
> >
> > As you said, for non-ACPI support, the "generic" layer needs some
> > extension and refactoring to be more generic :-).
> >
> >> >
> >> > Below are some thoughts of mine, after reading the patches from Amit
> >> > Daniel Kachhap, and ACPI 3.0 thermal model. Actually, I have started
> >> > coding some RFC patches. But I do really want to get feedback from you
> >> > before going on.
> >
> > OK.
> >
> >> >
> >> > G1. supporting multiple cooling states for active cooling devices.
> >> >
> >> > The current active cooling device supports two cooling states only,
> >> > please refer to the code below, in driver/thermal/thermal_sys.c
> >> > case THERMAL_TRIP_ACTIVE:
> >> > ...
> >> > if (temp >= trip_temp)
> >> > cdev->ops->set_cur_state(cdev, 1);
> >> > else
> >> > cdev->ops->set_cur_state(cdev, 0);
> >> > break;
> >> >
> >> > This is an ACPI specific thing, as our ACPI FAN used to support
> >> > ON/OFF only.
> >> > I think it is reasonable to support multiple active cooling states
> >> > as they are common on many platforms, and note that this is also
> >> > true for ACPI 3.0 FAN device (_FPS).
> >> >
> >> > G2. introduce cooling states range for a certain trip point
> >> >
> >> > This problem comes with the first one.
> >> > If the cooling devices support multiple cooling states, and surely
> >> > we may want only several cooling states for a certain trip point,
> >> > and other cooling states for other active trip points.
> >> > To do this, we should be able to describe the cooling device
> >> > behavior for a certain trip point, rather than for the entire
> >> > thermal zone.
> >
> > For G1+G2, I agree with your proposal. I had some discussion with Amit
> > regarding this. In his series of patches we increase / decrease the cooling
> > device state linearly and steadily.
> >
> > But if we would have what you are saying, we could bind cooling device
> > set of states with trip points.
> >
> >> >
> >> > G3. kernel thermal passive cooling algorithm
> >> >
> >> > Currently, tc1 and tc2 are hard requirements for kernel passive
> >> > cooling. But non-ACPI platforms do not have this information
> >> > (please correct me if I'm wrong).
> >> > Say, for the patches here
> >> > http://marc.info/?l=linux-acpi&m=133681581305341&w=2
> >>
> >> Sorry, forgot to cc Amit, the author of this patch set.
> >>
> >> thanks,
> >> rui
> >> > They just want to slow down the processor when current temperature
> >> > is higher than the trip point and speed up the processor when the
> >> > temperature is lower than the trip point.
> >> >
> >> > According to Matthew, the platform drivers are responsible to
> >> > provide proper tc1 and tc2 values to use kernel passive cooling.
> >> > But I'm just wondering if we can use something instead.
> >> > Say, introduce .get_trend() in thermal_zone_device_ops.
> >> > And we set cur_state++ or cur_state-- based on the value returned
> >> > by .get_trend(), instead of using tc1 and tc2.
> >
> > I fully support this option and could cook up something on this.
> > The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
> > Should probably go away from the registration function that we have
> > currently.
> >
> > We could have generic trending computation though. Based on timestamping
> > and temperature reads, and make it available for zones that want to used it.
> >
> >> >
> >> > G4. Multiple passive trip points
> >> >
> >> > I get this idea also from the patches at
> >> > http://marc.info/?l=linux-acpi&m=133681581305341&w=2
> >> >
> >> > IMO, they want to get an acceptable performance at a tolerable
> >> > temperature.
> >> > Say, a platform with four P-states. P3 is really low.
> >> > And I'm okay with the temperature at 60C, but 80C? No.
> >> > With G2 resolved, we can use processor P0~P2 for Passive trip point
> >> > 0 (50C), and P3 for Passive trip point 1 (70C). And then the
> >> > temperature may be jumping at around 60C or even 65C, without
> >> > entering P3.
> >
> > Yeah, I guess we need to solve G1+G2 first to allow this. But I also agree
> > that ideally, there should be possibility to have multiple passive trip points.
> >
> >> >
> >> > Further more, IMO, this also works for ACPI platforms.
> >> > Say, we can easily change p-state to cool the system, but using
> >> > t-state is definitely what we do not want to see. The current
> >> > implementation does not expose this difference to the generic
> >> > thermal layer, but if we can have two passive trip points, and use
> >> > p-state for the first one only... (this works if we start polling
> >> > after entering passive cooling mode, without hardware notification)
> >> >
> >> > G5. unify active cooling and passive cooling code
> >> >
> >> > If G4 and G5 are resolved, a new problem to me is that there is no
> >> > difference between passive cooling and active cooling except the
> >> > cooling policy.
> >
> > OK...
> >
> >> > Then we can share the same code for both active and passive cooling.
> >> > maybe something like:
> >> >
> >> > case THERMAL_TRIP_ACTIVE:
> >> > case THERMAL_TRIP_PASSIVE:
> >> > ...
> >> > tz->ops->get_trend();
> >
> > Would the get_trend take into account if we are cooling with active or passive
> > cooling device?
> >
> >> > if (trend == HEATING)
> >> > cdev->ops->set_cur_state(cdev, cur_state++);
> >> > else if (trend == COOLING)
> >> > cdev->ops->set_cur_state(cdev, cur_state--);
> >> > break;
> >
> > I believe we should have something for temperature stabilization there as well.
> I also agree that thermal stablization is important. I have observed
> that too much state change is happening around the trip point. But yes
> the trend callback may take care of this and set the COOLING trend
> different from HEATING trend.
> >
> > Besides, if we go with this generic policy, then the zone update would be much
> > simpler no?
> >
> >> >
> >> > Here are the gaps in my point of view, I'd like to get your ideas about
> >> > which are reasonable and which are not.
> >
> > Here are some other thoughts:
> > G6. Another point is, would it make sense to allow for policy extension? Meaning,
> > the zone update would call a callback to request for update from the zone
> > device driver?
> This may a simple work with adding notifiers like done for CRITICAL,
> HOT trip type.
> >
> > G7. How do we solve cooling devices being shared between different thermal zones?
> > Should we have a better cooling device constraint management?
> >
> > G8. On same topic as G7, how are we currently making sure that thermal constraints
> > don't get overwritten by, let's say, userspace APIs? I guess the generic CPU cooling
> > propose by Amit suffers of an issue. If user sets cpufreq governor to userspace
> > and sets the frequency to its maximum, say in a busy loop, the thermal cooling
> > could potentially be ruined.
> Yes I agree that is a problem in my implementation but I guess the
> current cpufreq framework does not have anything to stop this. May be
> with cpufreq_max pmqos patches this will be taken care.
Just a clarification here. I didn't really mean that this is a problem on your implementation.
But a general problem. And needs to be dealt properly.
And to be frank, assuming that just because we selected userspace at cpufreq level it is
userland problem, it is a weak solution. Specially considering that this may lead to
potentially harmful situations.
Not sure this needs to be solved at the generic thermal framework, but at least
the thermal framework should be aware of who is dealing with the constraint management.
The pmqos patch is a good direction to go, IMO.
> >
> > G9. Is there any possibility to have multiple sensors per thermal zone?
> >
> > G10. Do we want to represent other sensing stimuli other that temperature? Say,
> > current sensing?
> Yes this is good field to look into.
> >
> > G11. Do we want to allow for cross zoning policies? Sometimes a policy may use
> > temperature from different thermal zone in order to better represent what
> > is going on in its thermal zone.
> >
> >> >
> >> > Any comments are appreciated! Thanks!
> >
> >
> > Thanks to you for starting this up! The above are points that come to my mind now.
> > I will keep updating the list if something else come to my mind.
> >
> >> >
> >> > -rui
> >> >
> >> > _______________________________________________
> >> > linux-pm mailing list
> >> > linux-pm@lists.linux-foundation.org
> >> > https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
> >>
> >>
> >> _______________________________________________
> >> linux-pm mailing list
> >> linux-pm@lists.linux-foundation.org
> >> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
> >
> > All best,
> >
> > ---
> > Eduardo Valentin
_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [linux-pm] [RFC] the generic thermal layer enhancement
2012-05-31 11:13 ` Eduardo Valentin
@ 2012-06-01 9:05 ` Jean Pihet
0 siblings, 0 replies; 23+ messages in thread
From: Jean Pihet @ 2012-06-01 9:05 UTC (permalink / raw)
To: eduardo.valentin
Cc: Amit Kachhap, Jean Delvare, Brown, Len,
linux-acpi@vger.kernel.org, mark gross, Rafael J. Wysocki
Hi!
On Thu, May 31, 2012 at 1:13 PM, Eduardo Valentin
<eduardo.valentin@ti.com> wrote:
> Hello,
>
> On Thu, May 31, 2012 at 01:16:37PM +0800, Amit Kachhap wrote:
>> On 30 May 2012 18:30, Eduardo Valentin <eduardo.valentin@ti.com> wrote:
>> > Hello Rui,
>> >
>> > Now I copied Amit, for real :-)
>> >
>> > I like your proposal, some comments as follow.
>> >
>> > On Wed, May 30, 2012 at 04:51:00PM +0800, Zhang Rui wrote:
>> >> On 三, 2012-05-30 at 16:49 +0800, Zhang Rui wrote:
>> >> > Hi, all,
>> >> >
>> >> > It is great to see more and more users of the generic thermal layer.
>> >> > But as we know, the original design of the generic thermal layer comes
>> >> > from ACPI thermal management, and some of its implementation seems to be
>> >> > too ACPI specific nowadays.
>> >
>> >
>> > Good. We have also basic OMAP support, on top of Amit's work. I sent
>> > recently a very basic support. I will be pushing them, while they evolve.
>> >
>> >> >
>> >> > Recently I'm thinking of enhance the generic thermal layer so that it
>> >> > works well for more platforms.
>> >
>> > As you said, for non-ACPI support, the "generic" layer needs some
>> > extension and refactoring to be more generic :-).
>> >
>> >> >
>> >> > Below are some thoughts of mine, after reading the patches from Amit
>> >> > Daniel Kachhap, and ACPI 3.0 thermal model. Actually, I have started
>> >> > coding some RFC patches. But I do really want to get feedback from you
>> >> > before going on.
>> >
>> > OK.
>> >
>> >> >
>> >> > G1. supporting multiple cooling states for active cooling devices.
>> >> >
>> >> > The current active cooling device supports two cooling states only,
>> >> > please refer to the code below, in driver/thermal/thermal_sys.c
>> >> > case THERMAL_TRIP_ACTIVE:
>> >> > ...
>> >> > if (temp >= trip_temp)
>> >> > cdev->ops->set_cur_state(cdev, 1);
>> >> > else
>> >> > cdev->ops->set_cur_state(cdev, 0);
>> >> > break;
>> >> >
>> >> > This is an ACPI specific thing, as our ACPI FAN used to support
>> >> > ON/OFF only.
>> >> > I think it is reasonable to support multiple active cooling states
>> >> > as they are common on many platforms, and note that this is also
>> >> > true for ACPI 3.0 FAN device (_FPS).
>> >> >
>> >> > G2. introduce cooling states range for a certain trip point
>> >> >
>> >> > This problem comes with the first one.
>> >> > If the cooling devices support multiple cooling states, and surely
>> >> > we may want only several cooling states for a certain trip point,
>> >> > and other cooling states for other active trip points.
>> >> > To do this, we should be able to describe the cooling device
>> >> > behavior for a certain trip point, rather than for the entire
>> >> > thermal zone.
>> >
>> > For G1+G2, I agree with your proposal. I had some discussion with Amit
>> > regarding this. In his series of patches we increase / decrease the cooling
>> > device state linearly and steadily.
>> >
>> > But if we would have what you are saying, we could bind cooling device
>> > set of states with trip points.
>> >
>> >> >
>> >> > G3. kernel thermal passive cooling algorithm
>> >> >
>> >> > Currently, tc1 and tc2 are hard requirements for kernel passive
>> >> > cooling. But non-ACPI platforms do not have this information
>> >> > (please correct me if I'm wrong).
>> >> > Say, for the patches here
>> >> > http://marc.info/?l=linux-acpi&m=133681581305341&w=2
>> >>
>> >> Sorry, forgot to cc Amit, the author of this patch set.
>> >>
>> >> thanks,
>> >> rui
>> >> > They just want to slow down the processor when current temperature
>> >> > is higher than the trip point and speed up the processor when the
>> >> > temperature is lower than the trip point.
>> >> >
>> >> > According to Matthew, the platform drivers are responsible to
>> >> > provide proper tc1 and tc2 values to use kernel passive cooling.
>> >> > But I'm just wondering if we can use something instead.
>> >> > Say, introduce .get_trend() in thermal_zone_device_ops.
>> >> > And we set cur_state++ or cur_state-- based on the value returned
>> >> > by .get_trend(), instead of using tc1 and tc2.
>> >
>> > I fully support this option and could cook up something on this.
>> > The TC1 and TC2 should go inside the .get_trend() callbacks for ACPI.
>> > Should probably go away from the registration function that we have
>> > currently.
>> >
>> > We could have generic trending computation though. Based on timestamping
>> > and temperature reads, and make it available for zones that want to used it.
>> >
>> >> >
>> >> > G4. Multiple passive trip points
>> >> >
>> >> > I get this idea also from the patches at
>> >> > http://marc.info/?l=linux-acpi&m=133681581305341&w=2
>> >> >
>> >> > IMO, they want to get an acceptable performance at a tolerable
>> >> > temperature.
>> >> > Say, a platform with four P-states. P3 is really low.
>> >> > And I'm okay with the temperature at 60C, but 80C? No.
>> >> > With G2 resolved, we can use processor P0~P2 for Passive trip point
>> >> > 0 (50C), and P3 for Passive trip point 1 (70C). And then the
>> >> > temperature may be jumping at around 60C or even 65C, without
>> >> > entering P3.
>> >
>> > Yeah, I guess we need to solve G1+G2 first to allow this. But I also agree
>> > that ideally, there should be possibility to have multiple passive trip points.
>> >
>> >> >
>> >> > Further more, IMO, this also works for ACPI platforms.
>> >> > Say, we can easily change p-state to cool the system, but using
>> >> > t-state is definitely what we do not want to see. The current
>> >> > implementation does not expose this difference to the generic
>> >> > thermal layer, but if we can have two passive trip points, and use
>> >> > p-state for the first one only... (this works if we start polling
>> >> > after entering passive cooling mode, without hardware notification)
>> >> >
>> >> > G5. unify active cooling and passive cooling code
>> >> >
>> >> > If G4 and G5 are resolved, a new problem to me is that there is no
>> >> > difference between passive cooling and active cooling except the
>> >> > cooling policy.
>> >
>> > OK...
>> >
>> >> > Then we can share the same code for both active and passive cooling.
>> >> > maybe something like:
>> >> >
>> >> > case THERMAL_TRIP_ACTIVE:
>> >> > case THERMAL_TRIP_PASSIVE:
>> >> > ...
>> >> > tz->ops->get_trend();
>> >
>> > Would the get_trend take into account if we are cooling with active or passive
>> > cooling device?
>> >
>> >> > if (trend == HEATING)
>> >> > cdev->ops->set_cur_state(cdev, cur_state++);
>> >> > else if (trend == COOLING)
>> >> > cdev->ops->set_cur_state(cdev, cur_state--);
>> >> > break;
>> >
>> > I believe we should have something for temperature stabilization there as well.
>> I also agree that thermal stablization is important. I have observed
>> that too much state change is happening around the trip point. But yes
>> the trend callback may take care of this and set the COOLING trend
>> different from HEATING trend.
>> >
>> > Besides, if we go with this generic policy, then the zone update would be much
>> > simpler no?
>> >
>> >> >
>> >> > Here are the gaps in my point of view, I'd like to get your ideas about
>> >> > which are reasonable and which are not.
>> >
>> > Here are some other thoughts:
>> > G6. Another point is, would it make sense to allow for policy extension? Meaning,
>> > the zone update would call a callback to request for update from the zone
>> > device driver?
>> This may a simple work with adding notifiers like done for CRITICAL,
>> HOT trip type.
>> >
>> > G7. How do we solve cooling devices being shared between different thermal zones?
>> > Should we have a better cooling device constraint management?
>> >
>> > G8. On same topic as G7, how are we currently making sure that thermal constraints
>> > don't get overwritten by, let's say, userspace APIs? I guess the generic CPU cooling
>> > propose by Amit suffers of an issue. If user sets cpufreq governor to userspace
>> > and sets the frequency to its maximum, say in a busy loop, the thermal cooling
>> > could potentially be ruined.
>> Yes I agree that is a problem in my implementation but I guess the
>> current cpufreq framework does not have anything to stop this. May be
>> with cpufreq_max pmqos patches this will be taken care.
>
> Just a clarification here. I didn't really mean that this is a problem on your implementation.
> But a general problem. And needs to be dealt properly.
>
> And to be frank, assuming that just because we selected userspace at cpufreq level it is
> userland problem, it is a weak solution. Specially considering that this may lead to
> potentially harmful situations.
>
> Not sure this needs to be solved at the generic thermal framework, but at least
> the thermal framework should be aware of who is dealing with the constraint management.
>
> The pmqos patch is a good direction to go, IMO.
Agree! There is a real need to have a framework for the following:
- per-device PM QoS,
- devices throughput,
- thermal constraints and cooling devices,
- min/max performance constraint,
- ...
However for good reasons the current PM QoS framework cannot address
all those requirements at once.
From the code submissions and discussions on the MLs Mark Gross came
with the very good idea of organizing a specific micro-conference
around the constraints framework at LPC [1]. The topics starting with
'lpc2012-cf-' are part of this micro-conference. Most of the topics
-if not all- are about thermal management integration.
[1] https://blueprints.launchpad.net/lpc
I have big expectations from the LPC. Meeting face to face and discuss
the proposals is a good way to make progress, which is not so
efficient on the MLs.
Regards,
Jean
>
>> >
>> > G9. Is there any possibility to have multiple sensors per thermal zone?
>> >
>> > G10. Do we want to represent other sensing stimuli other that temperature? Say,
>> > current sensing?
>> Yes this is good field to look into.
>> >
>> > G11. Do we want to allow for cross zoning policies? Sometimes a policy may use
>> > temperature from different thermal zone in order to better represent what
>> > is going on in its thermal zone.
>> >
>> >> >
>> >> > Any comments are appreciated! Thanks!
>> >
>> >
>> > Thanks to you for starting this up! The above are points that come to my mind now.
>> > I will keep updating the list if something else come to my mind.
>> >
>> >> >
>> >> > -rui
>> >> >
>> >> > _______________________________________________
>> >> > linux-pm mailing list
>> >> > linux-pm@lists.linux-foundation.org
>> >> > https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
>> >>
>> >>
>> >> _______________________________________________
>> >> linux-pm mailing list
>> >> linux-pm@lists.linux-foundation.org
>> >> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
>> >
>> > All best,
>> >
>> > ---
>> > Eduardo Valentin
> _______________________________________________
> linux-pm mailing list
> linux-pm@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread