<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/thermal, branch v4.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-09-06T12:46:06Z</updated>
<entry>
<title>thermal: rcar_thermal: Fix priv-&gt;zone error handling</title>
<updated>2016-09-06T12:46:06Z</updated>
<author>
<name>Dirk Behme</name>
<email>dirk.behme@de.bosch.com</email>
</author>
<published>2016-04-21T10:24:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=87260d3f7aecba9a5fadc6886c338b2a8fccfca9'/>
<id>urn:sha1:87260d3f7aecba9a5fadc6886c338b2a8fccfca9</id>
<content type='text'>
In case thermal_zone_xxx_register() returns an error, priv-&gt;zone
isn't NULL any more, but contains the error code.

This is passed to thermal_zone_device_unregister(), then. This checks
for priv-&gt;zone being NULL, but the error code is != NULL. So it works
with the error code as a pointer. Crashing immediately.

To fix this, reset priv-&gt;zone to NULL before entering
rcar_gen3_thermal_remove().

Signed-off-by: Dirk Behme &lt;dirk.behme@de.bosch.com&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: imx: fix a possible NULL dereference</title>
<updated>2016-08-19T13:34:08Z</updated>
<author>
<name>Corentin LABBE</name>
<email>clabbe.montjoie@gmail.com</email>
</author>
<published>2016-08-16T08:51:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=829bc78aa7628e81a9de717316b85cbee3c5eb86'/>
<id>urn:sha1:829bc78aa7628e81a9de717316b85cbee3c5eb86</id>
<content type='text'>
of_match_device could return NULL, and so cause a NULL pointer
dereference later at line 472:
data-&gt;socdata = of_id-&gt;data;

For fixing this problem, we use of_device_get_match_data(), this will
simplify the code a little by using a standard function for
getting the match data.

Reported-by: coverity (CID 1324128)
Signed-off-by: LABBE Corentin &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>Thermal-INT3406: Delete owner assignment</title>
<updated>2016-08-19T13:32:48Z</updated>
<author>
<name>Markus Elfring</name>
<email>elfring@users.sourceforge.net</email>
</author>
<published>2016-08-15T09:22:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=57027db00d1094d0abd5776899b00ca55d42d37c'/>
<id>urn:sha1:57027db00d1094d0abd5776899b00ca55d42d37c</id>
<content type='text'>
The field "owner" is set by core. Thus delete an extra initialisation.

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
Signed-off-by: Markus Elfring &lt;elfring@users.sourceforge.net&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>
<email>brendan.jackman@arm.com</email>
</author>
<published>2016-08-17T15:14:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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 branches 'thermal-intel' and 'thermal-core' into next</title>
<updated>2016-08-08T02:59:35Z</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2016-08-08T02:59:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1577ddfac75ff9690ebd0d210bc7f1345c9d29ef'/>
<id>urn:sha1:1577ddfac75ff9690ebd0d210bc7f1345c9d29ef</id>
<content type='text'>
</content>
</entry>
<entry>
<title>thermal: clock_cooling: Fix missing mutex_init()</title>
<updated>2016-08-08T02:57:39Z</updated>
<author>
<name>Wei Yongjun</name>
<email>weiyj.lk@gmail.com</email>
</author>
<published>2016-07-25T07:01:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=165989a5b667b90589f21c8affe496ad21f08591'/>
<id>urn:sha1:165989a5b667b90589f21c8affe496ad21f08591</id>
<content type='text'>
The driver allocates the mutex but not initialize it.
Use mutex_init() on it to initialize it correctly.

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun &lt;weiyj.lk@gmail.com&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: hwmon: EXPORT_SYMBOL_GPL for thermal hwmon sysfs</title>
<updated>2016-08-08T02:57:39Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2016-07-04T07:19:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f4c592439b144ef1de66eac764140643a54099eb'/>
<id>urn:sha1:f4c592439b144ef1de66eac764140643a54099eb</id>
<content type='text'>
thermal_add_hwmon_sysfs()/thermal_remove_hwmon_sysfs() need
EXPORT_SYMBOL_GPL(). Otherwise we will have ERROR

&gt;&gt; ERROR: "thermal_remove_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!
&gt;&gt; ERROR: "thermal_add_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: fix race condition when updating cooling device</title>
<updated>2016-08-08T02:57:39Z</updated>
<author>
<name>Michele Di Giorgio</name>
<email>michele.digiorgio@arm.com</email>
</author>
<published>2016-06-02T14:25:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d0b7306d203c82e7c04d6eb066ca4898f016ebdd'/>
<id>urn:sha1:d0b7306d203c82e7c04d6eb066ca4898f016ebdd</id>
<content type='text'>
When multiple thermal zones are bound to the same cooling device, multiple
kernel threads may want to update the cooling device state by calling
thermal_cdev_update(). Having cdev not protected by a mutex can lead to a race
condition. Consider the following situation with two kernel threads k1 and k2:

	    Thread k1				Thread k2
                                    ||
                                    ||  call thermal_cdev_update()
                                    ||      ...
                                    ||      set_cur_state(cdev, target);
    call power_actor_set_power()    ||
        ...                         ||
        instance-&gt;target = state;   ||
        cdev-&gt;updated = false;      ||
                                    ||      cdev-&gt;updated = true;
                                    ||      // completes execution
    call thermal_cdev_update()      ||
        // cdev-&gt;updated == true    ||
        return;                     ||
                                    \/
                                    time

k2 has already looped through the thermal instances looking for the deepest
cooling device state and is preempted right before setting cdev-&gt;updated to
true. Now, k1 runs, modifies the thermal instance state and sets cdev-&gt;updated
to false. Then, k1 is preempted and k2 continues the execution by setting
cdev-&gt;updated to true, therefore preventing k1 from performing the update.
Notice that this is not an issue if k2 looks at the instance-&gt;target modified by
k1 "after" it is assigned by k1. In fact, in this case the update will happen
anyway and k1 can safely return immediately from thermal_cdev_update().

This may lead to a situation where a thermal governor never updates the cooling
device. For example, this is the case for the step_wise governor: when calling
the function thermal_zone_trip_update(), the governor may always get a new state
equal to the old one (which, however, wasn't notified to the cooling device) and
will therefore skip the update.

CC: Zhang Rui &lt;rui.zhang@intel.com&gt;
CC: Eduardo Valentin &lt;edubezval@gmail.com&gt;
CC: Peter Feuerer &lt;peter@piie.net&gt;
Reported-by: Toby Huang &lt;toby.huang@arm.com&gt;
Signed-off-by: Michele Di Giorgio &lt;michele.digiorgio@arm.com&gt;
Reviewed-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/powerclamp: Prevent division by zero when counting interval</title>
<updated>2016-08-08T02:54:55Z</updated>
<author>
<name>Petr Mladek</name>
<email>pmladek@suse.com</email>
</author>
<published>2016-08-05T13:20:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=70c50ee72eebb3d1e3aae7450269fd8d8074c610'/>
<id>urn:sha1:70c50ee72eebb3d1e3aae7450269fd8d8074c610</id>
<content type='text'>
I have got a zero division error when disabling the forced
idle injection from the intel powerclamp. I did

  echo 0 &gt;/sys/class/thermal/cooling_device48/cur_state

and got

[  986.072632] divide error: 0000 [#1] PREEMPT SMP
[  986.078989] Modules linked in:
[  986.083618] CPU: 17 PID: 24967 Comm: kidle_inject/17 Not tainted 4.7.0-1-default+ #3055
[  986.093781] Hardware name: Intel Corporation S2600CP/S2600CP, BIOS RMLSDP.86I.R3.27.D685.1305151734 05/15/2013
[  986.106227] task: ffff880430e1c080 task.stack: ffff880427ef0000
[  986.114122] RIP: 0010:[&lt;ffffffff81794859&gt;]  [&lt;ffffffff81794859&gt;] clamp_thread+0x1d9/0x600
[  986.124609] RSP: 0018:ffff880427ef3e20  EFLAGS: 00010246
[  986.131860] RAX: 0000000000000258 RBX: 0000000000000006 RCX: 0000000000000001
[  986.141179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000018
[  986.150478] RBP: ffff880427ef3ec8 R08: ffff880427ef0000 R09: 0000000000000002
[  986.159779] R10: 0000000000003df2 R11: 0000000000000018 R12: 0000000000000002
[  986.169089] R13: 0000000000000000 R14: ffff880427ef0000 R15: ffff880427ef0000
[  986.178388] FS:  0000000000000000(0000) GS:ffff880435940000(0000) knlGS:0000000000000000
[  986.188785] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  986.196559] CR2: 00007f1d0caf0000 CR3: 0000000002006000 CR4: 00000000001406e0
[  986.205909] Stack:
[  986.209524]  ffff8802be897b00 ffff880430e1c080 0000000000000011 0000006a35959780
[  986.219236]  0000000000000011 ffff880427ef0008 0000000000000000 ffff8804359503d0
[  986.228966]  0000000100029d93 ffffffff81794140 0000000000000000 ffffffff05000011
[  986.238686] Call Trace:
[  986.242825]  [&lt;ffffffff81794140&gt;] ? pkg_state_counter+0x80/0x80
[  986.250866]  [&lt;ffffffff81794680&gt;] ? powerclamp_set_cur_state+0x180/0x180
[  986.259797]  [&lt;ffffffff8111d1a9&gt;] kthread+0xc9/0xe0
[  986.266682]  [&lt;ffffffff8193d69f&gt;] ret_from_fork+0x1f/0x40
[  986.274142]  [&lt;ffffffff8111d0e0&gt;] ? kthread_create_on_node+0x180/0x180
[  986.282869] Code: d1 ea 48 89 d6 80 3d 6a d0 d4 00 00 ba 64 00 00 00 89 d8 41 0f 45 f5 0f af c2 42 8d 14 2e be 31 00 00 00 83 fa 31 0f 42 f2 31 d2 &lt;f7&gt; f6 48 8b 15 9e 07 87 00 48 8b 3d 97 07 87 00 48 63 f0 83 e8
[  986.307806] RIP  [&lt;ffffffff81794859&gt;] clamp_thread+0x1d9/0x600
[  986.315871]  RSP &lt;ffff880427ef3e20&gt;

RIP points to the following lines:

	compensation = get_compensation(target_ratio);
	interval = duration_jiffies*100/(target_ratio+compensation);

A solution would be to switch the following two commands in
powerclamp_set_cur_state():

	set_target_ratio = 0;
	end_power_clamp();

But I think that the zero division might happen also when target_ratio
is non-zero because the compensation might be negative. Therefore
we also check the sum of target_ratio and compensation explicitly.

Also the compensated_ratio variable is always set. Therefore there
is no need to initialize it.

Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
Acked-by: Jacob Pan &lt;jacob.jun.pan@linux.intel.com&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: intel_pch_thermal: Add suspend/resume callback</title>
<updated>2016-08-08T02:54:55Z</updated>
<author>
<name>Srinivas Pandruvada</name>
<email>srinivas.pandruvada@linux.intel.com</email>
</author>
<published>2016-06-23T22:02:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=176b1ec21306f0775e6d7a03f42d82a0b144ef0e'/>
<id>urn:sha1:176b1ec21306f0775e6d7a03f42d82a0b144ef0e</id>
<content type='text'>
Added suspend/resume callback to disable/enable PCH thermal sensor
respectively. If the sensor is enabled by the BIOS, then the sensor status
will not be changed during suspend/resume.

Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
</feed>
