<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/cpufreq, branch 0.9</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>ENGR00178118-1 fix some build warnings when using GCC 4.6.2</title>
<updated>2012-07-03T20:58:06+00:00</updated>
<author>
<name>Jason Liu</name>
<email>r64343@freescale.com</email>
</author>
<published>2012-03-27T13:20:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=24fedd3c20e55c8bb8d0684b2aad125c5d8ad881'/>
<id>24fedd3c20e55c8bb8d0684b2aad125c5d8ad881</id>
<content type='text'>
fix some build warnings when using GCC 4.6.2:

drivers/cpufreq/cpufreq_interactive.c:127:6:
warning:'irq_count' may be used uninitialized in this function [-Wuninitialized]
drivers/media/video/mxc/output/mxc_vout.c:1346:5:
warning: 'ret' may be used uninitialized in this function [-Wuninitialized]
drivers/video/mxc/mxc_ipuv3_fb.c:1329:23:
warning: operation on 'mxc_fbi-&gt;cur_ipu_buf' may be undefined [-Wsequence-point]
drivers/video/mxc/mxc_ipuv3_fb.c:1376:24:
warning: operation on 'mxc_fbi-&gt;cur_ipu_buf' may be undefined [-Wsequence-point]
drivers/video/mxc/mxc_ipuv3_fb.c:1377:24:
warning: operation on 'mxc_fbi-&gt;cur_ipu_buf' may be undefined [-Wsequence-point]

Signed-off-by: Jason Liu &lt;r64343@freescale.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fix some build warnings when using GCC 4.6.2:

drivers/cpufreq/cpufreq_interactive.c:127:6:
warning:'irq_count' may be used uninitialized in this function [-Wuninitialized]
drivers/media/video/mxc/output/mxc_vout.c:1346:5:
warning: 'ret' may be used uninitialized in this function [-Wuninitialized]
drivers/video/mxc/mxc_ipuv3_fb.c:1329:23:
warning: operation on 'mxc_fbi-&gt;cur_ipu_buf' may be undefined [-Wsequence-point]
drivers/video/mxc/mxc_ipuv3_fb.c:1376:24:
warning: operation on 'mxc_fbi-&gt;cur_ipu_buf' may be undefined [-Wsequence-point]
drivers/video/mxc/mxc_ipuv3_fb.c:1377:24:
warning: operation on 'mxc_fbi-&gt;cur_ipu_buf' may be undefined [-Wsequence-point]

Signed-off-by: Jason Liu &lt;r64343@freescale.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ENGR00176177-2 Add irq count mechanism to interactive governor</title>
<updated>2012-07-03T20:58:03+00:00</updated>
<author>
<name>Anson Huang</name>
<email>b20788@freescale.com</email>
</author>
<published>2012-03-19T03:26:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6fc432763323e9bfa975b55f2cc967e3acf74a20'/>
<id>6fc432763323e9bfa975b55f2cc967e3acf74a20</id>
<content type='text'>
Add irq count to CPUFreq as a freq change condition.
Because some devices' working mode is unable to issue
CPUFreq change because of low CPU loading, but the cpu
freq will impact these devices' performace significantly.

Interactive govervor will sample the cpu loading as well
as the irq count which is registered. If the
loading or the irq count exceed the threshold we set,
governor will issue an CPUFreq change request.

These devices' irq threshold and enable/disable can be modified
via /sys/devices/system/cpu/cpufreq/interactive/irq_scaling

echo 0xAABBBC to change the default setting as below
AA : irq number
BBB: threshold
C  :enable or disable

Currently only enable USDHC3, USDHC4, GPU, SATA and
USB by default, we can add device to the init struct which is
located in arch/arm/mach-mx6/irq.c.

Signed-off-by: Anson Huang &lt;b20788@freescale.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add irq count to CPUFreq as a freq change condition.
Because some devices' working mode is unable to issue
CPUFreq change because of low CPU loading, but the cpu
freq will impact these devices' performace significantly.

Interactive govervor will sample the cpu loading as well
as the irq count which is registered. If the
loading or the irq count exceed the threshold we set,
governor will issue an CPUFreq change request.

These devices' irq threshold and enable/disable can be modified
via /sys/devices/system/cpu/cpufreq/interactive/irq_scaling

echo 0xAABBBC to change the default setting as below
AA : irq number
BBB: threshold
C  :enable or disable

Currently only enable USDHC3, USDHC4, GPU, SATA and
USB by default, we can add device to the init struct which is
located in arch/arm/mach-mx6/irq.c.

Signed-off-by: Anson Huang &lt;b20788@freescale.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ENGR00177745-1 Add interactive cpufreq governor</title>
<updated>2012-07-03T20:57:57+00:00</updated>
<author>
<name>Anson Huang</name>
<email>b20788@freescale.com</email>
</author>
<published>2012-03-19T01:55:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=78de9d41e37e01c930cfdcef55da807ef6093b11'/>
<id>78de9d41e37e01c930cfdcef55da807ef6093b11</id>
<content type='text'>
cpufreq: interactive: New 'interactive' governor

This governor is designed for latency-sensitive workloads, such as
interactive user interfaces.  The interactive governor aims to be
significantly more responsive to ramp CPU quickly up when CPU-intensive
activity begins.

Existing governors sample CPU load at a particular rate, typically
every X ms.  This can lead to under-powering UI threads for the period of
time during which the user begins interacting with a previously-idle system
until the next sample period happens.

The 'interactive' governor uses a different approach. Instead of sampling
the CPU at a specified rate, the governor will check whether to scale the
CPU frequency up soon after coming out of idle.  When the CPU comes out of
idle, a timer is configured to fire within 1-2 ticks.  If the CPU is very
busy from exiting idle to when the timer fires then we assume the CPU is
underpowered and ramp to MAX speed.

If the CPU was not sufficiently busy to immediately ramp to MAX speed, then
the governor evaluates the CPU load since the last speed adjustment,
choosing the highest value between that longer-term load or the short-term
load since idle exit to determine the CPU speed to ramp to.

A realtime thread is used for scaling up, giving the remaining tasks the
CPU performance benefit, unlike existing governors which are more likely to
schedule rampup work to occur after your performance starved tasks have
completed.

The tuneables for this governor are:
/sys/devices/system/cpu/cpufreq/interactive/min_sample_time:
    The minimum amount of time to spend at the current frequency before
    ramping down. This is to ensure that the governor has seen enough
    historic CPU load data to determine the appropriate workload.
/sys/devices/system/cpu/cpufreq/interactive/go_maxspeed_load
    The CPU load at which to ramp to max speed.

Signed-off-by: Anson Huang &lt;b20788@freescale.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
cpufreq: interactive: New 'interactive' governor

This governor is designed for latency-sensitive workloads, such as
interactive user interfaces.  The interactive governor aims to be
significantly more responsive to ramp CPU quickly up when CPU-intensive
activity begins.

Existing governors sample CPU load at a particular rate, typically
every X ms.  This can lead to under-powering UI threads for the period of
time during which the user begins interacting with a previously-idle system
until the next sample period happens.

The 'interactive' governor uses a different approach. Instead of sampling
the CPU at a specified rate, the governor will check whether to scale the
CPU frequency up soon after coming out of idle.  When the CPU comes out of
idle, a timer is configured to fire within 1-2 ticks.  If the CPU is very
busy from exiting idle to when the timer fires then we assume the CPU is
underpowered and ramp to MAX speed.

If the CPU was not sufficiently busy to immediately ramp to MAX speed, then
the governor evaluates the CPU load since the last speed adjustment,
choosing the highest value between that longer-term load or the short-term
load since idle exit to determine the CPU speed to ramp to.

A realtime thread is used for scaling up, giving the remaining tasks the
CPU performance benefit, unlike existing governors which are more likely to
schedule rampup work to occur after your performance starved tasks have
completed.

The tuneables for this governor are:
/sys/devices/system/cpu/cpufreq/interactive/min_sample_time:
    The minimum amount of time to spend at the current frequency before
    ramping down. This is to ensure that the governor has seen enough
    historic CPU load data to determine the appropriate workload.
/sys/devices/system/cpu/cpufreq/interactive/go_maxspeed_load
    The CPU load at which to ramp to max speed.

Signed-off-by: Anson Huang &lt;b20788@freescale.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drivers/cpufreq/pcc-cpufreq.c: avoid NULL pointer dereference</title>
<updated>2011-10-03T18:40:31+00:00</updated>
<author>
<name>Naga Chumbalkar</name>
<email>nagananda.chumbalkar@hp.com</email>
</author>
<published>2011-09-14T23:22:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c780713f786ee22532839502ed35f1bd1cb0fd1d'/>
<id>c780713f786ee22532839502ed35f1bd1cb0fd1d</id>
<content type='text'>
commit e71f5cc402ecb42b407ae52add7b173bf1c53daa upstream.

per_cpu(processors, n) can be NULL, resulting in:

  Loading CPUFreq modules[  437.661360] BUG: unable to handle kernel NULL pointer dereference at (null)
  IP: [&lt;ffffffffa0434314&gt;] pcc_cpufreq_cpu_init+0x74/0x220 [pcc_cpufreq]

It's better to avoid the oops by failing the driver, and allowing the
system to boot.

Signed-off-by: Naga Chumbalkar &lt;nagananda.chumbalkar@hp.com&gt;
Cc: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Cc: Len Brown &lt;lenb@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

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

per_cpu(processors, n) can be NULL, resulting in:

  Loading CPUFreq modules[  437.661360] BUG: unable to handle kernel NULL pointer dereference at (null)
  IP: [&lt;ffffffffa0434314&gt;] pcc_cpufreq_cpu_init+0x74/0x220 [pcc_cpufreq]

It's better to avoid the oops by failing the driver, and allowing the
system to boot.

Signed-off-by: Naga Chumbalkar &lt;nagananda.chumbalkar@hp.com&gt;
Cc: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Cc: Len Brown &lt;lenb@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>[CPUFREQ] fix cpumask memory leak in acpi-cpufreq on cpu hotplug.</title>
<updated>2011-07-10T21:03:04+00:00</updated>
<author>
<name>Luming Yu</name>
<email>luming.yu@gmail.com</email>
</author>
<published>2011-07-08T20:37:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=50f4ddd4ff713d2599e2f246775fe2206090126e'/>
<id>50f4ddd4ff713d2599e2f246775fe2206090126e</id>
<content type='text'>
I came across a memory leak during a cyclic cpu-online-offline test.

Signed-off-by: Yu Luming &lt;luming.yu@intel.com&gt;
Cc: Len Brown &lt;lenb@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I came across a memory leak during a cyclic cpu-online-offline test.

Signed-off-by: Yu Luming &lt;luming.yu@intel.com&gt;
Cc: Len Brown &lt;lenb@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[CPUFREQ] powernow-k8: Don't try to transition if the pstate is incorrect</title>
<updated>2011-06-16T20:31:13+00:00</updated>
<author>
<name>Konrad Rzeszutek Wilk</name>
<email>konrad.wilk@oracle.com</email>
</author>
<published>2011-06-16T19:36:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fbb5b89eabea5ae7d621b7861863159560d8faa4'/>
<id>fbb5b89eabea5ae7d621b7861863159560d8faa4</id>
<content type='text'>
This patch augments the pstate transition code to error out
(instead of returning 0) when an incorrect pstate is provided.

Suggested-by: Borislav Petkov &lt;bp@alien8.de&gt;
CC: andre.przywara@amd.com
CC: Mark.Langsdorf@amd.com
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch augments the pstate transition code to error out
(instead of returning 0) when an incorrect pstate is provided.

Suggested-by: Borislav Petkov &lt;bp@alien8.de&gt;
CC: andre.przywara@amd.com
CC: Mark.Langsdorf@amd.com
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[CPUFREQ] powernow-k8: Don't notify of successful transition if we failed (vid case).</title>
<updated>2011-06-16T20:31:13+00:00</updated>
<author>
<name>Konrad Rzeszutek Wilk</name>
<email>konrad.wilk@oracle.com</email>
</author>
<published>2011-06-16T19:36:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a9d3d2068064b7a6395871a49616d3784f802d50'/>
<id>a9d3d2068064b7a6395871a49616d3784f802d50</id>
<content type='text'>
Before this patch if we failed the vid transition would still try to
submit the "new" frequencies to cpufreq.
That is incorrect - also we could submit a non-existing frequency value
which would cause cpufreq to crash. The ultimate fix is in cpufreq
to deal with incorrect values, but this patch improves the error
recovery in the AMD powernowk8 driver.

The failure that was reported was as follows:

powernow-k8: Found 1 AMD Athlon(tm) 64 Processor 3700+ (1 cpu cores) (version 2.20.00)
powernow-k8: fid 0x2 (1000 MHz), vid 0x12
powernow-k8: fid 0xa (1800 MHz), vid 0xa
powernow-k8: fid 0xc (2000 MHz), vid 0x8
powernow-k8: fid 0xe (2200 MHz), vid 0x8
Marking TSC unstable due to cpufreq changes
powernow-k8: fid trans failed, fid 0x2, curr 0x0
BUG: unable to handle kernel paging request at ffff880807e07b78
IP: [&lt;ffffffff81479163&gt;] cpufreq_stats_update+0x46/0x5b
...

And transition fails and data-&gt;currfid ends up with 0. Since
the machine does not support 800Mhz value when the calculation is
done ('find_khz_freq_from_fid(data-&gt;currfid);') it reports the
new frequency as 800000 which is bogus. This patch fixes
the issue during target setting.

The patch however does not fix the issue in 'powernowk8_cpu_init'
where the pol-&gt;cur can also be set with the 800000 value:

          pol-&gt;cur = find_khz_freq_from_fid(data-&gt;currfid);
  dprintk("policy current frequency %d kHz\n", pol-&gt;cur);

  /* min/max the cpu is capable of */
  if (cpufreq_frequency_table_cpuinfo(pol, data-&gt;powernow_table)) {

The fix for that looks to update cpufreq_frequency_table_cpuinfo to
check pol-&gt;cur.... but that would cause an regression in how the
acpi-cpufreq driver works (it sets cpu-&gt;cur after calling
cpufreq_frequency_table_cpuinfo). Instead the fix will be to let
cpufreq gracefully handle bogus data (another patch).

Acked-by: Borislav Petkov &lt;bp@alien8.de&gt;
CC: andre.przywara@amd.com
CC: Mark.Langsdorf@amd.com
Reported-by: Tobias Diedrich &lt;ranma+xen@tdiedrich.de&gt;
Tested-by: Tobias Diedrich &lt;ranma+xen@tdiedrich.de&gt;
[v1: Rebased on v3.0-rc2, reduced patch to deal with vid case]
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this patch if we failed the vid transition would still try to
submit the "new" frequencies to cpufreq.
That is incorrect - also we could submit a non-existing frequency value
which would cause cpufreq to crash. The ultimate fix is in cpufreq
to deal with incorrect values, but this patch improves the error
recovery in the AMD powernowk8 driver.

The failure that was reported was as follows:

powernow-k8: Found 1 AMD Athlon(tm) 64 Processor 3700+ (1 cpu cores) (version 2.20.00)
powernow-k8: fid 0x2 (1000 MHz), vid 0x12
powernow-k8: fid 0xa (1800 MHz), vid 0xa
powernow-k8: fid 0xc (2000 MHz), vid 0x8
powernow-k8: fid 0xe (2200 MHz), vid 0x8
Marking TSC unstable due to cpufreq changes
powernow-k8: fid trans failed, fid 0x2, curr 0x0
BUG: unable to handle kernel paging request at ffff880807e07b78
IP: [&lt;ffffffff81479163&gt;] cpufreq_stats_update+0x46/0x5b
...

And transition fails and data-&gt;currfid ends up with 0. Since
the machine does not support 800Mhz value when the calculation is
done ('find_khz_freq_from_fid(data-&gt;currfid);') it reports the
new frequency as 800000 which is bogus. This patch fixes
the issue during target setting.

The patch however does not fix the issue in 'powernowk8_cpu_init'
where the pol-&gt;cur can also be set with the 800000 value:

          pol-&gt;cur = find_khz_freq_from_fid(data-&gt;currfid);
  dprintk("policy current frequency %d kHz\n", pol-&gt;cur);

  /* min/max the cpu is capable of */
  if (cpufreq_frequency_table_cpuinfo(pol, data-&gt;powernow_table)) {

The fix for that looks to update cpufreq_frequency_table_cpuinfo to
check pol-&gt;cur.... but that would cause an regression in how the
acpi-cpufreq driver works (it sets cpu-&gt;cur after calling
cpufreq_frequency_table_cpuinfo). Instead the fix will be to let
cpufreq gracefully handle bogus data (another patch).

Acked-by: Borislav Petkov &lt;bp@alien8.de&gt;
CC: andre.przywara@amd.com
CC: Mark.Langsdorf@amd.com
Reported-by: Tobias Diedrich &lt;ranma+xen@tdiedrich.de&gt;
Tested-by: Tobias Diedrich &lt;ranma+xen@tdiedrich.de&gt;
[v1: Rebased on v3.0-rc2, reduced patch to deal with vid case]
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[CPUFREQ] Don't set stat-&gt;last_index to -1 if the pol-&gt;cur has incorrect value.</title>
<updated>2011-06-16T20:31:12+00:00</updated>
<author>
<name>Konrad Rzeszutek Wilk</name>
<email>konrad.wilk@oracle.com</email>
</author>
<published>2011-06-16T19:36:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=46a310b80bc2c9ccc019649c9da91194cbc10944'/>
<id>46a310b80bc2c9ccc019649c9da91194cbc10944</id>
<content type='text'>
If the driver submitted an non-existing pol&gt;cur value (say it
used the default initialized value of zero), when the cpufreq
stats tries to setup its initial values it incorrectly sets
stat-&gt;last_index to -1 (or 0xfffff...). And cpufreq_stats_update
tries to update at that index location and fails.

This can be caused by:

stat-&gt;last_index = freq_table_get_index(stat, policy-&gt;cur);

not finding the appropiate frequency in the table (b/c the policy-&gt;cur
is wrong) and we end up crashing. The fix however is
concentrated in the 'cpufreq_stats_update' as the last_index
(and old_index) are updated there. Which means it can reset
the last_index to -1 again and on the next iteration cause a crash.

Without this patch, the following crash is observed:

powernow-k8: Found 1 AMD Athlon(tm) 64 Processor 3700+ (1 cpu cores) (version 2.20.00)
powernow-k8: fid 0x2 (1000 MHz), vid 0x12
powernow-k8: fid 0xa (1800 MHz), vid 0xa
powernow-k8: fid 0xc (2000 MHz), vid 0x8
powernow-k8: fid 0xe (2200 MHz), vid 0x8
Marking TSC unstable due to cpufreq changes
powernow-k8: fid trans failed, fid 0x2, curr 0x0
BUG: unable to handle kernel paging request at ffff880807e07b78
IP: [&lt;ffffffff81479163&gt;] cpufreq_stats_update+0x46/0x5b
.. snip..
Pid: 1, comm: swapper Not tainted 3.0.0-rc2 #45 MICRO-STAR INTERNATIONAL CO., LTD MS-7094/MS-7094
..snip..
Call Trace:
 [&lt;ffffffff81479248&gt;] cpufreq_stat_notifier_trans+0x48/0x7c
 [&lt;ffffffff81095d68&gt;] notifier_call_chain+0x32/0x5e
 [&lt;ffffffff81095e6b&gt;] __srcu_notifier_call_chain+0x47/0x63
 [&lt;ffffffff81095e96&gt;] srcu_notifier_call_chain+0xf/0x11
 [&lt;ffffffff81477e7a&gt;] cpufreq_notify_transition+0x111/0x134
 [&lt;ffffffff8147b0d4&gt;] powernowk8_target+0x53b/0x617
 [&lt;ffffffff8147723a&gt;] __cpufreq_driver_target+0x2e/0x30
 [&lt;ffffffff8147a127&gt;] cpufreq_governor_dbs+0x339/0x356
 [&lt;ffffffff81477394&gt;] __cpufreq_governor+0xa8/0xe9
 [&lt;ffffffff81477525&gt;] __cpufreq_set_policy+0x132/0x13e
 [&lt;ffffffff8147848d&gt;] cpufreq_add_dev_interface+0x272/0x28c

Reported-by: Tobias Diedrich &lt;ranma+xen@tdiedrich.de&gt;
Tested-by: Tobias Diedrich &lt;ranma+xen@tdiedrich.de&gt;
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the driver submitted an non-existing pol&gt;cur value (say it
used the default initialized value of zero), when the cpufreq
stats tries to setup its initial values it incorrectly sets
stat-&gt;last_index to -1 (or 0xfffff...). And cpufreq_stats_update
tries to update at that index location and fails.

This can be caused by:

stat-&gt;last_index = freq_table_get_index(stat, policy-&gt;cur);

not finding the appropiate frequency in the table (b/c the policy-&gt;cur
is wrong) and we end up crashing. The fix however is
concentrated in the 'cpufreq_stats_update' as the last_index
(and old_index) are updated there. Which means it can reset
the last_index to -1 again and on the next iteration cause a crash.

Without this patch, the following crash is observed:

powernow-k8: Found 1 AMD Athlon(tm) 64 Processor 3700+ (1 cpu cores) (version 2.20.00)
powernow-k8: fid 0x2 (1000 MHz), vid 0x12
powernow-k8: fid 0xa (1800 MHz), vid 0xa
powernow-k8: fid 0xc (2000 MHz), vid 0x8
powernow-k8: fid 0xe (2200 MHz), vid 0x8
Marking TSC unstable due to cpufreq changes
powernow-k8: fid trans failed, fid 0x2, curr 0x0
BUG: unable to handle kernel paging request at ffff880807e07b78
IP: [&lt;ffffffff81479163&gt;] cpufreq_stats_update+0x46/0x5b
.. snip..
Pid: 1, comm: swapper Not tainted 3.0.0-rc2 #45 MICRO-STAR INTERNATIONAL CO., LTD MS-7094/MS-7094
..snip..
Call Trace:
 [&lt;ffffffff81479248&gt;] cpufreq_stat_notifier_trans+0x48/0x7c
 [&lt;ffffffff81095d68&gt;] notifier_call_chain+0x32/0x5e
 [&lt;ffffffff81095e6b&gt;] __srcu_notifier_call_chain+0x47/0x63
 [&lt;ffffffff81095e96&gt;] srcu_notifier_call_chain+0xf/0x11
 [&lt;ffffffff81477e7a&gt;] cpufreq_notify_transition+0x111/0x134
 [&lt;ffffffff8147b0d4&gt;] powernowk8_target+0x53b/0x617
 [&lt;ffffffff8147723a&gt;] __cpufreq_driver_target+0x2e/0x30
 [&lt;ffffffff8147a127&gt;] cpufreq_governor_dbs+0x339/0x356
 [&lt;ffffffff81477394&gt;] __cpufreq_governor+0xa8/0xe9
 [&lt;ffffffff81477525&gt;] __cpufreq_set_policy+0x132/0x13e
 [&lt;ffffffff8147848d&gt;] cpufreq_add_dev_interface+0x272/0x28c

Reported-by: Tobias Diedrich &lt;ranma+xen@tdiedrich.de&gt;
Tested-by: Tobias Diedrich &lt;ranma+xen@tdiedrich.de&gt;
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[CPUFREQ] Remove cpufreq_stats sysfs entries on module unload.</title>
<updated>2011-06-12T20:36:52+00:00</updated>
<author>
<name>Dave Jones</name>
<email>davej@redhat.com</email>
</author>
<published>2011-06-12T20:35:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=13f067537f34456443f61c950cd6dc37d1d5f3ee'/>
<id>13f067537f34456443f61c950cd6dc37d1d5f3ee</id>
<content type='text'>
cpufreq_stats leaves behind its sysfs entries, which causes a panic
when something stumbled across them.
(Discovered by unloading cpufreq_stats while powertop was loaded).

Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
Cc: stable@kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
cpufreq_stats leaves behind its sysfs entries, which causes a panic
when something stumbled across them.
(Discovered by unloading cpufreq_stats while powertop was loaded).

Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
Cc: stable@kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: make DB8500 cpufreq driver compile</title>
<updated>2011-05-24T20:20:14+00:00</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@linaro.org</email>
</author>
<published>2011-05-15T17:34:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f0e733f32e56ded9309a8b8da3a77d47beb3cbdd'/>
<id>f0e733f32e56ded9309a8b8da3a77d47beb3cbdd</id>
<content type='text'>
Concluding interface update and movement of the driver by making
the DB8500 cpufreq driver compile in the cpufreq subsystem.

Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Acked-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Concluding interface update and movement of the driver by making
the DB8500 cpufreq driver compile in the cpufreq subsystem.

Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Acked-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
