<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/cpufreq, branch v4.2.8</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>cpufreq: intel_pstate: Fix divide by zero on Knights Landing (KNL)</title>
<updated>2015-11-09T22:37:39+00:00</updated>
<author>
<name>Srinivas Pandruvada</name>
<email>srinivas.pandruvada@linux.intel.com</email>
</author>
<published>2015-10-15T19:34:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a7e19859f9fd6eb9e5a11e5645fe42082df40d8a'/>
<id>a7e19859f9fd6eb9e5a11e5645fe42082df40d8a</id>
<content type='text'>
commit 8e601a9f97a00bab031980de34f9a81891c1f82f upstream.

This is a workaround for KNL platform, where in some cases MPERF counter
will not have updated value before next read of MSR_IA32_MPERF. In this
case divide by zero will occur. This change ignores current sample for
busy calculation in this case.

Fixes: b34ef932d79a (intel_pstate: Knights Landing support)
Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Acked-by: Kristen Carlson Accardi &lt;kristen@linux.intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 8e601a9f97a00bab031980de34f9a81891c1f82f upstream.

This is a workaround for KNL platform, where in some cases MPERF counter
will not have updated value before next read of MSR_IA32_MPERF. In this
case divide by zero will occur. This change ignores current sample for
busy calculation in this case.

Fixes: b34ef932d79a (intel_pstate: Knights Landing support)
Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Acked-by: Kristen Carlson Accardi &lt;kristen@linux.intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: acpi_cpufreq: prevent crash on reading freqdomain_cpus</title>
<updated>2015-10-22T21:49:33+00:00</updated>
<author>
<name>Srinivas Pandruvada</name>
<email>srinivas.pandruvada@linux.intel.com</email>
</author>
<published>2015-10-07T20:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d1d5bed4a28ed09ddb731a7767fa111f856888cd'/>
<id>d1d5bed4a28ed09ddb731a7767fa111f856888cd</id>
<content type='text'>
commit e25303676e18a7947185a34e26dd08cf0c0ea573 upstream.

When freqdomain_cpus attribute is read from an offlined cpu, it will
cause crash. This change prevents calling cpufreq_show_cpus when
policy driver_data is NULL.

Crash info:

[  170.814949] BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
[  170.814990] IP: [&lt;ffffffff813b2490&gt;] _find_next_bit.part.0+0x10/0x70
[  170.815021] PGD 227d30067 PUD 229e56067 PMD 0
[  170.815043] Oops: 0000 [#2] SMP
[  170.816022] CPU: 3 PID: 3121 Comm: cat Tainted: G      D    OE   4.3.0-rc3+ #33
...
...
[  170.816657] Call Trace:
[  170.816672]  [&lt;ffffffff813b2505&gt;] ? find_next_bit+0x15/0x20
[  170.816696]  [&lt;ffffffff8160e47c&gt;] cpufreq_show_cpus+0x5c/0xd0
[  170.816722]  [&lt;ffffffffa031a409&gt;] show_freqdomain_cpus+0x19/0x20 [acpi_cpufreq]
[  170.816749]  [&lt;ffffffff8160e65b&gt;] show+0x3b/0x60
[  170.816769]  [&lt;ffffffff8129b31c&gt;] sysfs_kf_seq_show+0xbc/0x130
[  170.816793]  [&lt;ffffffff81299be3&gt;] kernfs_seq_show+0x23/0x30
[  170.816816]  [&lt;ffffffff81240f2c&gt;] seq_read+0xec/0x390
[  170.816837]  [&lt;ffffffff8129a64a&gt;] kernfs_fop_read+0x10a/0x160
[  170.816861]  [&lt;ffffffff8121d9b7&gt;] __vfs_read+0x37/0x100
[  170.816883]  [&lt;ffffffff813217c0&gt;] ? security_file_permission+0xa0/0xc0
[  170.816909]  [&lt;ffffffff8121e2e3&gt;] vfs_read+0x83/0x130
[  170.816930]  [&lt;ffffffff8121f035&gt;] SyS_read+0x55/0xc0
...
...
[  170.817185] ---[ end trace bc6eadf82b2b965a ]---

Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit e25303676e18a7947185a34e26dd08cf0c0ea573 upstream.

When freqdomain_cpus attribute is read from an offlined cpu, it will
cause crash. This change prevents calling cpufreq_show_cpus when
policy driver_data is NULL.

Crash info:

[  170.814949] BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
[  170.814990] IP: [&lt;ffffffff813b2490&gt;] _find_next_bit.part.0+0x10/0x70
[  170.815021] PGD 227d30067 PUD 229e56067 PMD 0
[  170.815043] Oops: 0000 [#2] SMP
[  170.816022] CPU: 3 PID: 3121 Comm: cat Tainted: G      D    OE   4.3.0-rc3+ #33
...
...
[  170.816657] Call Trace:
[  170.816672]  [&lt;ffffffff813b2505&gt;] ? find_next_bit+0x15/0x20
[  170.816696]  [&lt;ffffffff8160e47c&gt;] cpufreq_show_cpus+0x5c/0xd0
[  170.816722]  [&lt;ffffffffa031a409&gt;] show_freqdomain_cpus+0x19/0x20 [acpi_cpufreq]
[  170.816749]  [&lt;ffffffff8160e65b&gt;] show+0x3b/0x60
[  170.816769]  [&lt;ffffffff8129b31c&gt;] sysfs_kf_seq_show+0xbc/0x130
[  170.816793]  [&lt;ffffffff81299be3&gt;] kernfs_seq_show+0x23/0x30
[  170.816816]  [&lt;ffffffff81240f2c&gt;] seq_read+0xec/0x390
[  170.816837]  [&lt;ffffffff8129a64a&gt;] kernfs_fop_read+0x10a/0x160
[  170.816861]  [&lt;ffffffff8121d9b7&gt;] __vfs_read+0x37/0x100
[  170.816883]  [&lt;ffffffff813217c0&gt;] ? security_file_permission+0xa0/0xc0
[  170.816909]  [&lt;ffffffff8121e2e3&gt;] vfs_read+0x83/0x130
[  170.816930]  [&lt;ffffffff8121f035&gt;] SyS_read+0x55/0xc0
...
...
[  170.817185] ---[ end trace bc6eadf82b2b965a ]---

Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: dt: Tolerance applies on both sides of target voltage</title>
<updated>2015-10-22T21:49:30+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2015-09-02T09:06:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=891aa8f203372989ae10335f592ac2c794daab12'/>
<id>891aa8f203372989ae10335f592ac2c794daab12</id>
<content type='text'>
commit a2022001cebd0825b96aa0f3345ea3ad44ae79d4 upstream.

Tolerance applies on both sides of the target voltage, i.e. both min and
max sides. But while checking if a voltage is supported by the regulator
or not, we haven't taken care of tolerance on the lower side. Fix that.

Cc: Lucas Stach &lt;l.stach@pengutronix.de&gt;
Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs")
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Lucas Stach &lt;l.stach@pengutronix.de&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit a2022001cebd0825b96aa0f3345ea3ad44ae79d4 upstream.

Tolerance applies on both sides of the target voltage, i.e. both min and
max sides. But while checking if a voltage is supported by the regulator
or not, we haven't taken care of tolerance on the lower side. Fix that.

Cc: Lucas Stach &lt;l.stach@pengutronix.de&gt;
Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs")
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Lucas Stach &lt;l.stach@pengutronix.de&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: exynos: Fix for memory leak in case SoC name does not match</title>
<updated>2015-08-14T09:33:47+00:00</updated>
<author>
<name>Shailendra Verma</name>
<email>shailendra.capricorn@gmail.com</email>
</author>
<published>2015-08-04T07:45:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=62c3f2fddd438d6d8d0a3cbb195637b74c3654eb'/>
<id>62c3f2fddd438d6d8d0a3cbb195637b74c3654eb</id>
<content type='text'>
During probe free the memory allocated to "exynos_info" in case of
unknown SoC type.

Signed-off-by: Shailendra Verma &lt;shailendra.capricorn@gmail.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Acked-by: Lukasz Majewski &lt;l.majewski@samsung.com&gt;
[k.kozlowski: Rebased the patch around if(of_machine_is_compatible)]
Signed-off-by: Krzysztof Kozlowski &lt;k.kozlowski@samsung.com&gt;
Signed-off-by: Kukjin Kim &lt;kgene@kernel.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
During probe free the memory allocated to "exynos_info" in case of
unknown SoC type.

Signed-off-by: Shailendra Verma &lt;shailendra.capricorn@gmail.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Acked-by: Lukasz Majewski &lt;l.majewski@samsung.com&gt;
[k.kozlowski: Rebased the patch around if(of_machine_is_compatible)]
Signed-off-by: Krzysztof Kozlowski &lt;k.kozlowski@samsung.com&gt;
Signed-off-by: Kukjin Kim &lt;kgene@kernel.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>CPUFREQ: Loongson2: Fix broken build due to incorrect include.</title>
<updated>2015-08-03T07:24:59+00:00</updated>
<author>
<name>Ralf Baechle</name>
<email>ralf@linux-mips.org</email>
</author>
<published>2015-07-19T21:27:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9b2b6f7f357d9a2473017295bb26ff907e149d34'/>
<id>9b2b6f7f357d9a2473017295bb26ff907e149d34</id>
<content type='text'>
71eeedcf51544831ae356a773814401143ed32d4 (MIPS: Lemote 2F: Fix build caused
by recent mass rename.) only fixed one instance of this issue in arch/mips
but missed a 2nd one in drivers/cpufreq/loongson2_cpufreq.c.

[ralf@linux-mips.org: dropped the one segment for the already fixed
instance and changed the other avoiding an include &lt;path.h&gt; without a /
because that's generally is a bad idea.]

Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Patchwork: https://patchwork.linux-mips.org/patch/10659/
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
71eeedcf51544831ae356a773814401143ed32d4 (MIPS: Lemote 2F: Fix build caused
by recent mass rename.) only fixed one instance of this issue in arch/mips
but missed a 2nd one in drivers/cpufreq/loongson2_cpufreq.c.

[ralf@linux-mips.org: dropped the one segment for the already fixed
instance and changed the other avoiding an include &lt;path.h&gt; without a /
because that's generally is a bad idea.]

Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Patchwork: https://patchwork.linux-mips.org/patch/10659/
</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: Avoid attempts to create duplicate symbolic links</title>
<updated>2015-07-28T15:19:26+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2015-07-26T00:07:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=559ed40752dc63e68f9b9ad301b20e6a3fe5cf21'/>
<id>559ed40752dc63e68f9b9ad301b20e6a3fe5cf21</id>
<content type='text'>
After commit 87549141d516 (cpufreq: Stop migrating sysfs files on
hotplug) there is a problem with CPUs that share cpufreq policy
objects with other CPUs and are initially offline.

Say CPU1 shares a policy with CPU0 which is online and is registered
first.  As part of the registration process, cpufreq_add_dev() is
called for it.  It creates the policy object and a symbolic link
to it from the CPU1's sysfs directory.  If CPU1 is registered
subsequently and it is offline at that time, cpufreq_add_dev() will
attempt to create a symbolic link to the policy object for it, but
that link is present already, so a warning about that will be
triggered.

To avoid that warning, make cpufreq use an additional CPU mask
containing related CPUs that are actually present for each policy
object.  That mask is initialized when the policy object is populated
after its creation (for the first online CPU using it) and it includes
CPUs from the "policy CPUs" mask returned by the cpufreq driver's
-&gt;init() callback that are physically present at that time.  Symbolic
links to the policy are created only for the CPUs in that mask.

If cpufreq_add_dev() is invoked for an offline CPU, it checks the
new mask and only creates the symlink if the CPU was not in it (the
CPU is added to the mask at the same time).

In turn, cpufreq_remove_dev() drops the given CPU from the new mask,
removes its symlink to the policy object and returns, unless it is
the CPU owning the policy object.  In that case, the policy object
is moved to a new CPU's sysfs directory or deleted if the CPU being
removed was the last user of the policy.

While at it, notice that cpufreq_remove_dev() can't fail, because
its return value is ignored, so make it ignore return values from
__cpufreq_remove_dev_prepare() and __cpufreq_remove_dev_finish()
and prevent these functions from aborting on errors returned by
__cpufreq_governor().  Also drop the now unused sif argument from
them.

Fixes: 87549141d516 (cpufreq: Stop migrating sysfs files on hotplug)
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reported-and-tested-by: Russell King &lt;linux@arm.linux.org.uk&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
After commit 87549141d516 (cpufreq: Stop migrating sysfs files on
hotplug) there is a problem with CPUs that share cpufreq policy
objects with other CPUs and are initially offline.

Say CPU1 shares a policy with CPU0 which is online and is registered
first.  As part of the registration process, cpufreq_add_dev() is
called for it.  It creates the policy object and a symbolic link
to it from the CPU1's sysfs directory.  If CPU1 is registered
subsequently and it is offline at that time, cpufreq_add_dev() will
attempt to create a symbolic link to the policy object for it, but
that link is present already, so a warning about that will be
triggered.

To avoid that warning, make cpufreq use an additional CPU mask
containing related CPUs that are actually present for each policy
object.  That mask is initialized when the policy object is populated
after its creation (for the first online CPU using it) and it includes
CPUs from the "policy CPUs" mask returned by the cpufreq driver's
-&gt;init() callback that are physically present at that time.  Symbolic
links to the policy are created only for the CPUs in that mask.

If cpufreq_add_dev() is invoked for an offline CPU, it checks the
new mask and only creates the symlink if the CPU was not in it (the
CPU is added to the mask at the same time).

In turn, cpufreq_remove_dev() drops the given CPU from the new mask,
removes its symlink to the policy object and returns, unless it is
the CPU owning the policy object.  In that case, the policy object
is moved to a new CPU's sysfs directory or deleted if the CPU being
removed was the last user of the policy.

While at it, notice that cpufreq_remove_dev() can't fail, because
its return value is ignored, so make it ignore return values from
__cpufreq_remove_dev_prepare() and __cpufreq_remove_dev_finish()
and prevent these functions from aborting on errors returned by
__cpufreq_governor().  Also drop the now unused sif argument from
them.

Fixes: 87549141d516 (cpufreq: Stop migrating sysfs files on hotplug)
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reported-and-tested-by: Russell King &lt;linux@arm.linux.org.uk&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>intel_pstate: Add get_scaling cpu_defaults param to Knights Landing</title>
<updated>2015-07-26T23:59:43+00:00</updated>
<author>
<name>Lukasz Anaczkowski</name>
<email>lukasz.anaczkowski@intel.com</email>
</author>
<published>2015-07-21T08:41:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=69cefc273f942bd7bb347a02e8b5b738d5f6e6f3'/>
<id>69cefc273f942bd7bb347a02e8b5b738d5f6e6f3</id>
<content type='text'>
Scaling for Knights Landing is same as the default scaling (100000).
When Knigts Landing support was added to the pstate driver, this
parameter was omitted resulting in a kernel panic during boot.

Fixes: b34ef932d79a (intel_pstate: Knights Landing support)
Reported-by: Yasuaki Ishimatsu &lt;yishimat@redhat.com&gt;
Signed-off-by: Dasaratharaman Chandramouli &lt;dasaratharaman.chandramouli@intel.com&gt;
Signed-off-by: Lukasz Anaczkowski &lt;lukasz.anaczkowski@intel.com&gt;
Acked-by: Kristen Carlson Accardi &lt;kristen@linux.intel.com&gt;
Cc: 4.1+ &lt;stable@vger.kernel.org&gt; # 4.1+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Scaling for Knights Landing is same as the default scaling (100000).
When Knigts Landing support was added to the pstate driver, this
parameter was omitted resulting in a kernel panic during boot.

Fixes: b34ef932d79a (intel_pstate: Knights Landing support)
Reported-by: Yasuaki Ishimatsu &lt;yishimat@redhat.com&gt;
Signed-off-by: Dasaratharaman Chandramouli &lt;dasaratharaman.chandramouli@intel.com&gt;
Signed-off-by: Lukasz Anaczkowski &lt;lukasz.anaczkowski@intel.com&gt;
Acked-by: Kristen Carlson Accardi &lt;kristen@linux.intel.com&gt;
Cc: 4.1+ &lt;stable@vger.kernel.org&gt; # 4.1+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branches 'pm-cpuidle', 'pm-cpufreq' and 'acpi-resources'</title>
<updated>2015-07-16T21:47:19+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2015-07-16T21:47:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=17ffc8b083ac299ff798419d1887b7cdcd4ae4d2'/>
<id>17ffc8b083ac299ff798419d1887b7cdcd4ae4d2</id>
<content type='text'>
* pm-cpuidle:
  suspend-to-idle: Prevent RCU from complaining about tick_freeze()

* pm-cpufreq:
  cpufreq: Allow freq_table to be obtained for offline CPUs
  cpufreq: Initialize the governor again while restoring policy

* acpi-resources:
  ACPI / PCI: Fix regressions caused by resource_size_t overflow with 32-bit kernel
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* pm-cpuidle:
  suspend-to-idle: Prevent RCU from complaining about tick_freeze()

* pm-cpufreq:
  cpufreq: Allow freq_table to be obtained for offline CPUs
  cpufreq: Initialize the governor again while restoring policy

* acpi-resources:
  ACPI / PCI: Fix regressions caused by resource_size_t overflow with 32-bit kernel
</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: Allow freq_table to be obtained for offline CPUs</title>
<updated>2015-07-09T23:43:27+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2015-07-09T23:43:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5a31d594a9732a2fa2eb83b0c4dcba75da2dff5d'/>
<id>5a31d594a9732a2fa2eb83b0c4dcba75da2dff5d</id>
<content type='text'>
Users of freq table may want to access it for any CPU from
policy-&gt;related_cpus mask. One such user is cpu-cooling layer. It gets a
list of 'clip_cpus' (equivalent to policy-&gt;related_cpus) during
registration and tries to get freq_table for the first CPU of this mask.

If the CPU, for which it tries to fetch freq_table, is offline,
cpufreq_frequency_get_table() fails. This happens because it relies on
cpufreq_cpu_get_raw() for its functioning which returns policy only for
online CPUs.

The fix is to access the policy data structure for the given CPU
directly (which also returns a valid policy for offline CPUs), but the
policy itself has to be active (meaning that at least one CPU using it
is online) for the frequency table to be returned.

Because we will be using 'cpufreq_cpu_data' now, which is internal to
the cpufreq core, move cpufreq_frequency_get_table() to cpufreq.c.

Reported-and-tested-by: Pi-Cheng Chen &lt;pi-cheng.chen@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Users of freq table may want to access it for any CPU from
policy-&gt;related_cpus mask. One such user is cpu-cooling layer. It gets a
list of 'clip_cpus' (equivalent to policy-&gt;related_cpus) during
registration and tries to get freq_table for the first CPU of this mask.

If the CPU, for which it tries to fetch freq_table, is offline,
cpufreq_frequency_get_table() fails. This happens because it relies on
cpufreq_cpu_get_raw() for its functioning which returns policy only for
online CPUs.

The fix is to access the policy data structure for the given CPU
directly (which also returns a valid policy for offline CPUs), but the
policy itself has to be active (meaning that at least one CPU using it
is online) for the frequency table to be returned.

Because we will be using 'cpufreq_cpu_data' now, which is internal to
the cpufreq core, move cpufreq_frequency_get_table() to cpufreq.c.

Reported-and-tested-by: Pi-Cheng Chen &lt;pi-cheng.chen@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: Initialize the governor again while restoring policy</title>
<updated>2015-07-09T23:36:27+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2015-07-09T23:36:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=35afd02e30d6368073df604920c4ea7cddadf5d0'/>
<id>35afd02e30d6368073df604920c4ea7cddadf5d0</id>
<content type='text'>
When all CPUs of a policy are hot-unplugged, we EXIT the governor but
don't mark policy-&gt;governor as NULL. This was done in order to keep last
used governor's information intact in sysfs, while the CPUs are offline.

But we also need to clear policy-&gt;governor when restoring the policy.

Because policy-&gt;governor still points to the last governor while policy
is restored, following sequence of event happens:
 - cpufreq_init_policy() called while restoring policy
 - find_governor() matches last_governor string for present governors and
   returns last used governor's pointer, say ondemand. policy-&gt;governor
   already has the same address, unless the governor was removed in
   between.
 - cpufreq_set_policy() is called with both old/new policies governor set
   as ondemand.
 - Because governors matched, we skip governor initialization and return
   after calling __cpufreq_governor(CPUFREQ_GOV_LIMITS). Because the
   governor wasn't initialized for this policy, it returned -EBUSY.
 - cpufreq_init_policy() exits the policy on this error, but doesn't
   destroy it properly (should be fixed separately).
 - And so we enter a scenario where the policy isn't completely
   initialized but used.

Fix this by setting policy-&gt;governor to NULL while restoring the policy.

Reported-and-tested-by: Pi-Cheng Chen &lt;pi-cheng.chen@linaro.org&gt;
Reported-and-tested-by: "Jon Medhurst (Tixy)" &lt;tixy@linaro.org&gt;
Reported-and-tested-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Fixes: 18bf3a124ef8 (cpufreq: Mark policy-&gt;governor = NULL for inactive policies)
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When all CPUs of a policy are hot-unplugged, we EXIT the governor but
don't mark policy-&gt;governor as NULL. This was done in order to keep last
used governor's information intact in sysfs, while the CPUs are offline.

But we also need to clear policy-&gt;governor when restoring the policy.

Because policy-&gt;governor still points to the last governor while policy
is restored, following sequence of event happens:
 - cpufreq_init_policy() called while restoring policy
 - find_governor() matches last_governor string for present governors and
   returns last used governor's pointer, say ondemand. policy-&gt;governor
   already has the same address, unless the governor was removed in
   between.
 - cpufreq_set_policy() is called with both old/new policies governor set
   as ondemand.
 - Because governors matched, we skip governor initialization and return
   after calling __cpufreq_governor(CPUFREQ_GOV_LIMITS). Because the
   governor wasn't initialized for this policy, it returned -EBUSY.
 - cpufreq_init_policy() exits the policy on this error, but doesn't
   destroy it properly (should be fixed separately).
 - And so we enter a scenario where the policy isn't completely
   initialized but used.

Fix this by setting policy-&gt;governor to NULL while restoring the policy.

Reported-and-tested-by: Pi-Cheng Chen &lt;pi-cheng.chen@linaro.org&gt;
Reported-and-tested-by: "Jon Medhurst (Tixy)" &lt;tixy@linaro.org&gt;
Reported-and-tested-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Fixes: 18bf3a124ef8 (cpufreq: Mark policy-&gt;governor = NULL for inactive policies)
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
