<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/cpufreq, branch v3.14</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/cpufreq?h=v3.14</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/cpufreq?h=v3.14'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2014-03-12T23:37:16Z</updated>
<entry>
<title>cpufreq: Skip current frequency initialization for -&gt;setpolicy drivers</title>
<updated>2014-03-12T23:37:16Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2014-03-12T20:49:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2ed99e39cb9392312c100d9da591c20641c64d12'/>
<id>urn:sha1:2ed99e39cb9392312c100d9da591c20641c64d12</id>
<content type='text'>
After commit da60ce9f2fac (cpufreq: call cpufreq_driver-&gt;get() after
calling -&gt;init()) __cpufreq_add_dev() sometimes fails for CPUs handled
by intel_pstate, because that driver may return 0 from its -&gt;get()
callback if it has not run long enough to collect enough samples on the
given CPU.  That didn't happen before commit da60ce9f2fac which added
policy-&gt;cur initialization to __cpufreq_add_dev() to help reduce code
duplication in other cpufreq drivers.

However, the code added by commit da60ce9f2fac need not be executed
for cpufreq drivers having the -&gt;setpolicy callback defined, because
the subsequent invocation of cpufreq_set_policy() will use that
callback to initialize the policy anyway and it doesn't need
policy-&gt;cur to be initialized upfront.  The analogous code in
cpufreq_update_policy() is also unnecessary for cpufreq drivers
having -&gt;setpolicy set and may be skipped for them as well.

Since intel_pstate provides -&gt;setpolicy, skipping the upfront
policy-&gt;cur initialization for cpufreq drivers with that callback
set will cover intel_pstate and the problem it's been having after
commit da60ce9f2fac will be addressed.

Fixes: da60ce9f2fac (cpufreq: call cpufreq_driver-&gt;get() after calling -&gt;init())
References: https://bugzilla.kernel.org/show_bug.cgi?id=71931
Reported-and-tested-by: Patrik Lundquist &lt;patrik.lundquist@gmail.com&gt;
Acked-by: Dirk Brandewie &lt;dirk.j.brandewie@intel.com&gt;
Cc: 3.13+ &lt;stable@vger.kernel.org&gt; # 3.13+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: Initialize governor for a new policy under policy-&gt;rwsem</title>
<updated>2014-03-06T12:25:30Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2014-03-04T03:44:01Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4e97b631f24c927b2302368f4f83efbba82076ee'/>
<id>urn:sha1:4e97b631f24c927b2302368f4f83efbba82076ee</id>
<content type='text'>
policy-&gt;rwsem is used to lock access to all parts of code modifying
struct cpufreq_policy, but it's not used on a new policy created by
__cpufreq_add_dev().

Because of that, if cpufreq_update_policy() is called in a tight loop
on one CPU in parallel with offline/online of another CPU, then the
following crash can be triggered:

Unable to handle kernel NULL pointer dereference at virtual address 00000020
pgd = c0003000
[00000020] *pgd=80000000004003, *pmd=00000000
Internal error: Oops: 206 [#1] PREEMPT SMP ARM

PC is at __cpufreq_governor+0x10/0x1ac
LR is at cpufreq_update_policy+0x114/0x150

---[ end trace f23a8defea6cd706 ]---
Kernel panic - not syncing: Fatal exception
CPU0: stopping
CPU: 0 PID: 7136 Comm: mpdecision Tainted: G      D W    3.10.0-gd727407-00074-g979ede8 #396

[&lt;c0afe180&gt;] (notifier_call_chain+0x40/0x68) from [&lt;c02a23ac&gt;] (__blocking_notifier_call_chain+0x40/0x58)
[&lt;c02a23ac&gt;] (__blocking_notifier_call_chain+0x40/0x58) from [&lt;c02a23d8&gt;] (blocking_notifier_call_chain+0x14/0x1c)
[&lt;c02a23d8&gt;] (blocking_notifier_call_chain+0x14/0x1c) from [&lt;c0803c68&gt;] (cpufreq_set_policy+0xd4/0x2b8)
[&lt;c0803c68&gt;] (cpufreq_set_policy+0xd4/0x2b8) from [&lt;c0803e7c&gt;] (cpufreq_init_policy+0x30/0x98)
[&lt;c0803e7c&gt;] (cpufreq_init_policy+0x30/0x98) from [&lt;c0805a18&gt;] (__cpufreq_add_dev.isra.17+0x4dc/0x7a4)
[&lt;c0805a18&gt;] (__cpufreq_add_dev.isra.17+0x4dc/0x7a4) from [&lt;c0805d38&gt;] (cpufreq_cpu_callback+0x58/0x84)
[&lt;c0805d38&gt;] (cpufreq_cpu_callback+0x58/0x84) from [&lt;c0afe180&gt;] (notifier_call_chain+0x40/0x68)
[&lt;c0afe180&gt;] (notifier_call_chain+0x40/0x68) from [&lt;c02812dc&gt;] (__cpu_notify+0x28/0x44)
[&lt;c02812dc&gt;] (__cpu_notify+0x28/0x44) from [&lt;c0aeed90&gt;] (_cpu_up+0xf4/0x1dc)
[&lt;c0aeed90&gt;] (_cpu_up+0xf4/0x1dc) from [&lt;c0aeeed4&gt;] (cpu_up+0x5c/0x78)
[&lt;c0aeeed4&gt;] (cpu_up+0x5c/0x78) from [&lt;c0aec808&gt;] (store_online+0x44/0x74)
[&lt;c0aec808&gt;] (store_online+0x44/0x74) from [&lt;c03a40f4&gt;] (sysfs_write_file+0x108/0x14c)
[&lt;c03a40f4&gt;] (sysfs_write_file+0x108/0x14c) from [&lt;c03517d4&gt;] (vfs_write+0xd0/0x180)
[&lt;c03517d4&gt;] (vfs_write+0xd0/0x180) from [&lt;c0351ca8&gt;] (SyS_write+0x38/0x68)
[&lt;c0351ca8&gt;] (SyS_write+0x38/0x68) from [&lt;c0205de0&gt;] (ret_fast_syscall+0x0/0x30)

Fix that by taking locks at appropriate places in __cpufreq_add_dev()
as well.

Reported-by: Saravana Kannan &lt;skannan@codeaurora.org&gt;
Suggested-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: Initialize policy before making it available for others to use</title>
<updated>2014-03-06T12:25:29Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2014-03-04T03:44:00Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5a7e56a5d29071bcccd947dee6e3b9f8e4eb3309'/>
<id>urn:sha1:5a7e56a5d29071bcccd947dee6e3b9f8e4eb3309</id>
<content type='text'>
Policy must be fully initialized before it is being made available
for use by others. Otherwise cpufreq_cpu_get() would be able to grab
a half initialized policy structure that might not have affected_cpus
(for example) populated. Then, anybody accessing those fields will get
a wrong value and that will lead to unpredictable results.

In order to fix this, do all the necessary initialization before we
make the policy structure available via cpufreq_cpu_get(). That will
guarantee that any code accessing fields of the policy will get
correct data from them.

Reported-by: Saravana Kannan &lt;skannan@codeaurora.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: use cpufreq_cpu_get() to avoid cpufreq_get() race conditions</title>
<updated>2014-03-06T12:25:16Z</updated>
<author>
<name>Aaron Plattner</name>
<email>aplattner@nvidia.com</email>
</author>
<published>2014-03-04T20:42:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=999976e0f6233322a878b0b7148c810544d6c8a8'/>
<id>urn:sha1:999976e0f6233322a878b0b7148c810544d6c8a8</id>
<content type='text'>
If a module calls cpufreq_get while cpufreq is initializing, it's
possible for it to be called after cpufreq_driver is set but before
cpufreq_cpu_data is written during subsys_interface_register.  This
happens because cpufreq_get doesn't take the cpufreq_driver_lock
around its use of cpufreq_cpu_data.

Fix this by using cpufreq_cpu_get(cpu) to look up the policy rather
than reading it out of cpufreq_cpu_data directly.  cpufreq_cpu_get()
takes the appropriate locks to prevent this race from happening.

Since it's possible for policy to be NULL if the caller passes in an
invalid CPU number or calls the function before cpufreq is initialized,
delete the BUG_ON(!policy) and simply return 0.  Don't try to return
-ENOENT because that's negative and the function returns an unsigned
integer.

References: https://bbs.archlinux.org/viewtopic.php?id=177934
Signed-off-by: Aaron Plattner &lt;aplattner@nvidia.com&gt;
Cc: 3.13+ &lt;stable@vger.kernel.org&gt; # 3.13+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>intel_pstate: Change busy calculation to use fixed point math.</title>
<updated>2014-02-25T23:56:49Z</updated>
<author>
<name>Dirk Brandewie</name>
<email>dirk.j.brandewie@intel.com</email>
</author>
<published>2014-02-25T18:35:37Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e66c176837462928a05a135bbe16cdce70536d6e'/>
<id>urn:sha1:e66c176837462928a05a135bbe16cdce70536d6e</id>
<content type='text'>
Commit fcb6a15c2e (intel_pstate: Take core C0 time into account for
core busy calculation) introduced a regression on some processor SKUs
supported by intel_pstate. This was due to the truncation caused by
using integer math to calculate core busy and C0 percentages.

On a i7-4770K processor operating at 800Mhz going to 100% utilization
the percent busy of the CPU using integer math is 22%, but it actually
is 22.85%.  This value scaled to the current frequency returned 97
which the PID interpreted as no error and did not adjust the P state.

Tested on i7-4770K, i7-2600, i5-3230M.

Fixes: fcb6a15c2e7e (intel_pstate: Take core C0 time into account for core busy calculation)
References: https://lkml.org/lkml/2014/2/19/626
References: https://bugzilla.kernel.org/show_bug.cgi?id=70941
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;
</content>
</entry>
<entry>
<title>intel_pstate: Add support for Baytrail turbo P states</title>
<updated>2014-02-21T00:22:40Z</updated>
<author>
<name>Dirk Brandewie</name>
<email>dirk.j.brandewie@intel.com</email>
</author>
<published>2014-02-12T18:01:07Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=61d8d2abc15e9232c3914c55502b73e559366583'/>
<id>urn:sha1:61d8d2abc15e9232c3914c55502b73e559366583</id>
<content type='text'>
A documentation update exposed the existance of the turbo ratio
register. Update baytrail support to use the turbo range.

Signed-off-by: Dirk Brandewie &lt;dirk.j.brandewie@intel.com&gt;
Cc: 3.13+ &lt;stable@vger.kernel.org&gt; # 3.13+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>intel_pstate: Use LFM bus ratio as min ratio/P state</title>
<updated>2014-02-21T00:22:40Z</updated>
<author>
<name>Dirk Brandewie</name>
<email>dirk.j.brandewie@intel.com</email>
</author>
<published>2014-02-12T18:01:06Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4042e7570cff740460b75c6fc604c629621d3dd2'/>
<id>urn:sha1:4042e7570cff740460b75c6fc604c629621d3dd2</id>
<content type='text'>
LFM (max efficiency ratio) is the max frequency at minimum voltage
supported by the processor.  Using LFM as the minimum P state
increases performmance without affecting power. By not using P states
below LFM we avoid using P states that are less power efficient.

Signed-off-by: Dirk Brandewie &lt;dirk.j.brandewie@intel.com&gt;
Cc: 3.13+ &lt;stable@vger.kernel.org&gt; # 3.13+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: powernow-k8: Initialize per-cpu data-structures properly</title>
<updated>2014-02-19T00:04:56Z</updated>
<author>
<name>Srivatsa S. Bhat</name>
<email>srivatsa.bhat@linux.vnet.ibm.com</email>
</author>
<published>2014-02-17T10:48:21Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c3274763bfc3bf1ececa269ed6e6c4d7ec1c3e5e'/>
<id>urn:sha1:c3274763bfc3bf1ececa269ed6e6c4d7ec1c3e5e</id>
<content type='text'>
The powernow-k8 driver maintains a per-cpu data-structure called
powernow_data that is used to perform the frequency transitions.
It initializes this data structure only for the policy-&gt;cpu. So,
accesses to this data structure by other CPUs results in various
problems because they would have been uninitialized.

Specifically, if a cpu (!= policy-&gt;cpu) invokes the drivers' -&gt;get()
function, it returns 0 as the KHz value, since its per-cpu memory
doesn't point to anything valid. This causes problems during
suspend/resume since cpufreq_update_policy() tries to enforce this
(0 KHz) as the current frequency of the CPU, and this madness gets
propagated to adjust_jiffies() as well. Eventually, lots of things
start breaking down, including the r8169 ethernet card, in one
particularly interesting case reported by Pierre Ossman.

Fix this by initializing the per-cpu data-structures of all the CPUs
in the policy appropriately.

References: https://bugzilla.kernel.org/show_bug.cgi?id=70311
Reported-by: Pierre Ossman &lt;pierre@ossman.eu&gt;
Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Cc: All applicable &lt;stable@vger.kernel.org&gt;
Acked-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: remove sysfs link when a cpu != policy-&gt;cpu, is removed</title>
<updated>2014-02-19T00:04:40Z</updated>
<author>
<name>viresh kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2014-02-17T09:22:11Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6964d91db2becfe80658f50584d264708ca7f49e'/>
<id>urn:sha1:6964d91db2becfe80658f50584d264708ca7f49e</id>
<content type='text'>
Commit 42f921a (cpufreq: remove sysfs files for CPUs which failed to
come back after resume) tried to do this but missed this piece of code
to fix.

Currently we are getting this on suspend/resume:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
Modules linked in: brcmfmac brcmutil
CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12
[&lt;c0015bac&gt;] (unwind_backtrace) from [&lt;c0011850&gt;] (show_stack+0x10/0x14)
[&lt;c0011850&gt;] (show_stack) from [&lt;c056e018&gt;] (dump_stack+0x80/0xcc)
[&lt;c056e018&gt;] (dump_stack) from [&lt;c0025e44&gt;] (warn_slowpath_common+0x64/0x88)
[&lt;c0025e44&gt;] (warn_slowpath_common) from [&lt;c0025efc&gt;] (warn_slowpath_fmt+0x30/0x40)
[&lt;c0025efc&gt;] (warn_slowpath_fmt) from [&lt;c012776c&gt;] (sysfs_warn_dup+0x68/0x84)
[&lt;c012776c&gt;] (sysfs_warn_dup) from [&lt;c0127a54&gt;] (sysfs_do_create_link_sd+0xb0/0xb8)
[&lt;c0127a54&gt;] (sysfs_do_create_link_sd) from [&lt;c038ef64&gt;] (__cpufreq_add_dev.isra.27+0x2a8/0x814)
[&lt;c038ef64&gt;] (__cpufreq_add_dev.isra.27) from [&lt;c038f548&gt;] (cpufreq_cpu_callback+0x70/0x8c)
[&lt;c038f548&gt;] (cpufreq_cpu_callback) from [&lt;c0043864&gt;] (notifier_call_chain+0x44/0x84)
[&lt;c0043864&gt;] (notifier_call_chain) from [&lt;c0025f60&gt;] (__cpu_notify+0x28/0x44)
[&lt;c0025f60&gt;] (__cpu_notify) from [&lt;c00261e8&gt;] (_cpu_up+0xf0/0x140)
[&lt;c00261e8&gt;] (_cpu_up) from [&lt;c0569eb8&gt;] (enable_nonboot_cpus+0x68/0xb0)
[&lt;c0569eb8&gt;] (enable_nonboot_cpus) from [&lt;c006339c&gt;] (suspend_devices_and_enter+0x198/0x2dc)
[&lt;c006339c&gt;] (suspend_devices_and_enter) from [&lt;c0063654&gt;] (pm_suspend+0x174/0x1e8)
[&lt;c0063654&gt;] (pm_suspend) from [&lt;c00624e0&gt;] (state_store+0x6c/0xbc)
[&lt;c00624e0&gt;] (state_store) from [&lt;c01fc200&gt;] (kobj_attr_store+0x14/0x20)
[&lt;c01fc200&gt;] (kobj_attr_store) from [&lt;c0126e50&gt;] (sysfs_kf_write+0x44/0x48)
[&lt;c0126e50&gt;] (sysfs_kf_write) from [&lt;c012a274&gt;] (kernfs_fop_write+0xb4/0x14c)
[&lt;c012a274&gt;] (kernfs_fop_write) from [&lt;c00d4818&gt;] (vfs_write+0xa8/0x180)
[&lt;c00d4818&gt;] (vfs_write) from [&lt;c00d4bb8&gt;] (SyS_write+0x3c/0x70)
[&lt;c00d4bb8&gt;] (SyS_write) from [&lt;c000e620&gt;] (ret_fast_syscall+0x0/0x30)
---[ end trace 76969904b614c18f ]---

Fix this by removing sysfs link for cpufreq directory when cpu removed
isn't policy-&gt;cpu.

Revamps: 42f921a (cpufreq: remove sysfs files for CPUs which failed to come back after resume)
Reported-and-tested-by: Stephen Warren &lt;swarren@nvidia.com&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>intel_pstate: Remove energy reporting from pstate_sample tracepoint</title>
<updated>2014-02-13T01:11:18Z</updated>
<author>
<name>Dirk Brandewie</name>
<email>dirk.j.brandewie@intel.com</email>
</author>
<published>2014-02-12T18:01:03Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=709c078e176bd47227e89bb34de7c64b57aaaeab'/>
<id>urn:sha1:709c078e176bd47227e89bb34de7c64b57aaaeab</id>
<content type='text'>
Remove the reporting of energy since it does not provide any useful
information about the state of the driver and will be a maintainance
headache going forward since the RAPL energy units register is not
architectural and subject to change between micro-architectures

References: https://bugzilla.kernel.org/show_bug.cgi?id=69831
Fixes: b69880f9ccf7 (intel_pstate: Add trace point to report internal state.)
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;
</content>
</entry>
</feed>
