<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/thermal/cpu_cooling.c, branch linux-4.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-09-27T01:38:17Z</updated>
<entry>
<title>thermal: cpu_cooling: Fix wrong comment call function name</title>
<updated>2016-09-27T01:38:17Z</updated>
<author>
<name>Hugh Kang</name>
</author>
<published>2016-09-07T00:35:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0744f1306f6b0ffc2c6bd68c1edf688b74fa8779'/>
<id>urn:sha1:0744f1306f6b0ffc2c6bd68c1edf688b74fa8779</id>
<content type='text'>
The last_load is updated not cpufreq_get_actual_power() function call
but cpufreq_get_requested_power() function call.

Signed-off-by: Inhyuk Kang &lt;hugh.kang@lge.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Acked-by: Javi Merino &lt;javi.merino@arm.com&gt;
Acked-by: Javi Merino &lt;javi.merino@arm.com&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: cpu_cooling: Fix NULL dereference in cpufreq_state2power</title>
<updated>2016-08-19T13:32:18Z</updated>
<author>
<name>Brendan Jackman</name>
</author>
<published>2016-08-17T15:14:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a305a4387acb01cecadeeea5151c049a022a1bfc'/>
<id>urn:sha1:a305a4387acb01cecadeeea5151c049a022a1bfc</id>
<content type='text'>
Currently all CPU cooling devices share a
`struct thermal_cooling_device_ops` instance. The thermal core uses the
presence of functions in this struct to determine if a cooling device
has a power model (see cdev_is_power_actor). cpu_cooling.c adds the
power model functions to the shared struct when a device is registered
with a power model.

Therefore, if a CPU cooling device is registered using
[of_]cpufreq_power_cooling_register, _all_ devices will be determined to
have a power model, including any registered with
[of_]cpufreq_cooling_register. This can result in cpufreq_state2power
being called on a device where dyn_power_table is NULL.

With this commit, instead of having a shared thermal_cooling_device_ops
which is mutated, we have two versions: one with the power functions and
one without.

Signed-off-by: Brendan Jackman &lt;brendan.jackman@arm.com&gt;
Cc: Amit Daniel Kachhap &lt;amit.kachhap@gmail.com&gt;
Cc: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Cc: Javi Merino &lt;javi.merino@arm.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Acked-by: Javi Merino &lt;javi.merino@arm.com&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>Merge back earlier cpufreq changes for v4.8.</title>
<updated>2016-06-13T21:33:17Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2016-06-13T21:33:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bb4b9933e2bc0554cf4db37aa07b19ff69a85f8f'/>
<id>urn:sha1:bb4b9933e2bc0554cf4db37aa07b19ff69a85f8f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>cpufreq: Remove cpufreq_frequency_get_table()</title>
<updated>2016-06-08T22:58:05Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2016-06-03T05:28:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f8bfc116cacbdf7e0e655d8a798a242087ed70a5'/>
<id>urn:sha1:f8bfc116cacbdf7e0e655d8a798a242087ed70a5</id>
<content type='text'>
Most of the callers of cpufreq_frequency_get_table() already have the
pointer to a valid 'policy' structure and they don't really need to go
through the per-cpu variable first and then a check to validate the
frequency, in order to find the freq-table for the policy.

Directly use the policy-&gt;freq_table field instead for them.

Only one user of that API is left after above changes, cpu_cooling.c and
it accesses the freq_table in a racy way as the policy can get freed in
between.

Fix it by using cpufreq_cpu_get() properly.

Since there are no more users of cpufreq_frequency_get_table() left, get
rid of it.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Acked-by: Javi Merino &lt;javi.merino@arm.com&gt; (cpu_cooling.c)
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: cpu_cooling: fix improper order during initialization</title>
<updated>2016-06-01T14:21:19Z</updated>
<author>
<name>Lukasz Luba</name>
</author>
<published>2016-05-31T10:32:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f840ab18bdf2e415dac21d09fbbbd2873111bd48'/>
<id>urn:sha1:f840ab18bdf2e415dac21d09fbbbd2873111bd48</id>
<content type='text'>
The freq_table array is not populated before calling
thermal_of_cooling_register. The code which populates the freq table was
introduced in commit f6859014.
This should be done before registering new thermal cooling device.
The log shows effects of this wrong decision.
[    2.172614] cpu cpu1: Failed to get voltage for frequency 1984518656000: -34
[    2.220863] cpu cpu0: Failed to get voltage for frequency 1984524416000: -34

Cc: &lt;stable@vger.kernel.org&gt; # 3.19+
Fixes: f6859014c7e7 ("thermal: cpu_cooling: Store frequencies in descending order")
Signed-off-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Acked-by: Javi Merino &lt;javi.merino@arm.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: cpu_cooling: fix out of bounds access in time_in_idle</title>
<updated>2016-02-11T15:13:29Z</updated>
<author>
<name>Javi Merino</name>
</author>
<published>2016-02-11T12:00:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a53b8394ec3c67255928df6ee9cc99dd1cd452e3'/>
<id>urn:sha1:a53b8394ec3c67255928df6ee9cc99dd1cd452e3</id>
<content type='text'>
In __cpufreq_cooling_register() we allocate the arrays for time_in_idle
and time_in_idle_timestamp to be as big as the number of cpus in this
cpufreq device.  However, in get_load() we access this array using the
cpu number as index, which can result in an out of bound access.

Index time_in_idle{,_timestamp} using the index in the cpufreq_device's
allowed_cpus mask, as we do for the load_cpu array in
cpufreq_get_requested_power()

Reported-by: Nicolas Boichat &lt;drinkcat@chromium.org&gt;
Cc: Amit Daniel Kachhap &lt;amit.kachhap@gmail.com&gt;
Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Tested-by: Nicolas Boichat &lt;drinkcat@chromium.org&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Javi Merino &lt;javi.merino@arm.com&gt;
Signed-off-by: Eduardo Valentin &lt;edubezval@gmail.com&gt;
</content>
</entry>
<entry>
<title>thermal: cpu_cooling: Remove usage of devm functions</title>
<updated>2015-10-10T03:32:21Z</updated>
<author>
<name>Vaishali Thakkar</name>
</author>
<published>2015-08-19T06:22:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a71544cd9373b879bbb40f55ce4d01556a4bc29e'/>
<id>urn:sha1:a71544cd9373b879bbb40f55ce4d01556a4bc29e</id>
<content type='text'>
In the function cpufreq_get_requested_power, the memory allocated
for load_cpu is live within the function only. And after the
allocation it is immediately freed with devm_kfree. There is no
need to allocate memory for load_cpu with devm function so replace
devm_kcalloc with kcalloc and devm_kfree with kfree.

Signed-off-by: Vaishali Thakkar &lt;vthakkar1994@gmail.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Acked-by: Javi Merino &lt;javi.merino@arm.com&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: cpu_cooling: free power table on error or when unregistering</title>
<updated>2015-09-14T03:34:05Z</updated>
<author>
<name>Javi Merino</name>
</author>
<published>2015-08-17T18:21:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eba4f88d5af84e0fcaa5d6eb4fe35a75c47203cb'/>
<id>urn:sha1:eba4f88d5af84e0fcaa5d6eb4fe35a75c47203cb</id>
<content type='text'>
The power table is not being freed on error from cpufreq_cooling
register or when unregistering.  Free it.

Fixes: c36cf0717631 ("thermal: cpu_cooling: implement the power cooling device API")
Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Signed-off-by: Javi Merino &lt;javi.merino@arm.com&gt;
Signed-off-by: Eduardo Valentin &lt;edubezval@gmail.com&gt;
</content>
</entry>
<entry>
<title>thermal: cpu_cooling: don't call kcalloc() under rcu_read_lock</title>
<updated>2015-09-14T03:33:17Z</updated>
<author>
<name>Javi Merino</name>
</author>
<published>2015-08-17T18:21:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=459ac37506d195713b5e82271a2ac44a777e47df'/>
<id>urn:sha1:459ac37506d195713b5e82271a2ac44a777e47df</id>
<content type='text'>
build_dyn_power_table() allocates the power table while holding
rcu_read_lock.  kcalloc using GFP_KERNEL may sleep, so it can't be
called in an RCU read-side path.

Move the rcu protection to the part of the function that really needs
it: the part that handles the dev_pm_opp pointer received from
dev_pm_opp_find_freq_ceil().  In the unlikely case that there is an OPP
added to the cpu while this function is running, return -EAGAIN.

Fixes: c36cf0717631 ("thermal: cpu_cooling: implement the power cooling device API")
Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Signed-off-by: Javi Merino &lt;javi.merino@arm.com&gt;
Signed-off-by: Eduardo Valentin &lt;edubezval@gmail.com&gt;
</content>
</entry>
<entry>
<title>thermal/cpu_cooling: update policy limits if clipped_freq &lt; policy-&gt;max</title>
<updated>2015-08-15T01:26:23Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2015-07-30T07:10:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1afb9c539daebc2c8a7b33d0e0b8fc9f74671b02'/>
<id>urn:sha1:1afb9c539daebc2c8a7b33d0e0b8fc9f74671b02</id>
<content type='text'>
policy-&gt;max is the maximum allowed frequency defined by user and
clipped_freq is the maximum that thermal constraints allow.

If clipped_freq is lower than policy-&gt;max, then we need to readjust
policy-&gt;max.

But, if clipped_freq is greater than policy-&gt;max, we don't need to do
anything. We used to call cpufreq_verify_within_limits() in this case,
but it doesn't change anything in this case.

Lets skip this unnecessary call and write a comment that explains this.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Eduardo Valentin &lt;edubezval@gmail.com&gt;
</content>
</entry>
</feed>
