<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/thermal/power_allocator.c, branch v4.9</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.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-08-08T02:57:39Z</updated>
<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: power_allocator: req_range multiplication should be a 64 bit type</title>
<updated>2016-04-20T23:22:45Z</updated>
<author>
<name>Javi Merino</name>
<email>javi.merino@arm.com</email>
</author>
<published>2016-04-06T18:30:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f9d038144a171d42e057143b247ff7a12a5b06f5'/>
<id>urn:sha1:f9d038144a171d42e057143b247ff7a12a5b06f5</id>
<content type='text'>
req_range is declared as a u64 to cope with overflows in the
multiplication of two u32.  As both req_power and power_range are u32,
we need to make sure the multiplication is done with u64 types.

Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
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: power_allocator: Use temperature reading from tz</title>
<updated>2015-11-12T18:47:24Z</updated>
<author>
<name>Kapileshwar Singh</name>
<email>kapileshwar.singh@arm.com</email>
</author>
<published>2015-10-13T11:30:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bb404db47b8a4ade8c85d13fb44908b0ee15483c'/>
<id>urn:sha1:bb404db47b8a4ade8c85d13fb44908b0ee15483c</id>
<content type='text'>
All thermal governors use the temperature value stored in
struct thermal_zone_device.

   thermal_zone_device-&gt;temperature

power_allocator governor should not deviate from this and use
the same.

Cc: Javi Merino &lt;javi.merino@arm.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Cc: Daniel Kurtz &lt;djkurtz@chromium.org&gt;
Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Cc: Sascha Hauer &lt;s.hauer@pengutronix.de&gt;
Cc: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Acked-by: Javi Merino &lt;javi.merino@arm.com&gt;
Reported-by: Sugumar Natarajan &lt;sugumar.natarajan@arm.com&gt;
Signed-off-by: Kapileshwar Singh &lt;kapileshwar.singh@arm.com&gt;
Signed-off-by: Eduardo Valentin &lt;edubezval@gmail.com&gt;
</content>
</entry>
<entry>
<title>remove abs64()</title>
<updated>2015-11-09T23:11:24Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2015-11-09T22:58:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=79211c8ed19c055ca105502c8733800d442a0ae6'/>
<id>urn:sha1:79211c8ed19c055ca105502c8733800d442a0ae6</id>
<content type='text'>
Switch everything to the new and more capable implementation of abs().
Mainly to give the new abs() a bit of a workout.

Cc: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Masami Hiramatsu &lt;masami.hiramatsu.pt@hitachi.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>thermal: avoid division by zero in power allocator</title>
<updated>2015-10-02T01:42:35Z</updated>
<author>
<name>Andrea Arcangeli</name>
<email>aarcange@redhat.com</email>
</author>
<published>2015-10-01T22:37:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=44241628bb207ec211bebd156aaf69470d90c209'/>
<id>urn:sha1:44241628bb207ec211bebd156aaf69470d90c209</id>
<content type='text'>
During boot I get a div by zero Oops regression starting in v4.3-rc3.

Signed-off-by: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Reviewed-by: Javi Merino &lt;javi.merino@arm.com&gt;
Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Cc: Daniel Kurtz &lt;djkurtz@chromium.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>thermal: power_allocator: exit early if there are no cooling devices</title>
<updated>2015-09-20T07:37:16Z</updated>
<author>
<name>Javi Merino</name>
<email>javi.merino@arm.com</email>
</author>
<published>2015-09-14T13:23:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=97584d1838b7e2545c3b10aacef3327fcaa9531b'/>
<id>urn:sha1:97584d1838b7e2545c3b10aacef3327fcaa9531b</id>
<content type='text'>
Don't waste cycles in the power allocator governor's throttle function
if there are no cooling devices and exit early.

This commit doesn't change any functionality, but should provide better
performance for the odd case of a thermal zone with trip points but
without cooling devices.

Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Reviewed-by: Daniel Kurtz &lt;djkurtz@chromium.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: power_allocator: don't require tzp to be present for the thermal zone</title>
<updated>2015-09-14T14:43:15Z</updated>
<author>
<name>Javi Merino</name>
<email>javi.merino@arm.com</email>
</author>
<published>2015-09-14T13:23:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f5cbb182586ea36c6ad0e90e3534d18a5e9af094'/>
<id>urn:sha1:f5cbb182586ea36c6ad0e90e3534d18a5e9af094</id>
<content type='text'>
Thermal zones created using thermal_zone_device_create() may not have
tzp.  As the governor gets its parameters from there, allocate it while
the governor is bound to the thermal zone so that it can operate in it.
In this case, tzp is freed when the thermal zone switches to another
governor.

Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Reviewed-by: Daniel Kurtz &lt;djkurtz@chromium.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: power_allocator: relax the requirement of two passive trip points</title>
<updated>2015-09-14T14:41:45Z</updated>
<author>
<name>Javi Merino</name>
<email>javi.merino@arm.com</email>
</author>
<published>2015-09-14T13:23:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8b7b390f805f09ff252351468a79ebabde1ab55a'/>
<id>urn:sha1:8b7b390f805f09ff252351468a79ebabde1ab55a</id>
<content type='text'>
The power allocator governor currently requires that the thermal zone
has at least two passive trip points.  If there aren't, the governor
refuses to bind to the thermal zone.

This commit relaxes that requirement.  Now the governor will bind to all
thermal zones regardless of how many trip points they have.

Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Reviewed-by: Daniel Kurtz &lt;djkurtz@chromium.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: power_allocator: relax the requirement of a sustainable_power in tzp</title>
<updated>2015-09-14T14:40:51Z</updated>
<author>
<name>Javi Merino</name>
<email>javi.merino@arm.com</email>
</author>
<published>2015-09-14T13:23:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e055bb0f9a6e5c09bedf41c2a5b881edbd7f2ed0'/>
<id>urn:sha1:e055bb0f9a6e5c09bedf41c2a5b881edbd7f2ed0</id>
<content type='text'>
The power allocator governor currently requires that a sustainable power
is passed as part of the thermal zone's thermal zone parameters.  If
that parameter is not provided, it doesn't register with the thermal
zone.

While this parameter is strongly recommended for optimal performance, it
doesn't need to be mandatory.  Relax the requirement and allow the
governor to bind to thermal zones that don't provide it by estimating it
from the cooling devices' power model.

Cc: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: Eduardo Valentin &lt;edubezval@gmail.com&gt;
Reviewed-by: Daniel Kurtz &lt;djkurtz@chromium.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>Merge branches 'thermal-core' and 'thermal-intel' of .git into next</title>
<updated>2015-09-02T02:08:02Z</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2015-09-02T02:08:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5a924a07f882e866f2337bf65048be357956691a'/>
<id>urn:sha1:5a924a07f882e866f2337bf65048be357956691a</id>
<content type='text'>
</content>
</entry>
</feed>
