<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/cpufreq/cpufreq.c, branch linux-3.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2012-11-14T23:33:09Z</updated>
<entry>
<title>cpufreq: Remove unnecessary initialization of a local variable</title>
<updated>2012-11-14T23:33:09Z</updated>
<author>
<name>Jingoo Han</name>
</author>
<published>2012-10-31T05:49:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f55c9c26278b0fcfa3336eccbba3d8a782da8aed'/>
<id>urn:sha1:f55c9c26278b0fcfa3336eccbba3d8a782da8aed</id>
<content type='text'>
Remove an unnecessary initializer for the 'ret' variable in
__cpufreq_set_policy().

[rjw: Modified the subject and changelog slightly.]
Signed-off-by: Jingoo Han &lt;jg1.han@samsung.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: Make sure target freq is within limits</title>
<updated>2012-11-14T23:33:09Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2012-10-31T00:28:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7249924e537816368c4a35afd97ab311f75a6368'/>
<id>urn:sha1:7249924e537816368c4a35afd97ab311f75a6368</id>
<content type='text'>
__cpufreq_driver_target() must not pass target frequency beyond the
limits of current policy.

Today most of cpufreq platform drivers are doing this check in their
target routines. Why not move it to __cpufreq_driver_target()?

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: Avoid calling cpufreq driver's target() routine if target_freq == policy-&gt;cur</title>
<updated>2012-11-14T23:33:09Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2012-10-31T00:28:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a1c022850ea5d64c2997bf9b89f5ae112d5ee4d'/>
<id>urn:sha1:5a1c022850ea5d64c2997bf9b89f5ae112d5ee4d</id>
<content type='text'>
Avoid calling cpufreq driver's target() routine if new frequency is same as
policies current frequency.

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: Fix sparse warning by making local function static</title>
<updated>2012-11-14T23:33:08Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2012-10-25T22:51:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=da58445570326ac2a342770a9c9a2646276e1721'/>
<id>urn:sha1:da58445570326ac2a342770a9c9a2646276e1721</id>
<content type='text'>
cpufreq_disabled() is a local function, so should be marked static.

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: return early from __cpufreq_driver_getavg()</title>
<updated>2012-11-14T23:33:07Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2012-10-24T21:39:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0676f7f2e7d2adec11f40320ca43a8897b8ef906'/>
<id>urn:sha1:0676f7f2e7d2adec11f40320ca43a8897b8ef906</id>
<content type='text'>
There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for drivers that
don't support getavg() routine.

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: Improve debug prints</title>
<updated>2012-11-14T23:33:06Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2012-10-22T23:29:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=db7011516cbfc3d867b77721f77258d36cfbf705'/>
<id>urn:sha1:db7011516cbfc3d867b77721f77258d36cfbf705</id>
<content type='text'>
With debug options on, it is difficult to locate cpufreq core's debug prints.
Fix this by prefixing debug prints with KBUILD_MODNAME.

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 / core: Fix printing of governor and driver name</title>
<updated>2012-11-14T23:33:06Z</updated>
<author>
<name>viresh kumar</name>
</author>
<published>2012-10-22T23:23:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4b972f0b04eaae645b22d99479b9aea43c3d64e7'/>
<id>urn:sha1:4b972f0b04eaae645b22d99479b9aea43c3d64e7</id>
<content type='text'>
Arrays for governer and driver name are of size CPUFREQ_NAME_LEN or 16.
i.e. 15 bytes for name and 1 for trailing '\0'.

When cpufreq driver print these names (for sysfs), it includes '\n' or ' ' in
the fmt string and still passes length as CPUFREQ_NAME_LEN. If the driver or
governor names are using all 15 fields allocated to them, then the trailing '\n'
or ' ' will never be printed. And so commands like:

root@linaro-developer# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver

will print something like:

cpufreq_foodrvroot@linaro-developer#

Fix this by increasing print length by one character.

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 / core: Fix typo in comment describing show_bios_limit()</title>
<updated>2012-11-14T23:33:05Z</updated>
<author>
<name>viresh kumar</name>
</author>
<published>2012-10-22T23:23:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8bf1ac723639c4260f76df0e45ee23aa35a23067'/>
<id>urn:sha1:8bf1ac723639c4260f76df0e45ee23aa35a23067</id>
<content type='text'>
show_bios_limit is mistakenly written as show_scaling_driver in a comment
describing purpose of show_bios_limit() routine.

Fix 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: Fix sysfs deadlock with concurrent hotplug/frequency switch</title>
<updated>2012-07-20T19:39:25Z</updated>
<author>
<name>Stephen Boyd</name>
</author>
<published>2012-07-20T18:14:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a9144436271583115a2230db15d0b6ae2c481d3c'/>
<id>urn:sha1:a9144436271583115a2230db15d0b6ae2c481d3c</id>
<content type='text'>
Running one program that continuously hotplugs and replugs a cpu
concurrently with another program that continuously writes to the
scaling_setspeed node eventually deadlocks with:

=============================================
[ INFO: possible recursive locking detected ]
3.4.0 #37 Tainted: G        W
---------------------------------------------
filemonkey/122 is trying to acquire lock:
 (s_active#13){++++.+}, at: [&lt;c01a3d28&gt;] sysfs_remove_dir+0x9c/0xb4

but task is already holding lock:
 (s_active#13){++++.+}, at: [&lt;c01a22f0&gt;] sysfs_write_file+0xe8/0x140

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(s_active#13);
  lock(s_active#13);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by filemonkey/122:
 #0:  (&amp;buffer-&gt;mutex){+.+.+.}, at: [&lt;c01a2230&gt;] sysfs_write_file+0x28/0x140
 #1:  (s_active#13){++++.+}, at: [&lt;c01a22f0&gt;] sysfs_write_file+0xe8/0x140

stack backtrace:
[&lt;c0014fcc&gt;] (unwind_backtrace+0x0/0x120) from [&lt;c00ca600&gt;] (validate_chain+0x6f8/0x1054)
[&lt;c00ca600&gt;] (validate_chain+0x6f8/0x1054) from [&lt;c00cb778&gt;] (__lock_acquire+0x81c/0x8d8)
[&lt;c00cb778&gt;] (__lock_acquire+0x81c/0x8d8) from [&lt;c00cb9c0&gt;] (lock_acquire+0x18c/0x1e8)
[&lt;c00cb9c0&gt;] (lock_acquire+0x18c/0x1e8) from [&lt;c01a3ba8&gt;] (sysfs_addrm_finish+0xd0/0x180)
[&lt;c01a3ba8&gt;] (sysfs_addrm_finish+0xd0/0x180) from [&lt;c01a3d28&gt;] (sysfs_remove_dir+0x9c/0xb4)
[&lt;c01a3d28&gt;] (sysfs_remove_dir+0x9c/0xb4) from [&lt;c02d0e5c&gt;] (kobject_del+0x10/0x38)
[&lt;c02d0e5c&gt;] (kobject_del+0x10/0x38) from [&lt;c02d0f74&gt;] (kobject_release+0xf0/0x194)
[&lt;c02d0f74&gt;] (kobject_release+0xf0/0x194) from [&lt;c0565a98&gt;] (cpufreq_cpu_put+0xc/0x24)
[&lt;c0565a98&gt;] (cpufreq_cpu_put+0xc/0x24) from [&lt;c05683f0&gt;] (store+0x6c/0x74)
[&lt;c05683f0&gt;] (store+0x6c/0x74) from [&lt;c01a2314&gt;] (sysfs_write_file+0x10c/0x140)
[&lt;c01a2314&gt;] (sysfs_write_file+0x10c/0x140) from [&lt;c014af44&gt;] (vfs_write+0xb0/0x128)
[&lt;c014af44&gt;] (vfs_write+0xb0/0x128) from [&lt;c014b06c&gt;] (sys_write+0x3c/0x68)
[&lt;c014b06c&gt;] (sys_write+0x3c/0x68) from [&lt;c000e0e0&gt;] (ret_fast_syscall+0x0/0x3c)

This is because store() in cpufreq.c indirectly calls
kobject_get() via cpufreq_cpu_get() and is the last one to call
kobject_put() via cpufreq_cpu_put(). Sysfs code should not call
kobject_get() or kobject_put() directly (see the comment around
sysfs_schedule_callback() for more information).

Fix this deadlock by introducing two new functions:

	struct cpufreq_policy *cpufreq_cpu_get_sysfs(unsigned int cpu)
	void cpufreq_cpu_put_sysfs(struct cpufreq_policy *data)

which do the same thing as cpufreq_cpu_{get,put}() but don't call
kobject functions.

To easily trigger this deadlock you can insert an msleep() with a
reasonably large value right after the fail label at the bottom
of the store() function in cpufreq.c and then write
scaling_setspeed in one task and offline the cpu in another. The
first task will hang and be detected by the hung task detector.

Signed-off-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>provide disable_cpufreq() function to disable the API.</title>
<updated>2012-03-14T18:45:03Z</updated>
<author>
<name>Konrad Rzeszutek Wilk</name>
</author>
<published>2012-03-13T23:18:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a7b422cda5084db7265c3b23310a959b43b47529'/>
<id>urn:sha1:a7b422cda5084db7265c3b23310a959b43b47529</id>
<content type='text'>
useful for disabling cpufreq altogether. The cpu frequency
scaling drivers and cpu frequency governors will fail to register.

Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</content>
</entry>
</feed>
