lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 2 Jul 2024 11:29:42 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: Rob Herring <robh@...nel.org>
Cc: rafael@...nel.org, linux-pm@...r.kernel.org,
 Zhang Rui <rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>,
 Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
 <conor+dt@...nel.org>,
 "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
 <devicetree@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] thermal/core: Introduce user trip points

On 01/07/2024 18:26, Rob Herring wrote:
> On Thu, Jun 27, 2024 at 10:54:50AM +0200, Daniel Lezcano wrote:
>> Currently the thermal framework has 4 trip point types:
>>
>> - active : basically for fans (or anything requiring energy to cool
>>    down)
>>
>> - passive : a performance limiter
>>
>> - hot : for a last action before reaching critical
>>
>> - critical : a without return threshold leading to a system shutdown
>>
>> A thermal zone monitors the temperature regarding these trip
>> points. The old way to do that is actively polling the temperature
>> which is very bad for embedded systems, especially mobile and it is
>> even worse today as we can have more than fifty thermal zones. The
>> modern way is to rely on the driver to send an interrupt when the trip
>> points are crossed, so the system can sleep while the temperature
>> monitoring is offloaded to a dedicated hardware.
>>
>> However, the thermal aspect is also managed from userspace to protect
>> the user, especially tracking down the skin temperature sensor. The
>> logic is more complex than what we found in the kernel because it
>> needs multiple sources indicating the thermal situation of the entire
>> system.
>>
>> For this reason it needs to setup trip points at different levels in
>> order to get informed about what is going on with some thermal zones
>> when running some specific application.
>>
>> For instance, the skin temperature must be limited to 43°C on a long
>> run but can go to 48°C for 10 minutes, or 60°C for 1 minute.
>>
>> The thermal engine must then rely on trip points to monitor those
>> temperatures. Unfortunately, today there is only 'active' and
>> 'passive' trip points which has a specific meaning for the kernel, not
>> the userspace. That leads to hacks in different platforms for mobile
>> and embedded systems where 'active' trip points are used to send
>> notification to the userspace. This is obviously not right because
>> these trip are handled by the kernel.
>>
>> This patch introduces the 'user' trip point type where its semantic is
>> simple: do nothing at the kernel level, just send a notification to
>> the user space.
> 
> Sounds like OS behavior/policy though I guess the existing ones kind are
> too. Maybe we should have defined *what* action to take and then the OS
> could decide whether what actions to handle vs. pass it up a level.

Right

> Why can't userspace just ask to be notified at a trip point it
> defines?

Yes I think it is possible to create a netlink message to create a trip 
point which will return a trip id.

Rafael what do you think ?

> If we keep this in DT, perhaps 'notice' would be a better name that
> doesn't encode the OS architecture details.

[ ... ]

> BTW, can we decide what to do about 'trips' node being required or not?
> That's nearly the only DT warning left for some platforms.

A thermal zone is a combination of a sensor, a mitigation logic (user or 
kernel), hardware limits with trip points to activate the logic. Without 
trip points, this logic can not operate, consequently the thermal zone 
description is incomplete.

I guess those thermal zones are set to have the sensor exported in 
/sys/class/thermal, so the userspace can access the temperature.

However, existing thermal zone description should have at least a 'hot' 
trip point and a 'critical' trip point.

On the other hand, now that we are introducing the 'user' trip point, 
those thermal zone can exist without trip points because we can create 
them at any time from userspace.

So at the first glance, I would say we can drop the "required" 
constraint for the trip points in the thermal zone description.


>> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
>> ---
>>   .../devicetree/bindings/thermal/thermal-zones.yaml        | 1 +
> 
> Please make bindings a separate patch.
> 
>>   drivers/thermal/thermal_core.c                            | 8 ++++++++
>>   drivers/thermal/thermal_of.c                              | 1 +
>>   drivers/thermal/thermal_trace.h                           | 4 +++-
>>   drivers/thermal/thermal_trip.c                            | 1 +
>>   include/uapi/linux/thermal.h                              | 1 +
>>   6 files changed, 15 insertions(+), 1 deletion(-)
> 

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ