Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1292734 > unrolled thread
| Started by | Eduardo Valentin <edubezval@gmail.com> |
|---|---|
| First post | 2015-12-16 04:50 +0100 |
| Last post | 2015-12-17 00:50 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/3] thermal: rework core to improve userspace interaction Eduardo Valentin <edubezval@gmail.com> - 2015-12-16 04:50 +0100
[PATCH 3/3] thermal: improve hot trip handling Eduardo Valentin <edubezval@gmail.com> - 2015-12-16 04:50 +0100
[PATCHv2 1/3] thermal: setup monitor only once after handling trips Eduardo Valentin <edubezval@gmail.com> - 2015-12-16 04:50 +0100
Re: [PATCHv2 1/3] thermal: setup monitor only once after handling trips "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com> - 2015-12-17 00:50 +0100
| From | Eduardo Valentin <edubezval@gmail.com> |
|---|---|
| Date | 2015-12-16 04:50 +0100 |
| Subject | [PATCH 0/3] thermal: rework core to improve userspace interaction |
| Message-ID | <qGbgd-4UV-3@gated-at.bofh.it> |
Hello Rui, linux-pm Please consider these three patches in the thermal core to improve the interaction with userspace. The first is already in its second version. It avoids reconfiguring monitor period. Now the thermal core configures the monitor only after handling all trip points. The second is about improving emul_temp. The background here is to allow using emul_temp, even if the thermal zone is not fully setup, with a missing .get_temp(). The third is to improve hot trip points handling. Hot trip points are described as notification entry points. However, we do very little on them. This patch adds a uevent to propagate the event to userspace. Today, we rely on thermal zone driver. I believe having the same message coming on every thermal zone makes more sense. However, I did not remove the .notify() callback, and it should behave the same. BR, Eduardo Valentin (3): thermal: setup monitor only once after handling trips thermal: rework core to allow emul_temp to be treated as regular temp thermal: improve hot trip handling drivers/thermal/thermal_core.c | 96 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 18 deletions(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Eduardo Valentin <edubezval@gmail.com> |
|---|---|
| Date | 2015-12-16 04:50 +0100 |
| Subject | [PATCH 3/3] thermal: improve hot trip handling |
| Message-ID | <qGbgd-4UV-13@gated-at.bofh.it> |
| In reply to | #1292734 |
The idea is to add the choice to be notified only when temperature
crosses trip points. The trip points affected are the non-passive
trip points.
It will check last temperature and current temperature against
the trip point temperature and its hysteresis.
In case the check shows temperature has changed enought indicating
a trip point crossing, a uevent will be sent to userspace.
The uevent contains the thermal zone type, the current temperature,
the last temperature and the trip point in which the current temperature
now resides.
The behavior of ops->notify() callback remains the same.
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/thermal_core.c | 52 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index f826589..924cccf 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -423,6 +423,56 @@ static void handle_non_critical_trips(struct thermal_zone_device *tz,
def_governor->throttle(tz, trip);
}
+static void thermal_tripped_notify(struct thermal_zone_device *tz,
+ int trip, enum thermal_trip_type trip_type,
+ int trip_temp)
+{
+ char tuv_name[THERMAL_NAME_LENGTH + 15], tuv_temp[25],
+ tuv_ltemp[25], tuv_trip[25], tuv_type[25];
+ char *msg[6] = { tuv_name, tuv_temp, tuv_ltemp, tuv_trip, tuv_type,
+ NULL };
+ int upper_trip_hyst, upper_trip_temp, trip_hyst = 0;
+ int ret = 0;
+
+ snprintf(tuv_name, sizeof(tuv_name), "THERMAL_ZONE=%s", tz->type);
+ snprintf(tuv_temp, sizeof(tuv_temp), "TEMP=%d", tz->temperature);
+ snprintf(tuv_ltemp, sizeof(tuv_ltemp), "LAST_TEMP=%d",
+ tz->last_temperature);
+ snprintf(tuv_trip, sizeof(tuv_trip), "TRIP=%d", trip);
+ snprintf(tuv_type, sizeof(tuv_type), "TRIP_TYPE=%d", trip_type);
+
+ mutex_lock(&tz->lock);
+
+ /* crossing up */
+ if (tz->last_temperature < trip_temp && trip_temp < tz->temperature)
+ kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, msg);
+
+ if (tz->ops->get_trip_hyst)
+ tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
+
+ /* crossing down, check for hyst */
+ trip_temp -= trip_hyst;
+ if (tz->last_temperature > trip_temp && trip_temp > tz->temperature) {
+ snprintf(tuv_trip, sizeof(tuv_trip), "TRIP=%d", trip - 1);
+ kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, msg);
+ }
+
+ ret = tz->ops->get_trip_temp(tz, trip + 1, &upper_trip_temp);
+ if (ret)
+ goto unlock;
+
+ if (tz->ops->get_trip_hyst)
+ tz->ops->get_trip_hyst(tz, trip + 1, &upper_trip_hyst);
+
+ upper_trip_temp -= upper_trip_hyst;
+ if (tz->last_temperature > upper_trip_temp &&
+ upper_trip_temp > tz->temperature)
+ kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, msg);
+
+unlock:
+ mutex_unlock(&tz->lock);
+}
+
static void handle_critical_trips(struct thermal_zone_device *tz,
int trip, enum thermal_trip_type trip_type)
{
@@ -430,6 +480,8 @@ static void handle_critical_trips(struct thermal_zone_device *tz,
tz->ops->get_trip_temp(tz, trip, &trip_temp);
+ thermal_tripped_notify(tz, trip, trip_type, trip_temp);
+
/* If we have not crossed the trip_temp, we do not care. */
if (trip_temp <= 0 || tz->temperature < trip_temp)
return;
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Eduardo Valentin <edubezval@gmail.com> |
|---|---|
| Date | 2015-12-16 04:50 +0100 |
| Subject | [PATCHv2 1/3] thermal: setup monitor only once after handling trips |
| Message-ID | <qGbge-4UV-19@gated-at.bofh.it> |
| In reply to | #1292734 |
Instead of changing the monitoring setup every time after handling each trip, this patch simplifies the monitoring setup by moving the setup call to a place where all trips have been treated already. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> --- V1->V2: fixed typo --- drivers/thermal/thermal_core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d9e525c..8fa82c0 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -457,11 +457,6 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) handle_critical_trips(tz, trip, type); else handle_non_critical_trips(tz, trip, type); - /* - * Alright, we handled this trip successfully. - * So, start monitoring again. - */ - monitor_thermal_zone(tz); } /** @@ -547,6 +542,12 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) for (count = 0; count < tz->trips; count++) handle_thermal_trip(tz, count); + + /* + * Alright, we handled these trips successfully. + * So, start monitoring again. + */ + monitor_thermal_zone(tz); } EXPORT_SYMBOL_GPL(thermal_zone_device_update); -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com> |
|---|---|
| Date | 2015-12-17 00:50 +0100 |
| Subject | Re: [PATCHv2 1/3] thermal: setup monitor only once after handling trips |
| Message-ID | <qGtZv-8qx-1@gated-at.bofh.it> |
| In reply to | #1292740 |
T24gVHVlLCAyMDE1LTEyLTE1IGF0IDE5OjQ5IC0wODAwL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QEAgLTQ1NywxMSArNDU3LDYgQEAgc3RhdGljIHZv aWQgaGFuZGxlX3RoZXJtYWxfdHJpcChzdHJ1Y3QgdGhlcm1hbF96b25lX2RldmljZSAqdHosIGlu dCB0cmlwKQ0KPiAgCQloYW5kbGVfY3JpdGljYWxfdHJpcHModHosIHRyaXAsIHR5cGUpOw0KPiAg CWVsc2UNCj4gIAkJaGFuZGxlX25vbl9jcml0aWNhbF90cmlwcyh0eiwgdHJpcCwgdHlwZSk7DQo+ IC0JLyoNCj4gLQkgKiBBbHJpZ2h0LCB3ZSBoYW5kbGVkIHRoaXMgdHJpcCBzdWNjZXNzZnVsbHku DQo+IC0JICogU28sIHN0YXJ0IG1vbml0b3JpbmcgYWdhaW4uDQo+IC0JICovDQo+IC0JbW9uaXRv cl90aGVybWFsX3pvbmUodHopOw0KPiAgfQ0KPiAgDQo+ICAvKioNCj4gQEAgLTU0Nyw2ICs1NDIs MTIgQEAgdm9pZCB0aGVybWFsX3pvbmVfZGV2aWNlX3VwZGF0ZShzdHJ1Y3QgdGhlcm1hbF96b25l X2RldmljZSAqdHopDQo+ICANCj4gIAlmb3IgKGNvdW50ID0gMDsgY291bnQgPCB0ei0+dHJpcHM7 IGNvdW50KyspDQo+ICAJCWhhbmRsZV90aGVybWFsX3RyaXAodHosIGNvdW50KTsNCj4gKw0KPiAr CS8qDQo+ICsJICogQWxyaWdodCwgd2UgaGFuZGxlZCB0aGVzZSB0cmlwcyBzdWNjZXNzZnVsbHku DQo+ICsJICogU28sIHN0YXJ0IG1vbml0b3JpbmcgYWdhaW4uDQo+ICsJICovDQo+ICsJbW9uaXRv cl90aGVybWFsX3pvbmUodHopOw0KPiAgfQ0KPiAgRVhQT1JUX1NZTUJPTF9HUEwodGhlcm1hbF96 b25lX2RldmljZV91cGRhdGUpOw0KPiAgDQoNCg== -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web