<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/cpufreq/cpufreq.c, branch linux-3.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-11-21T17:23:13Z</updated>
<entry>
<title>cpufreq: Avoid crash in resume on SMP without OPP</title>
<updated>2014-11-21T17:23:13Z</updated>
<author>
<name>Geert Uytterhoeven</name>
</author>
<published>2014-11-04T16:05:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=df424f3660e1b2aef66fc9263336ee33f46620af'/>
<id>urn:sha1:df424f3660e1b2aef66fc9263336ee33f46620af</id>
<content type='text'>
commit 09712f557b31838092e1f22a5f2dd131a843a3de upstream.

When resuming from s2ram on an SMP system without cpufreq operating
points (e.g. there's no "operating-points" property for the CPU node in
DT, or the platform doesn't use DT yet), the kernel crashes when
bringing CPU 1 online:

    Enabling non-boot CPUs ...
    CPU1: Booted secondary processor
    Unable to handle kernel NULL pointer dereference at virtual address 0000003c
    pgd = ee5e6b00
    [0000003c] *pgd=6e579003, *pmd=6e588003, *pte=00000000
    Internal error: Oops: a07 [#1] SMP ARM
    Modules linked in:
    CPU: 0 PID: 1246 Comm: s2ram Tainted: G        W      3.18.0-rc3-koelsch-01614-g0377af242bb175c8-dirty #589
    task: eeec5240 ti: ee704000 task.ti: ee704000
    PC is at __cpufreq_add_dev.isra.24+0x24c/0x77c
    LR is at __cpufreq_add_dev.isra.24+0x244/0x77c
    pc : [&lt;c0298efc&gt;]    lr : [&lt;c0298ef4&gt;]    psr: 60000153
    sp : ee705d48  ip : ee705d48  fp : ee705d84
    r10: c04e0450  r9 : 00000000  r8 : 00000001
    r7 : c05426a8  r6 : 00000001  r5 : 00000001  r4 : 00000000
    r3 : 00000000  r2 : 00000000  r1 : 20000153  r0 : c0542734

Verify that policy is not NULL before dereferencing it to fix this.

Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Fixes: 8414809c6a1e (cpufreq: Preserve policy structure across suspend/resume)
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>
</entry>
<entry>
<title>cpufreq: expose scaling_cur_freq sysfs file for set_policy() drivers</title>
<updated>2014-11-14T18:10:31Z</updated>
<author>
<name>Dirk Brandewie</name>
</author>
<published>2014-10-13T15:37:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b79ac56d6276d7ca7a5dc9da194138e4c3e18bd6'/>
<id>urn:sha1:b79ac56d6276d7ca7a5dc9da194138e4c3e18bd6</id>
<content type='text'>
commit c034b02e213d271b98c45c4a7b54af8f69aaac1e upstream.

Currently the core does not expose scaling_cur_freq for set_policy()
drivers this breaks some userspace monitoring tools.
Change the core to expose this file for all drivers and if the
set_policy() driver supports the get() callback use it to retrieve the
current frequency.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=73741
Signed-off-by: Dirk Brandewie &lt;dirk.j.brandewie@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>
</entry>
<entry>
<title>cpufreq: update 'cpufreq_suspended' after stopping governors</title>
<updated>2014-09-30T19:02:34Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2014-09-30T04:03:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b1b12babe3b72cfb08b875245e5a5d7c2747c772'/>
<id>urn:sha1:b1b12babe3b72cfb08b875245e5a5d7c2747c772</id>
<content type='text'>
Commit 8e30444e1530 ("cpufreq: fix cpufreq suspend/resume for intel_pstate")
introduced a bug where the governors wouldn't be stopped anymore for
-&gt;target{_index}() drivers during suspend. This happens because
'cpufreq_suspended' is updated before stopping the governors during suspend
and due to this __cpufreq_governor() would return early due to this check:

	/* Don't start any governor operations if we are entering suspend */
	if (cpufreq_suspended)
		return 0;

Fixes: 8e30444e1530 ("cpufreq: fix cpufreq suspend/resume for intel_pstate")
Cc: 3.15+ &lt;stable@vger.kernel.org&gt; # 3.15+: 8e30444e1530 "cpufreq: fix cpufreq suspend/resume for intel_pstate"
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>
</entry>
<entry>
<title>cpufreq: release policy-&gt;rwsem on error</title>
<updated>2014-09-22T12:32:43Z</updated>
<author>
<name>Prarit Bhargava</name>
</author>
<published>2014-09-10T14:12:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7106e02baed4a72fb23de56b02ad4d31daa74d95'/>
<id>urn:sha1:7106e02baed4a72fb23de56b02ad4d31daa74d95</id>
<content type='text'>
While debugging a cpufreq-related hardware failure on a system I saw the
following lockdep warning:

 =========================
 [ BUG: held lock freed! ] 3.17.0-rc4+ #1 Tainted: G            E
 -------------------------
 insmod/2247 is freeing memory ffff88006e1b1400-ffff88006e1b17ff, with a lock still held there!
  (&amp;policy-&gt;rwsem){+.+...}, at: [&lt;ffffffff8156d37d&gt;] __cpufreq_add_dev.isra.21+0x47d/0xb80
 3 locks held by insmod/2247:
  #0:  (subsys mutex#5){+.+.+.}, at: [&lt;ffffffff81485579&gt;] subsys_interface_register+0x69/0x120
  #1:  (cpufreq_rwsem){.+.+.+}, at: [&lt;ffffffff8156cf73&gt;] __cpufreq_add_dev.isra.21+0x73/0xb80
  #2:  (&amp;policy-&gt;rwsem){+.+...}, at: [&lt;ffffffff8156d37d&gt;] __cpufreq_add_dev.isra.21+0x47d/0xb80

 stack backtrace:
 CPU: 0 PID: 2247 Comm: insmod Tainted: G            E  3.17.0-rc4+ #1
 Hardware name: HP ProLiant MicroServer Gen8, BIOS J06 08/24/2013
  0000000000000000 000000008f3063c4 ffff88006f87bb30 ffffffff8171b358
  ffff88006bcf3750 ffff88006f87bb68 ffffffff810e09e1 ffff88006e1b1400
  ffffea0001b86c00 ffffffff8156d327 ffff880073003500 0000000000000246
 Call Trace:
  [&lt;ffffffff8171b358&gt;] dump_stack+0x4d/0x66
  [&lt;ffffffff810e09e1&gt;] debug_check_no_locks_freed+0x171/0x180
  [&lt;ffffffff8156d327&gt;] ? __cpufreq_add_dev.isra.21+0x427/0xb80
  [&lt;ffffffff8121412b&gt;] kfree+0xab/0x2b0
  [&lt;ffffffff8156d327&gt;] __cpufreq_add_dev.isra.21+0x427/0xb80
  [&lt;ffffffff81724cf7&gt;] ? _raw_spin_unlock+0x27/0x40
  [&lt;ffffffffa003517f&gt;] ? pcc_cpufreq_do_osc+0x17f/0x17f [pcc_cpufreq]
  [&lt;ffffffff8156da8e&gt;] cpufreq_add_dev+0xe/0x10
  [&lt;ffffffff814855d1&gt;] subsys_interface_register+0xc1/0x120
  [&lt;ffffffff8156bcf2&gt;] cpufreq_register_driver+0x112/0x340
  [&lt;ffffffff8121415a&gt;] ? kfree+0xda/0x2b0
  [&lt;ffffffffa003517f&gt;] ? pcc_cpufreq_do_osc+0x17f/0x17f [pcc_cpufreq]
  [&lt;ffffffffa003562e&gt;] pcc_cpufreq_init+0x4af/0xe81 [pcc_cpufreq]
  [&lt;ffffffffa003517f&gt;] ? pcc_cpufreq_do_osc+0x17f/0x17f [pcc_cpufreq]
  [&lt;ffffffff81002144&gt;] do_one_initcall+0xd4/0x210
  [&lt;ffffffff811f7472&gt;] ? __vunmap+0xd2/0x120
  [&lt;ffffffff81127155&gt;] load_module+0x1315/0x1b70
  [&lt;ffffffff811222a0&gt;] ? store_uevent+0x70/0x70
  [&lt;ffffffff811229d9&gt;] ? copy_module_from_fd.isra.44+0x129/0x180
  [&lt;ffffffff81127b86&gt;] SyS_finit_module+0xa6/0xd0
  [&lt;ffffffff81725b69&gt;] system_call_fastpath+0x16/0x1b
 cpufreq: __cpufreq_add_dev: -&gt;get() failed
insmod: ERROR: could not insert module pcc-cpufreq.ko: No such device

The warning occurs in the __cpufreq_add_dev() code which does

        down_write(&amp;policy-&gt;rwsem);
	...
        if (cpufreq_driver-&gt;get &amp;&amp; !cpufreq_driver-&gt;setpolicy) {
                policy-&gt;cur = cpufreq_driver-&gt;get(policy-&gt;cpu);
                if (!policy-&gt;cur) {
                        pr_err("%s: -&gt;get() failed\n", __func__);
                        goto err_get_freq;
                }

If cpufreq_driver-&gt;get(policy-&gt;cpu) returns an error we execute the
code at err_get_freq, which does not up the policy-&gt;rwsem.  This causes
the lockdep warning.

Trivial patch to up the policy-&gt;rwsem in the error path.

After the patch has been applied, and an error occurs in the
cpufreq_driver-&gt;get(policy-&gt;cpu) call we will now see

cpufreq: __cpufreq_add_dev: -&gt;get() failed
cpufreq: __cpufreq_add_dev: -&gt;get() failed
modprobe: ERROR: could not insert 'pcc_cpufreq': No such device

Fixes: 4e97b631f24c (cpufreq: Initialize governor for a new policy under policy-&gt;rwsem)
Signed-off-by: Prarit Bhargava &lt;prarit@redhat.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Cc: 3.14+ &lt;stable@vger.kernel.org&gt; # 3.14+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: fix cpufreq suspend/resume for intel_pstate</title>
<updated>2014-09-22T12:23:18Z</updated>
<author>
<name>Lan Tianyu</name>
</author>
<published>2014-09-18T07:03:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8e30444e153008e8eb3e74cbcb7a865bfcfb04a0'/>
<id>urn:sha1:8e30444e153008e8eb3e74cbcb7a865bfcfb04a0</id>
<content type='text'>
Cpufreq core introduces cpufreq_suspended flag to let cpufreq sysfs nodes
across S2RAM/S2DISK. But the flag is only set in the cpufreq_suspend()
for cpufreq drivers which have target or target_index callback. This
skips intel_pstate driver. This patch is to set the flag before checking
target or target_index callback.

Fixes: 2f0aea936360 (cpufreq: suspend governors on system suspend/hibernate)
Signed-off-by: Lan Tianyu &lt;tianyu.lan@intel.com&gt;
Cc: 3.15+ &lt;stable@vger.kernel.org&gt; # 3.15+
[rjw: Subject]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: move policy kobj to update_policy_cpu()</title>
<updated>2014-07-21T11:43:20Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2014-07-17T05:18:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1bfb425b3b6bf30f5d4b851049b2057dce860bfd'/>
<id>urn:sha1:1bfb425b3b6bf30f5d4b851049b2057dce860bfd</id>
<content type='text'>
We are calling kobject_move() from two separate places currently and both these
places share another routine update_policy_cpu() which is handling everything
around updating policy-&gt;cpu. Moving ownership of policy-&gt;kobj also lies under
the role of update_policy_cpu() routine and must be handled from there.

So, Lets move kobject_move() to update_policy_cpu() and get rid of
cpufreq_nominate_new_policy_cpu() as it doesn't have anything significant left.

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>
</entry>
<entry>
<title>cpufreq: propagate error returned by kobject_move()</title>
<updated>2014-07-21T11:43:20Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2014-07-17T05:18:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=41dfd908fc09e0e57f8f44fdcf543348cd5f249c'/>
<id>urn:sha1:41dfd908fc09e0e57f8f44fdcf543348cd5f249c</id>
<content type='text'>
We are returning -EINVAL instead of the error returned from kobject_move() when
it fails. Propagate the actual error number.

Also add a meaningful print when sysfs_create_link() fails.

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>
</entry>
<entry>
<title>cpufreq: don't restore policy-&gt;cpus on failure to move kobj</title>
<updated>2014-07-21T11:43:20Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2014-07-17T05:18:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1461dc7d1c252fbeb5baee0c94b5b28b7966e125'/>
<id>urn:sha1:1461dc7d1c252fbeb5baee0c94b5b28b7966e125</id>
<content type='text'>
While hot-unplugging policy-&gt;cpu, we call cpufreq_nominate_new_policy_cpu() to
nominate next owner of policy, i.e. policy-&gt;cpu. If we fail to move policy
kobject under the new policy-&gt;cpu, we try to update policy-&gt;cpus with the old
policy-&gt;cpu.

This would have been required in case old-CPU is removed from policy-&gt;cpus in
the first place. But its not done before calling
cpufreq_nominate_new_policy_cpu(), but during the POST_DEAD notification which
happens quite late in the hot-unplugging path.

So, this is just some useless code hanging around, get rid of it.

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>
</entry>
<entry>
<title>cpufreq: move policy kobj to policy-&gt;cpu at resume</title>
<updated>2014-07-17T12:23:22Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2014-07-17T05:18:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=92c14bd9477a20a83144f08c0ca25b0308bf0730'/>
<id>urn:sha1:92c14bd9477a20a83144f08c0ca25b0308bf0730</id>
<content type='text'>
This is only relevant to implementations with multiple clusters, where clusters
have separate clock lines but all CPUs within a cluster share it.

Consider a dual cluster platform with 2 cores per cluster. During suspend we
start hot unplugging CPUs in order 1 to 3. When CPU2 is removed, policy-&gt;kobj
would be moved to CPU3 and when CPU3 goes down we wouldn't free policy or its
kobj as we want to retain permissions/values/etc.

Now on resume, we will get CPU2 before CPU3 and will call __cpufreq_add_dev().
We will recover the old policy and update policy-&gt;cpu from 3 to 2 from
update_policy_cpu().

But the kobj is still tied to CPU3 and isn't moved to CPU2. We wouldn't create a
link for CPU2, but would try that for CPU3 while bringing it online. Which will
report errors as CPU3 already has kobj assigned to it.

This bug got introduced with commit 42f921a, which overlooked this scenario.

To fix this, lets move kobj to the new policy-&gt;cpu while bringing first CPU of a
cluster back. Also do a WARN_ON() if kobject_move failed, as we would reach here
only for the first CPU of a non-boot cluster. And we can't recover from this
situation, if kobject_move() fails.

Fixes: 42f921a6f10c (cpufreq: remove sysfs files for CPUs which failed to come back after resume)
Cc:  3.13+ &lt;stable@vger.kernel.org&gt; # 3.13+
Reported-and-tested-by: Bu Yitian &lt;ybu@qti.qualcomm.com&gt;
Reported-by: Saravana Kannan &lt;skannan@codeaurora.org&gt;
Reviewed-by: Srivatsa S. Bhat &lt;srivatsa@mit.edu&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>
</entry>
<entry>
<title>cpufreq: unlock when failing cpufreq_update_policy()</title>
<updated>2014-06-18T19:52:20Z</updated>
<author>
<name>Aaron Plattner</name>
</author>
<published>2014-06-18T18:27:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fefa8ff810c5ab4c4206aed9d159c4d6fe8d4f1c'/>
<id>urn:sha1:fefa8ff810c5ab4c4206aed9d159c4d6fe8d4f1c</id>
<content type='text'>
Commit bd0fa9bb455d introduced a failure path to cpufreq_update_policy() if
cpufreq_driver-&gt;get(cpu) returns NULL.  However, it jumps to the 'no_policy'
label, which exits without unlocking any of the locks the function acquired
earlier.  This causes later calls into cpufreq to hang.

Fix this by creating a new 'unlock' label and jumping to that instead.

Fixes: bd0fa9bb455d ("cpufreq: Return error if -&gt;get() failed in cpufreq_update_policy()")
Link: https://devtalk.nvidia.com/default/topic/751903/kernel-3-15-and-nv-drivers-337-340-failed-to-initialize-the-nvidia-kernel-module-gtx-550-ti-/
Signed-off-by: Aaron Plattner &lt;aplattner@nvidia.com&gt;
Cc: 3.15+ &lt;stable@vger.kernel.org&gt; # 3.15+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
</feed>
