On 27/09/2021 13:22, Vadim Pasternak wrote:
Hi Daniel,
Thank you for quick reply.
quoted
-----Original Message-----
From: Daniel Lezcano <redacted>
Sent: Monday, September 27, 2021 1:42 PM
To: Vadim Pasternak <vadimp@nvidia.com>; rui.zhang@intel.com
Cc: <redacted>; <redacted>
Subject: Re: [PATCH thermal 1/1] thermal/core: Skip cooling device statistics
update for configuration operation
Hi Vadim,
On 27/09/2021 10:24, Vadim Pasternak wrote:
quoted
The thermal subsystem maintains a transition table between states that
is allocated according to the maximum state supported by the cooling
device.
When the table needs to be updated, the thermal subsystem does not
validate that the new state does not exceed the maximum state, leading
to out-of-bounds memory accesses [1].
Actually, thermal_cooling_device_stats_update() is called if the
set_cur_state is successful.
With a state greater than the max state, the set_cur_state should fail and
thermal_cooling_device_stats_update() is not called.
Perhaps the problem is in mlxsw_thermal_set_cur_state() ?
"mlxsw" thermal drivers has additional use of 'sysfs' 'cur_state' for
configuration purpose to limit minimum fan speed.
Fan speed minimum is enforced by setting 'cur_state' with value
exceeding actual fan speed maximum.
Yes, and that is the problem because the driver is doing weird things
with the cooling device state resulting in an abuse of the sysfs API and
conflicting with the thermal internals.
This feature provides ability to limit fan speed according to some
system wise considerations, like absence of some replaceable units
or high system ambient temperature, or some other factors which
indirectly impacts system airflow.
Is that a static thermal profile depending on the platform set by
userspace or something which can be changed dynamically at runtime via
eg. a daemon ?
For example, if cooling devices operates at cooling levels from 1 to 10
(1 for 10% fan speed, 10 for 100% fan speed), cooling device minimal
speed can be limited by setting 'cur_state' attribute through 'sysfs'
to the values from 'max_state' + 1 to 'max_state * 2' (from 11 to 20).
Following this example if value is set to 14 (40%) cooling levels vector
will be set to 4, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10 for setting device speed
cooling states respectively in 40, 40, 40, 40, 40, 50, 60. 70, 80, 90,
100 percent. And it limits cooling device to operate only at 40% speed
and above.
Maybe it would be worth adding earlier some dedicated 'cur_state_limit'
attribute for this feature, but it was not done.
We have another driver required this feature and one new we are
developing now, which require fan minim speed limit as well.
The use case is valid but I think the approach is wrong. Probably the
simplest thing to do is to set a low trip point with a minimal fan speed.
--
<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