<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/cpufreq, branch v3.10.12</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: rename ignore_nice as ignore_nice_load</title>
<updated>2013-08-15T05:59:06+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2013-08-05T06:58:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=da712f3a8c493986b19fd0863b45607c34061ba6'/>
<id>da712f3a8c493986b19fd0863b45607c34061ba6</id>
<content type='text'>
commit 6c4640c3adfd97ce10efed7c07405f52d002b9a8 upstream.

This sysfs file was called ignore_nice_load earlier and commit
4d5dcc4 (cpufreq: governor: Implement per policy instances of
governors) changed its name to ignore_nice by mistake.

Lets get it renamed back to its original name.

Reported-by: Martin von Gagern &lt;Martin.vGagern@gmx.net&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;
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 6c4640c3adfd97ce10efed7c07405f52d002b9a8 upstream.

This sysfs file was called ignore_nice_load earlier and commit
4d5dcc4 (cpufreq: governor: Implement per policy instances of
governors) changed its name to ignore_nice by mistake.

Lets get it renamed back to its original name.

Reported-by: Martin von Gagern &lt;Martin.vGagern@gmx.net&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;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: loongson2: fix regression related to clock management</title>
<updated>2013-08-15T05:59:06+00:00</updated>
<author>
<name>Aaro Koskinen</name>
<email>aaro.koskinen@iki.fi</email>
</author>
<published>2013-08-05T18:27:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4b0be00599c98bb20e0396f41f47a593e1c9d4ea'/>
<id>4b0be00599c98bb20e0396f41f47a593e1c9d4ea</id>
<content type='text'>
commit f54fe64d14dff3df6d45a48115d248a82557811f upstream.

Commit 42913c799 (MIPS: Loongson2: Use clk API instead of direct
dereferences) broke the cpufreq functionality on Loongson2 boards:
clk_set_rate() is called before the CPU frequency table is
initialized, and therefore will always fail.

Fix by moving the clk_set_rate() after the table initialization.
Tested on Lemote FuLoong mini-PC.

Signed-off-by: Aaro Koskinen &lt;aaro.koskinen@iki.fi&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 f54fe64d14dff3df6d45a48115d248a82557811f upstream.

Commit 42913c799 (MIPS: Loongson2: Use clk API instead of direct
dereferences) broke the cpufreq functionality on Loongson2 boards:
clk_set_rate() is called before the CPU frequency table is
initialized, and therefore will always fail.

Fix by moving the clk_set_rate() after the table initialization.
Tested on Lemote FuLoong mini-PC.

Signed-off-by: Aaro Koskinen &lt;aaro.koskinen@iki.fi&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: Fix cpufreq driver module refcount balance after suspend/resume</title>
<updated>2013-08-12T01:35:24+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2013-07-29T22:32:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e9ef4410a75bea04e5f9e30c41fba0ebfa9b7559'/>
<id>e9ef4410a75bea04e5f9e30c41fba0ebfa9b7559</id>
<content type='text'>
commit 2a99859932281ed6c2ecdd988855f8f6838f6743 upstream.

Since cpufreq_cpu_put() called by __cpufreq_remove_dev() drops the
driver module refcount, __cpufreq_remove_dev() causes that refcount
to become negative for the cpufreq driver after a suspend/resume
cycle.

This is not the only bad thing that happens there, however, because
kobject_put() should only be called for the policy kobject at this
point if the CPU is not the last one for that policy.

Namely, if the given CPU is the last one for that policy, the
policy kobject's refcount should be 1 at this point, as set by
cpufreq_add_dev_interface(), and only needs to be dropped once for
the kobject to go away.  This actually happens under the cpu == 1
check, so it need not be done before by cpufreq_cpu_put().

On the other hand, if the given CPU is not the last one for that
policy, this means that cpufreq_add_policy_cpu() has been called
at least once for that policy and cpufreq_cpu_get() has been
called for it too.  To balance that cpufreq_cpu_get(), we need to
call cpufreq_cpu_put() in that case.

Thus, to fix the described problem and keep the reference
counters balanced in both cases, move the cpufreq_cpu_get() call
in __cpufreq_remove_dev() to the code path executed only for
CPUs that share the policy with other CPUs.

Reported-and-tested-by: Toralf Förster &lt;toralf.foerster@gmx.de&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.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 2a99859932281ed6c2ecdd988855f8f6838f6743 upstream.

Since cpufreq_cpu_put() called by __cpufreq_remove_dev() drops the
driver module refcount, __cpufreq_remove_dev() causes that refcount
to become negative for the cpufreq driver after a suspend/resume
cycle.

This is not the only bad thing that happens there, however, because
kobject_put() should only be called for the policy kobject at this
point if the CPU is not the last one for that policy.

Namely, if the given CPU is the last one for that policy, the
policy kobject's refcount should be 1 at this point, as set by
cpufreq_add_dev_interface(), and only needs to be dropped once for
the kobject to go away.  This actually happens under the cpu == 1
check, so it need not be done before by cpufreq_cpu_put().

On the other hand, if the given CPU is not the last one for that
policy, this means that cpufreq_add_policy_cpu() has been called
at least once for that policy and cpufreq_cpu_get() has been
called for it too.  To balance that cpufreq_cpu_get(), we need to
call cpufreq_cpu_put() in that case.

Thus, to fix the described problem and keep the reference
counters balanced in both cases, move the cpufreq_cpu_get() call
in __cpufreq_remove_dev() to the code path executed only for
CPUs that share the policy with other CPUs.

Reported-and-tested-by: Toralf Förster &lt;toralf.foerster@gmx.de&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq / intel_pstate: Change to scale off of max P-state</title>
<updated>2013-08-04T08:50:51+00:00</updated>
<author>
<name>Dirk Brandewie</name>
<email>dirk.j.brandewie@intel.com</email>
</author>
<published>2013-07-18T15:48:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=cb631ac7738411616e461ae43af9b6d4cb9d29d4'/>
<id>cb631ac7738411616e461ae43af9b6d4cb9d29d4</id>
<content type='text'>
commit 2134ed4d614349b2b4e8d7bb593baa9179b8dd1e upstream.

Change to using max P-state instead of max turbo P-state.  This
change resolves two issues.

On a quiet system intel_pstate can fail to respond to a load change.

On CPU SKUs that have a limited number of P-states and no turbo range
intel_pstate fails to select the highest available P-state.

This change is suitable for stable v3.9+

References: https://bugzilla.kernel.org/show_bug.cgi?id=59481
Reported-and-tested-by: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Reported-and-tested-by: dsmythies@telus.net
Signed-off-by: Dirk Brandewie &lt;dirk.j.brandewie@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 2134ed4d614349b2b4e8d7bb593baa9179b8dd1e upstream.

Change to using max P-state instead of max turbo P-state.  This
change resolves two issues.

On a quiet system intel_pstate can fail to respond to a load change.

On CPU SKUs that have a limited number of P-states and no turbo range
intel_pstate fails to select the highest available P-state.

This change is suitable for stable v3.9+

References: https://bugzilla.kernel.org/show_bug.cgi?id=59481
Reported-and-tested-by: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Reported-and-tested-by: dsmythies@telus.net
Signed-off-by: Dirk Brandewie &lt;dirk.j.brandewie@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: Revert commit 2f7021a8 to fix CPU hotplug regression</title>
<updated>2013-07-25T21:07:23+00:00</updated>
<author>
<name>Srivatsa S. Bhat</name>
<email>srivatsa.bhat@linux.vnet.ibm.com</email>
</author>
<published>2013-07-16T20:46:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=916f4dbc2a827677212a3bf3ffcc22745fa6e0b1'/>
<id>916f4dbc2a827677212a3bf3ffcc22745fa6e0b1</id>
<content type='text'>
commit e8d05276f236ee6435e78411f62be9714e0b9377 upstream.

commit 2f7021a8 "cpufreq: protect 'policy-&gt;cpus' from offlining
during __gov_queue_work()" caused a regression in CPU hotplug,
because it lead to a deadlock between cpufreq governor worker thread
and the CPU hotplug writer task.

Lockdep splat corresponding to this deadlock is shown below:

[   60.277396] ======================================================
[   60.277400] [ INFO: possible circular locking dependency detected ]
[   60.277407] 3.10.0-rc7-dbg-01385-g241fd04-dirty #1744 Not tainted
[   60.277411] -------------------------------------------------------
[   60.277417] bash/2225 is trying to acquire lock:
[   60.277422]  ((&amp;(&amp;j_cdbs-&gt;work)-&gt;work)){+.+...}, at: [&lt;ffffffff810621b5&gt;] flush_work+0x5/0x280
[   60.277444] but task is already holding lock:
[   60.277449]  (cpu_hotplug.lock){+.+.+.}, at: [&lt;ffffffff81042d8b&gt;] cpu_hotplug_begin+0x2b/0x60
[   60.277465] which lock already depends on the new lock.

[   60.277472] the existing dependency chain (in reverse order) is:
[   60.277477] -&gt; #2 (cpu_hotplug.lock){+.+.+.}:
[   60.277490]        [&lt;ffffffff810ac6d4&gt;] lock_acquire+0xa4/0x200
[   60.277503]        [&lt;ffffffff815b6157&gt;] mutex_lock_nested+0x67/0x410
[   60.277514]        [&lt;ffffffff81042cbc&gt;] get_online_cpus+0x3c/0x60
[   60.277522]        [&lt;ffffffff814b842a&gt;] gov_queue_work+0x2a/0xb0
[   60.277532]        [&lt;ffffffff814b7891&gt;] cs_dbs_timer+0xc1/0xe0
[   60.277543]        [&lt;ffffffff8106302d&gt;] process_one_work+0x1cd/0x6a0
[   60.277552]        [&lt;ffffffff81063d31&gt;] worker_thread+0x121/0x3a0
[   60.277560]        [&lt;ffffffff8106ae2b&gt;] kthread+0xdb/0xe0
[   60.277569]        [&lt;ffffffff815bb96c&gt;] ret_from_fork+0x7c/0xb0
[   60.277580] -&gt; #1 (&amp;j_cdbs-&gt;timer_mutex){+.+...}:
[   60.277592]        [&lt;ffffffff810ac6d4&gt;] lock_acquire+0xa4/0x200
[   60.277600]        [&lt;ffffffff815b6157&gt;] mutex_lock_nested+0x67/0x410
[   60.277608]        [&lt;ffffffff814b785d&gt;] cs_dbs_timer+0x8d/0xe0
[   60.277616]        [&lt;ffffffff8106302d&gt;] process_one_work+0x1cd/0x6a0
[   60.277624]        [&lt;ffffffff81063d31&gt;] worker_thread+0x121/0x3a0
[   60.277633]        [&lt;ffffffff8106ae2b&gt;] kthread+0xdb/0xe0
[   60.277640]        [&lt;ffffffff815bb96c&gt;] ret_from_fork+0x7c/0xb0
[   60.277649] -&gt; #0 ((&amp;(&amp;j_cdbs-&gt;work)-&gt;work)){+.+...}:
[   60.277661]        [&lt;ffffffff810ab826&gt;] __lock_acquire+0x1766/0x1d30
[   60.277669]        [&lt;ffffffff810ac6d4&gt;] lock_acquire+0xa4/0x200
[   60.277677]        [&lt;ffffffff810621ed&gt;] flush_work+0x3d/0x280
[   60.277685]        [&lt;ffffffff81062d8a&gt;] __cancel_work_timer+0x8a/0x120
[   60.277693]        [&lt;ffffffff81062e53&gt;] cancel_delayed_work_sync+0x13/0x20
[   60.277701]        [&lt;ffffffff814b89d9&gt;] cpufreq_governor_dbs+0x529/0x6f0
[   60.277709]        [&lt;ffffffff814b76a7&gt;] cs_cpufreq_governor_dbs+0x17/0x20
[   60.277719]        [&lt;ffffffff814b5df8&gt;] __cpufreq_governor+0x48/0x100
[   60.277728]        [&lt;ffffffff814b6b80&gt;] __cpufreq_remove_dev.isra.14+0x80/0x3c0
[   60.277737]        [&lt;ffffffff815adc0d&gt;] cpufreq_cpu_callback+0x38/0x4c
[   60.277747]        [&lt;ffffffff81071a4d&gt;] notifier_call_chain+0x5d/0x110
[   60.277759]        [&lt;ffffffff81071b0e&gt;] __raw_notifier_call_chain+0xe/0x10
[   60.277768]        [&lt;ffffffff815a0a68&gt;] _cpu_down+0x88/0x330
[   60.277779]        [&lt;ffffffff815a0d46&gt;] cpu_down+0x36/0x50
[   60.277788]        [&lt;ffffffff815a2748&gt;] store_online+0x98/0xd0
[   60.277796]        [&lt;ffffffff81452a28&gt;] dev_attr_store+0x18/0x30
[   60.277806]        [&lt;ffffffff811d9edb&gt;] sysfs_write_file+0xdb/0x150
[   60.277818]        [&lt;ffffffff8116806d&gt;] vfs_write+0xbd/0x1f0
[   60.277826]        [&lt;ffffffff811686fc&gt;] SyS_write+0x4c/0xa0
[   60.277834]        [&lt;ffffffff815bbbbe&gt;] tracesys+0xd0/0xd5
[   60.277842] other info that might help us debug this:

[   60.277848] Chain exists of:
  (&amp;(&amp;j_cdbs-&gt;work)-&gt;work) --&gt; &amp;j_cdbs-&gt;timer_mutex --&gt; cpu_hotplug.lock

[   60.277864]  Possible unsafe locking scenario:

[   60.277869]        CPU0                    CPU1
[   60.277873]        ----                    ----
[   60.277877]   lock(cpu_hotplug.lock);
[   60.277885]                                lock(&amp;j_cdbs-&gt;timer_mutex);
[   60.277892]                                lock(cpu_hotplug.lock);
[   60.277900]   lock((&amp;(&amp;j_cdbs-&gt;work)-&gt;work));
[   60.277907]  *** DEADLOCK ***

[   60.277915] 6 locks held by bash/2225:
[   60.277919]  #0:  (sb_writers#6){.+.+.+}, at: [&lt;ffffffff81168173&gt;] vfs_write+0x1c3/0x1f0
[   60.277937]  #1:  (&amp;buffer-&gt;mutex){+.+.+.}, at: [&lt;ffffffff811d9e3c&gt;] sysfs_write_file+0x3c/0x150
[   60.277954]  #2:  (s_active#61){.+.+.+}, at: [&lt;ffffffff811d9ec3&gt;] sysfs_write_file+0xc3/0x150
[   60.277972]  #3:  (x86_cpu_hotplug_driver_mutex){+.+...}, at: [&lt;ffffffff81024cf7&gt;] cpu_hotplug_driver_lock+0x17/0x20
[   60.277990]  #4:  (cpu_add_remove_lock){+.+.+.}, at: [&lt;ffffffff815a0d32&gt;] cpu_down+0x22/0x50
[   60.278007]  #5:  (cpu_hotplug.lock){+.+.+.}, at: [&lt;ffffffff81042d8b&gt;] cpu_hotplug_begin+0x2b/0x60
[   60.278023] stack backtrace:
[   60.278031] CPU: 3 PID: 2225 Comm: bash Not tainted 3.10.0-rc7-dbg-01385-g241fd04-dirty #1744
[   60.278037] Hardware name: Acer             Aspire 5741G    /Aspire 5741G    , BIOS V1.20 02/08/2011
[   60.278042]  ffffffff8204e110 ffff88014df6b9f8 ffffffff815b3d90 ffff88014df6ba38
[   60.278055]  ffffffff815b0a8d ffff880150ed3f60 ffff880150ed4770 3871c4002c8980b2
[   60.278068]  ffff880150ed4748 ffff880150ed4770 ffff880150ed3f60 ffff88014df6bb00
[   60.278081] Call Trace:
[   60.278091]  [&lt;ffffffff815b3d90&gt;] dump_stack+0x19/0x1b
[   60.278101]  [&lt;ffffffff815b0a8d&gt;] print_circular_bug+0x2b6/0x2c5
[   60.278111]  [&lt;ffffffff810ab826&gt;] __lock_acquire+0x1766/0x1d30
[   60.278123]  [&lt;ffffffff81067e08&gt;] ? __kernel_text_address+0x58/0x80
[   60.278134]  [&lt;ffffffff810ac6d4&gt;] lock_acquire+0xa4/0x200
[   60.278142]  [&lt;ffffffff810621b5&gt;] ? flush_work+0x5/0x280
[   60.278151]  [&lt;ffffffff810621ed&gt;] flush_work+0x3d/0x280
[   60.278159]  [&lt;ffffffff810621b5&gt;] ? flush_work+0x5/0x280
[   60.278169]  [&lt;ffffffff810a9b14&gt;] ? mark_held_locks+0x94/0x140
[   60.278178]  [&lt;ffffffff81062d77&gt;] ? __cancel_work_timer+0x77/0x120
[   60.278188]  [&lt;ffffffff810a9cbd&gt;] ? trace_hardirqs_on_caller+0xfd/0x1c0
[   60.278196]  [&lt;ffffffff81062d8a&gt;] __cancel_work_timer+0x8a/0x120
[   60.278206]  [&lt;ffffffff81062e53&gt;] cancel_delayed_work_sync+0x13/0x20
[   60.278214]  [&lt;ffffffff814b89d9&gt;] cpufreq_governor_dbs+0x529/0x6f0
[   60.278225]  [&lt;ffffffff814b76a7&gt;] cs_cpufreq_governor_dbs+0x17/0x20
[   60.278234]  [&lt;ffffffff814b5df8&gt;] __cpufreq_governor+0x48/0x100
[   60.278244]  [&lt;ffffffff814b6b80&gt;] __cpufreq_remove_dev.isra.14+0x80/0x3c0
[   60.278255]  [&lt;ffffffff815adc0d&gt;] cpufreq_cpu_callback+0x38/0x4c
[   60.278265]  [&lt;ffffffff81071a4d&gt;] notifier_call_chain+0x5d/0x110
[   60.278275]  [&lt;ffffffff81071b0e&gt;] __raw_notifier_call_chain+0xe/0x10
[   60.278284]  [&lt;ffffffff815a0a68&gt;] _cpu_down+0x88/0x330
[   60.278292]  [&lt;ffffffff81024cf7&gt;] ? cpu_hotplug_driver_lock+0x17/0x20
[   60.278302]  [&lt;ffffffff815a0d46&gt;] cpu_down+0x36/0x50
[   60.278311]  [&lt;ffffffff815a2748&gt;] store_online+0x98/0xd0
[   60.278320]  [&lt;ffffffff81452a28&gt;] dev_attr_store+0x18/0x30
[   60.278329]  [&lt;ffffffff811d9edb&gt;] sysfs_write_file+0xdb/0x150
[   60.278337]  [&lt;ffffffff8116806d&gt;] vfs_write+0xbd/0x1f0
[   60.278347]  [&lt;ffffffff81185950&gt;] ? fget_light+0x320/0x4b0
[   60.278355]  [&lt;ffffffff811686fc&gt;] SyS_write+0x4c/0xa0
[   60.278364]  [&lt;ffffffff815bbbbe&gt;] tracesys+0xd0/0xd5
[   60.280582] smpboot: CPU 1 is now offline

The intention of that commit was to avoid warnings during CPU
hotplug, which indicated that offline CPUs were getting IPIs from the
cpufreq governor's work items.  But the real root-cause of that
problem was commit a66b2e5 (cpufreq: Preserve sysfs files across
suspend/resume) because it totally skipped all the cpufreq callbacks
during CPU hotplug in the suspend/resume path, and hence it never
actually shut down the cpufreq governor's worker threads during CPU
offline in the suspend/resume path.

Reflecting back, the reason why we never suspected that commit as the
root-cause earlier, was that the original issue was reported with
just the halt command and nobody had brought in suspend/resume to the
equation.

The reason for _that_ in turn, as it turns out, is that earlier
halt/shutdown was being done by disabling non-boot CPUs while tasks
were frozen, just like suspend/resume....  but commit cf7df378a
(reboot: migrate shutdown/reboot to boot cpu) which came somewhere
along that very same time changed that logic: shutdown/halt no longer
takes CPUs offline.  Thus, the test-cases for reproducing the bug
were vastly different and thus we went totally off the trail.

Overall, it was one hell of a confusion with so many commits
affecting each other and also affecting the symptoms of the problems
in subtle ways.  Finally, now since the original problematic commit
(a66b2e5) has been completely reverted, revert this intermediate fix
too (2f7021a8), to fix the CPU hotplug deadlock.  Phew!

Reported-by: Sergey Senozhatsky &lt;sergey.senozhatsky@gmail.com&gt;
Reported-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Tested-by: Peter Wu &lt;lekensteyn@gmail.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 e8d05276f236ee6435e78411f62be9714e0b9377 upstream.

commit 2f7021a8 "cpufreq: protect 'policy-&gt;cpus' from offlining
during __gov_queue_work()" caused a regression in CPU hotplug,
because it lead to a deadlock between cpufreq governor worker thread
and the CPU hotplug writer task.

Lockdep splat corresponding to this deadlock is shown below:

[   60.277396] ======================================================
[   60.277400] [ INFO: possible circular locking dependency detected ]
[   60.277407] 3.10.0-rc7-dbg-01385-g241fd04-dirty #1744 Not tainted
[   60.277411] -------------------------------------------------------
[   60.277417] bash/2225 is trying to acquire lock:
[   60.277422]  ((&amp;(&amp;j_cdbs-&gt;work)-&gt;work)){+.+...}, at: [&lt;ffffffff810621b5&gt;] flush_work+0x5/0x280
[   60.277444] but task is already holding lock:
[   60.277449]  (cpu_hotplug.lock){+.+.+.}, at: [&lt;ffffffff81042d8b&gt;] cpu_hotplug_begin+0x2b/0x60
[   60.277465] which lock already depends on the new lock.

[   60.277472] the existing dependency chain (in reverse order) is:
[   60.277477] -&gt; #2 (cpu_hotplug.lock){+.+.+.}:
[   60.277490]        [&lt;ffffffff810ac6d4&gt;] lock_acquire+0xa4/0x200
[   60.277503]        [&lt;ffffffff815b6157&gt;] mutex_lock_nested+0x67/0x410
[   60.277514]        [&lt;ffffffff81042cbc&gt;] get_online_cpus+0x3c/0x60
[   60.277522]        [&lt;ffffffff814b842a&gt;] gov_queue_work+0x2a/0xb0
[   60.277532]        [&lt;ffffffff814b7891&gt;] cs_dbs_timer+0xc1/0xe0
[   60.277543]        [&lt;ffffffff8106302d&gt;] process_one_work+0x1cd/0x6a0
[   60.277552]        [&lt;ffffffff81063d31&gt;] worker_thread+0x121/0x3a0
[   60.277560]        [&lt;ffffffff8106ae2b&gt;] kthread+0xdb/0xe0
[   60.277569]        [&lt;ffffffff815bb96c&gt;] ret_from_fork+0x7c/0xb0
[   60.277580] -&gt; #1 (&amp;j_cdbs-&gt;timer_mutex){+.+...}:
[   60.277592]        [&lt;ffffffff810ac6d4&gt;] lock_acquire+0xa4/0x200
[   60.277600]        [&lt;ffffffff815b6157&gt;] mutex_lock_nested+0x67/0x410
[   60.277608]        [&lt;ffffffff814b785d&gt;] cs_dbs_timer+0x8d/0xe0
[   60.277616]        [&lt;ffffffff8106302d&gt;] process_one_work+0x1cd/0x6a0
[   60.277624]        [&lt;ffffffff81063d31&gt;] worker_thread+0x121/0x3a0
[   60.277633]        [&lt;ffffffff8106ae2b&gt;] kthread+0xdb/0xe0
[   60.277640]        [&lt;ffffffff815bb96c&gt;] ret_from_fork+0x7c/0xb0
[   60.277649] -&gt; #0 ((&amp;(&amp;j_cdbs-&gt;work)-&gt;work)){+.+...}:
[   60.277661]        [&lt;ffffffff810ab826&gt;] __lock_acquire+0x1766/0x1d30
[   60.277669]        [&lt;ffffffff810ac6d4&gt;] lock_acquire+0xa4/0x200
[   60.277677]        [&lt;ffffffff810621ed&gt;] flush_work+0x3d/0x280
[   60.277685]        [&lt;ffffffff81062d8a&gt;] __cancel_work_timer+0x8a/0x120
[   60.277693]        [&lt;ffffffff81062e53&gt;] cancel_delayed_work_sync+0x13/0x20
[   60.277701]        [&lt;ffffffff814b89d9&gt;] cpufreq_governor_dbs+0x529/0x6f0
[   60.277709]        [&lt;ffffffff814b76a7&gt;] cs_cpufreq_governor_dbs+0x17/0x20
[   60.277719]        [&lt;ffffffff814b5df8&gt;] __cpufreq_governor+0x48/0x100
[   60.277728]        [&lt;ffffffff814b6b80&gt;] __cpufreq_remove_dev.isra.14+0x80/0x3c0
[   60.277737]        [&lt;ffffffff815adc0d&gt;] cpufreq_cpu_callback+0x38/0x4c
[   60.277747]        [&lt;ffffffff81071a4d&gt;] notifier_call_chain+0x5d/0x110
[   60.277759]        [&lt;ffffffff81071b0e&gt;] __raw_notifier_call_chain+0xe/0x10
[   60.277768]        [&lt;ffffffff815a0a68&gt;] _cpu_down+0x88/0x330
[   60.277779]        [&lt;ffffffff815a0d46&gt;] cpu_down+0x36/0x50
[   60.277788]        [&lt;ffffffff815a2748&gt;] store_online+0x98/0xd0
[   60.277796]        [&lt;ffffffff81452a28&gt;] dev_attr_store+0x18/0x30
[   60.277806]        [&lt;ffffffff811d9edb&gt;] sysfs_write_file+0xdb/0x150
[   60.277818]        [&lt;ffffffff8116806d&gt;] vfs_write+0xbd/0x1f0
[   60.277826]        [&lt;ffffffff811686fc&gt;] SyS_write+0x4c/0xa0
[   60.277834]        [&lt;ffffffff815bbbbe&gt;] tracesys+0xd0/0xd5
[   60.277842] other info that might help us debug this:

[   60.277848] Chain exists of:
  (&amp;(&amp;j_cdbs-&gt;work)-&gt;work) --&gt; &amp;j_cdbs-&gt;timer_mutex --&gt; cpu_hotplug.lock

[   60.277864]  Possible unsafe locking scenario:

[   60.277869]        CPU0                    CPU1
[   60.277873]        ----                    ----
[   60.277877]   lock(cpu_hotplug.lock);
[   60.277885]                                lock(&amp;j_cdbs-&gt;timer_mutex);
[   60.277892]                                lock(cpu_hotplug.lock);
[   60.277900]   lock((&amp;(&amp;j_cdbs-&gt;work)-&gt;work));
[   60.277907]  *** DEADLOCK ***

[   60.277915] 6 locks held by bash/2225:
[   60.277919]  #0:  (sb_writers#6){.+.+.+}, at: [&lt;ffffffff81168173&gt;] vfs_write+0x1c3/0x1f0
[   60.277937]  #1:  (&amp;buffer-&gt;mutex){+.+.+.}, at: [&lt;ffffffff811d9e3c&gt;] sysfs_write_file+0x3c/0x150
[   60.277954]  #2:  (s_active#61){.+.+.+}, at: [&lt;ffffffff811d9ec3&gt;] sysfs_write_file+0xc3/0x150
[   60.277972]  #3:  (x86_cpu_hotplug_driver_mutex){+.+...}, at: [&lt;ffffffff81024cf7&gt;] cpu_hotplug_driver_lock+0x17/0x20
[   60.277990]  #4:  (cpu_add_remove_lock){+.+.+.}, at: [&lt;ffffffff815a0d32&gt;] cpu_down+0x22/0x50
[   60.278007]  #5:  (cpu_hotplug.lock){+.+.+.}, at: [&lt;ffffffff81042d8b&gt;] cpu_hotplug_begin+0x2b/0x60
[   60.278023] stack backtrace:
[   60.278031] CPU: 3 PID: 2225 Comm: bash Not tainted 3.10.0-rc7-dbg-01385-g241fd04-dirty #1744
[   60.278037] Hardware name: Acer             Aspire 5741G    /Aspire 5741G    , BIOS V1.20 02/08/2011
[   60.278042]  ffffffff8204e110 ffff88014df6b9f8 ffffffff815b3d90 ffff88014df6ba38
[   60.278055]  ffffffff815b0a8d ffff880150ed3f60 ffff880150ed4770 3871c4002c8980b2
[   60.278068]  ffff880150ed4748 ffff880150ed4770 ffff880150ed3f60 ffff88014df6bb00
[   60.278081] Call Trace:
[   60.278091]  [&lt;ffffffff815b3d90&gt;] dump_stack+0x19/0x1b
[   60.278101]  [&lt;ffffffff815b0a8d&gt;] print_circular_bug+0x2b6/0x2c5
[   60.278111]  [&lt;ffffffff810ab826&gt;] __lock_acquire+0x1766/0x1d30
[   60.278123]  [&lt;ffffffff81067e08&gt;] ? __kernel_text_address+0x58/0x80
[   60.278134]  [&lt;ffffffff810ac6d4&gt;] lock_acquire+0xa4/0x200
[   60.278142]  [&lt;ffffffff810621b5&gt;] ? flush_work+0x5/0x280
[   60.278151]  [&lt;ffffffff810621ed&gt;] flush_work+0x3d/0x280
[   60.278159]  [&lt;ffffffff810621b5&gt;] ? flush_work+0x5/0x280
[   60.278169]  [&lt;ffffffff810a9b14&gt;] ? mark_held_locks+0x94/0x140
[   60.278178]  [&lt;ffffffff81062d77&gt;] ? __cancel_work_timer+0x77/0x120
[   60.278188]  [&lt;ffffffff810a9cbd&gt;] ? trace_hardirqs_on_caller+0xfd/0x1c0
[   60.278196]  [&lt;ffffffff81062d8a&gt;] __cancel_work_timer+0x8a/0x120
[   60.278206]  [&lt;ffffffff81062e53&gt;] cancel_delayed_work_sync+0x13/0x20
[   60.278214]  [&lt;ffffffff814b89d9&gt;] cpufreq_governor_dbs+0x529/0x6f0
[   60.278225]  [&lt;ffffffff814b76a7&gt;] cs_cpufreq_governor_dbs+0x17/0x20
[   60.278234]  [&lt;ffffffff814b5df8&gt;] __cpufreq_governor+0x48/0x100
[   60.278244]  [&lt;ffffffff814b6b80&gt;] __cpufreq_remove_dev.isra.14+0x80/0x3c0
[   60.278255]  [&lt;ffffffff815adc0d&gt;] cpufreq_cpu_callback+0x38/0x4c
[   60.278265]  [&lt;ffffffff81071a4d&gt;] notifier_call_chain+0x5d/0x110
[   60.278275]  [&lt;ffffffff81071b0e&gt;] __raw_notifier_call_chain+0xe/0x10
[   60.278284]  [&lt;ffffffff815a0a68&gt;] _cpu_down+0x88/0x330
[   60.278292]  [&lt;ffffffff81024cf7&gt;] ? cpu_hotplug_driver_lock+0x17/0x20
[   60.278302]  [&lt;ffffffff815a0d46&gt;] cpu_down+0x36/0x50
[   60.278311]  [&lt;ffffffff815a2748&gt;] store_online+0x98/0xd0
[   60.278320]  [&lt;ffffffff81452a28&gt;] dev_attr_store+0x18/0x30
[   60.278329]  [&lt;ffffffff811d9edb&gt;] sysfs_write_file+0xdb/0x150
[   60.278337]  [&lt;ffffffff8116806d&gt;] vfs_write+0xbd/0x1f0
[   60.278347]  [&lt;ffffffff81185950&gt;] ? fget_light+0x320/0x4b0
[   60.278355]  [&lt;ffffffff811686fc&gt;] SyS_write+0x4c/0xa0
[   60.278364]  [&lt;ffffffff815bbbbe&gt;] tracesys+0xd0/0xd5
[   60.280582] smpboot: CPU 1 is now offline

The intention of that commit was to avoid warnings during CPU
hotplug, which indicated that offline CPUs were getting IPIs from the
cpufreq governor's work items.  But the real root-cause of that
problem was commit a66b2e5 (cpufreq: Preserve sysfs files across
suspend/resume) because it totally skipped all the cpufreq callbacks
during CPU hotplug in the suspend/resume path, and hence it never
actually shut down the cpufreq governor's worker threads during CPU
offline in the suspend/resume path.

Reflecting back, the reason why we never suspected that commit as the
root-cause earlier, was that the original issue was reported with
just the halt command and nobody had brought in suspend/resume to the
equation.

The reason for _that_ in turn, as it turns out, is that earlier
halt/shutdown was being done by disabling non-boot CPUs while tasks
were frozen, just like suspend/resume....  but commit cf7df378a
(reboot: migrate shutdown/reboot to boot cpu) which came somewhere
along that very same time changed that logic: shutdown/halt no longer
takes CPUs offline.  Thus, the test-cases for reproducing the bug
were vastly different and thus we went totally off the trail.

Overall, it was one hell of a confusion with so many commits
affecting each other and also affecting the symptoms of the problems
in subtle ways.  Finally, now since the original problematic commit
(a66b2e5) has been completely reverted, revert this intermediate fix
too (2f7021a8), to fix the CPU hotplug deadlock.  Phew!

Reported-by: Sergey Senozhatsky &lt;sergey.senozhatsky@gmail.com&gt;
Reported-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Tested-by: Peter Wu &lt;lekensteyn@gmail.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: Revert commit a66b2e to fix suspend/resume regression</title>
<updated>2013-07-25T21:07:23+00:00</updated>
<author>
<name>Srivatsa S. Bhat</name>
<email>srivatsa.bhat@linux.vnet.ibm.com</email>
</author>
<published>2013-07-11T22:15:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9d3ce4af3be0235d4cf41ea9fd774205a32e58a2'/>
<id>9d3ce4af3be0235d4cf41ea9fd774205a32e58a2</id>
<content type='text'>
commit aae760ed21cd690fe8a6db9f3a177ad55d7e12ab upstream.

commit a66b2e (cpufreq: Preserve sysfs files across suspend/resume)
has unfortunately caused several things in the cpufreq subsystem to
break subtly after a suspend/resume cycle.

The intention of that patch was to retain the file permissions of the
cpufreq related sysfs files across suspend/resume.  To achieve that,
the commit completely removed the calls to cpufreq_add_dev() and
__cpufreq_remove_dev() during suspend/resume transitions.  But the
problem is that those functions do 2 kinds of things:
  1. Low-level initialization/tear-down that are critical to the
     correct functioning of cpufreq-core.
  2. Kobject and sysfs related initialization/teardown.

Ideally we should have reorganized the code to cleanly separate these
two responsibilities, and skipped only the sysfs related parts during
suspend/resume.  Since we skipped the entire callbacks instead (which
also included some CPU and cpufreq-specific critical components),
cpufreq subsystem started behaving erratically after suspend/resume.

So revert the commit to fix the regression.  We'll revisit and address
the original goal of that commit separately, since it involves quite a
bit of careful code reorganization and appears to be non-trivial.

(While reverting the commit, note that another commit f51e1eb
 (cpufreq: Fix cpufreq regression after suspend/resume) already
 reverted part of the original set of changes.  So revert only the
 remaining ones).

Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Tested-by: Paul Bolle &lt;pebolle@tiscali.nl&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 aae760ed21cd690fe8a6db9f3a177ad55d7e12ab upstream.

commit a66b2e (cpufreq: Preserve sysfs files across suspend/resume)
has unfortunately caused several things in the cpufreq subsystem to
break subtly after a suspend/resume cycle.

The intention of that patch was to retain the file permissions of the
cpufreq related sysfs files across suspend/resume.  To achieve that,
the commit completely removed the calls to cpufreq_add_dev() and
__cpufreq_remove_dev() during suspend/resume transitions.  But the
problem is that those functions do 2 kinds of things:
  1. Low-level initialization/tear-down that are critical to the
     correct functioning of cpufreq-core.
  2. Kobject and sysfs related initialization/teardown.

Ideally we should have reorganized the code to cleanly separate these
two responsibilities, and skipped only the sysfs related parts during
suspend/resume.  Since we skipped the entire callbacks instead (which
also included some CPU and cpufreq-specific critical components),
cpufreq subsystem started behaving erratically after suspend/resume.

So revert the commit to fix the regression.  We'll revisit and address
the original goal of that commit separately, since it involves quite a
bit of careful code reorganization and appears to be non-trivial.

(While reverting the commit, note that another commit f51e1eb
 (cpufreq: Fix cpufreq regression after suspend/resume) already
 reverted part of the original set of changes.  So revert only the
 remaining ones).

Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Tested-by: Paul Bolle &lt;pebolle@tiscali.nl&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: Fix cpufreq regression after suspend/resume</title>
<updated>2013-07-13T18:42:27+00:00</updated>
<author>
<name>Srivatsa S. Bhat</name>
<email>srivatsa.bhat@linux.vnet.ibm.com</email>
</author>
<published>2013-06-30T22:40:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c02527487f0c8feb578c0394ad481a97f26d3bd2'/>
<id>c02527487f0c8feb578c0394ad481a97f26d3bd2</id>
<content type='text'>
commit f51e1eb63d9c28cec188337ee656a13be6980cfd upstream.

Toralf Förster reported that the cpufreq ondemand governor behaves erratically
(doesn't scale well) after a suspend/resume cycle. The problem was that the
cpufreq subsystem's idea of the cpu frequencies differed from the actual
frequencies set in the hardware after a suspend/resume cycle. Toralf bisected
the problem to commit a66b2e5 (cpufreq: Preserve sysfs files across
suspend/resume).

Among other (harmless) things, that commit skipped the call to
cpufreq_update_policy() in the resume path. But cpufreq_update_policy() plays
an important role during resume, because it is responsible for checking if
the BIOS changed the cpu frequencies behind our back and resynchronize the
cpufreq subsystem's knowledge of the cpu frequencies, and update them
accordingly.

So, restore the call to cpufreq_update_policy() in the resume path to fix
the cpufreq regression.

Reported-and-tested-by: Toralf Förster &lt;toralf.foerster@gmx.de&gt;
Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.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 f51e1eb63d9c28cec188337ee656a13be6980cfd upstream.

Toralf Förster reported that the cpufreq ondemand governor behaves erratically
(doesn't scale well) after a suspend/resume cycle. The problem was that the
cpufreq subsystem's idea of the cpu frequencies differed from the actual
frequencies set in the hardware after a suspend/resume cycle. Toralf bisected
the problem to commit a66b2e5 (cpufreq: Preserve sysfs files across
suspend/resume).

Among other (harmless) things, that commit skipped the call to
cpufreq_update_policy() in the resume path. But cpufreq_update_policy() plays
an important role during resume, because it is responsible for checking if
the BIOS changed the cpu frequencies behind our back and resynchronize the
cpufreq subsystem's knowledge of the cpu frequencies, and update them
accordingly.

So, restore the call to cpufreq_update_policy() in the resume path to fix
the cpufreq regression.

Reported-and-tested-by: Toralf Förster &lt;toralf.foerster@gmx.de&gt;
Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.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: fix NULL pointer deference at od_set_powersave_bias()</title>
<updated>2013-06-25T20:42:37+00:00</updated>
<author>
<name>Jacob Shin</name>
<email>jacob.shin@amd.com</email>
</author>
<published>2013-06-25T20:42:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c28375583b6471c1cb833a628ab6afb5b69079d0'/>
<id>c28375583b6471c1cb833a628ab6afb5b69079d0</id>
<content type='text'>
When initializing the default powersave_bias value, we need to first
make sure that this policy is running the ondemand governor.

Reported-and-tested-by: Tim Gardner &lt;tim.gardner@canonical.com&gt;
Signed-off-by: Jacob Shin &lt;jacob.shin@amd.com&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 initializing the default powersave_bias value, we need to first
make sure that this policy is running the ondemand governor.

Reported-and-tested-by: Tim Gardner &lt;tim.gardner@canonical.com&gt;
Signed-off-by: Jacob Shin &lt;jacob.shin@amd.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()</title>
<updated>2013-06-05T11:51:29+00:00</updated>
<author>
<name>Guennadi Liakhovetski</name>
<email>g.liakhovetski@gmx.de</email>
</author>
<published>2013-02-25T17:22:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0ca684365547cd5f214b5739568dae3df5d6cec9'/>
<id>0ca684365547cd5f214b5739568dae3df5d6cec9</id>
<content type='text'>
clk_set_rate() isn't supposed to accept approximate frequencies, instead
a supported frequency should be obtained from clk_round_rate() and then
used to set the clock.

Signed-off-by: Guennadi Liakhovetski &lt;g.liakhovetski@gmx.de&gt;
Acked-by: Shawn Guo &lt;shawn.guo@linaro.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
clk_set_rate() isn't supposed to accept approximate frequencies, instead
a supported frequency should be obtained from clk_round_rate() and then
used to set the clock.

Signed-off-by: Guennadi Liakhovetski &lt;g.liakhovetski@gmx.de&gt;
Acked-by: Shawn Guo &lt;shawn.guo@linaro.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;
</pre>
</div>
</content>
</entry>
<entry>
<title>cpufreq: protect 'policy-&gt;cpus' from offlining during __gov_queue_work()</title>
<updated>2013-06-05T11:46:54+00:00</updated>
<author>
<name>Michael Wang</name>
<email>wangyun@linux.vnet.ibm.com</email>
</author>
<published>2013-06-05T08:49:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2f7021a815f20f3481c10884fe9735ce2a56db35'/>
<id>2f7021a815f20f3481c10884fe9735ce2a56db35</id>
<content type='text'>
Jiri Kosina &lt;jkosina@suse.cz&gt; and Borislav Petkov &lt;bp@alien8.de&gt;
reported the warning:

[   51.616759] ------------[ cut here ]------------
[   51.621460] WARNING: at arch/x86/kernel/smp.c:123 native_smp_send_reschedule+0x58/0x60()
[   51.629638] Modules linked in: ext2 vfat fat loop snd_hda_codec_hdmi usbhid snd_hda_codec_realtek coretemp kvm_intel kvm snd_hda_intel snd_hda_codec crc32_pclmul crc32c_intel ghash_clmulni_intel snd_hwdep snd_pcm aesni_intel sb_edac aes_x86_64 ehci_pci snd_page_alloc glue_helper snd_timer xhci_hcd snd iTCO_wdt iTCO_vendor_support ehci_hcd edac_core lpc_ich acpi_cpufreq lrw gf128mul ablk_helper cryptd mperf usbcore usb_common soundcore mfd_core dcdbas evdev pcspkr processor i2c_i801 button microcode
[   51.675581] CPU: 0 PID: 244 Comm: kworker/1:1 Tainted: G        W    3.10.0-rc1+ #10
[   51.683407] Hardware name: Dell Inc. Precision T3600/0PTTT9, BIOS A08 01/24/2013
[   51.690901] Workqueue: events od_dbs_timer
[   51.695069]  0000000000000009 ffff88043a2f5b68 ffffffff8161441c ffff88043a2f5ba8
[   51.702602]  ffffffff8103e540 0000000000000033 0000000000000001 ffff88043d5f8000
[   51.710136]  00000000ffff0ce1 0000000000000001 ffff88044fc4fc08 ffff88043a2f5bb8
[   51.717691] Call Trace:
[   51.720191]  [&lt;ffffffff8161441c&gt;] dump_stack+0x19/0x1b
[   51.725396]  [&lt;ffffffff8103e540&gt;] warn_slowpath_common+0x70/0xa0
[   51.731473]  [&lt;ffffffff8103e58a&gt;] warn_slowpath_null+0x1a/0x20
[   51.737378]  [&lt;ffffffff81025628&gt;] native_smp_send_reschedule+0x58/0x60
[   51.744013]  [&lt;ffffffff81072cfd&gt;] wake_up_nohz_cpu+0x2d/0xa0
[   51.749745]  [&lt;ffffffff8104f6bf&gt;] add_timer_on+0x8f/0x110
[   51.755214]  [&lt;ffffffff8105f6fe&gt;] __queue_delayed_work+0x16e/0x1a0
[   51.761470]  [&lt;ffffffff8105f251&gt;] ? try_to_grab_pending+0xd1/0x1a0
[   51.767724]  [&lt;ffffffff8105f78a&gt;] mod_delayed_work_on+0x5a/0xa0
[   51.773719]  [&lt;ffffffff814f6b5d&gt;] gov_queue_work+0x4d/0xc0
[   51.779271]  [&lt;ffffffff814f60cb&gt;] od_dbs_timer+0xcb/0x170
[   51.784734]  [&lt;ffffffff8105e75d&gt;] process_one_work+0x1fd/0x540
[   51.790634]  [&lt;ffffffff8105e6f2&gt;] ? process_one_work+0x192/0x540
[   51.796711]  [&lt;ffffffff8105ef22&gt;] worker_thread+0x122/0x380
[   51.802350]  [&lt;ffffffff8105ee00&gt;] ? rescuer_thread+0x320/0x320
[   51.808264]  [&lt;ffffffff8106634a&gt;] kthread+0xea/0xf0
[   51.813200]  [&lt;ffffffff81066260&gt;] ? flush_kthread_worker+0x150/0x150
[   51.819644]  [&lt;ffffffff81623d5c&gt;] ret_from_fork+0x7c/0xb0
[   51.918165] nouveau E[     DRM] GPU lockup - switching to software fbcon
[   51.930505]  [&lt;ffffffff81066260&gt;] ? flush_kthread_worker+0x150/0x150
[   51.936994] ---[ end trace f419538ada83b5c5 ]---

It was caused by the policy-&gt;cpus changed during the process of
__gov_queue_work(), in other word, cpu offline happened.

Use get/put_online_cpus() to prevent the offline from happening while
__gov_queue_work() is running.

[rjw: The problem has been present since recent commit 031299b
(cpufreq: governors: Avoid unnecessary per cpu timer interrupts)]

References: https://lkml.org/lkml/2013/6/5/88
Reported-by: Borislav Petkov &lt;bp@alien8.de&gt;
Reported-and-tested-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Michael Wang &lt;wangyun@linux.vnet.ibm.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;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Jiri Kosina &lt;jkosina@suse.cz&gt; and Borislav Petkov &lt;bp@alien8.de&gt;
reported the warning:

[   51.616759] ------------[ cut here ]------------
[   51.621460] WARNING: at arch/x86/kernel/smp.c:123 native_smp_send_reschedule+0x58/0x60()
[   51.629638] Modules linked in: ext2 vfat fat loop snd_hda_codec_hdmi usbhid snd_hda_codec_realtek coretemp kvm_intel kvm snd_hda_intel snd_hda_codec crc32_pclmul crc32c_intel ghash_clmulni_intel snd_hwdep snd_pcm aesni_intel sb_edac aes_x86_64 ehci_pci snd_page_alloc glue_helper snd_timer xhci_hcd snd iTCO_wdt iTCO_vendor_support ehci_hcd edac_core lpc_ich acpi_cpufreq lrw gf128mul ablk_helper cryptd mperf usbcore usb_common soundcore mfd_core dcdbas evdev pcspkr processor i2c_i801 button microcode
[   51.675581] CPU: 0 PID: 244 Comm: kworker/1:1 Tainted: G        W    3.10.0-rc1+ #10
[   51.683407] Hardware name: Dell Inc. Precision T3600/0PTTT9, BIOS A08 01/24/2013
[   51.690901] Workqueue: events od_dbs_timer
[   51.695069]  0000000000000009 ffff88043a2f5b68 ffffffff8161441c ffff88043a2f5ba8
[   51.702602]  ffffffff8103e540 0000000000000033 0000000000000001 ffff88043d5f8000
[   51.710136]  00000000ffff0ce1 0000000000000001 ffff88044fc4fc08 ffff88043a2f5bb8
[   51.717691] Call Trace:
[   51.720191]  [&lt;ffffffff8161441c&gt;] dump_stack+0x19/0x1b
[   51.725396]  [&lt;ffffffff8103e540&gt;] warn_slowpath_common+0x70/0xa0
[   51.731473]  [&lt;ffffffff8103e58a&gt;] warn_slowpath_null+0x1a/0x20
[   51.737378]  [&lt;ffffffff81025628&gt;] native_smp_send_reschedule+0x58/0x60
[   51.744013]  [&lt;ffffffff81072cfd&gt;] wake_up_nohz_cpu+0x2d/0xa0
[   51.749745]  [&lt;ffffffff8104f6bf&gt;] add_timer_on+0x8f/0x110
[   51.755214]  [&lt;ffffffff8105f6fe&gt;] __queue_delayed_work+0x16e/0x1a0
[   51.761470]  [&lt;ffffffff8105f251&gt;] ? try_to_grab_pending+0xd1/0x1a0
[   51.767724]  [&lt;ffffffff8105f78a&gt;] mod_delayed_work_on+0x5a/0xa0
[   51.773719]  [&lt;ffffffff814f6b5d&gt;] gov_queue_work+0x4d/0xc0
[   51.779271]  [&lt;ffffffff814f60cb&gt;] od_dbs_timer+0xcb/0x170
[   51.784734]  [&lt;ffffffff8105e75d&gt;] process_one_work+0x1fd/0x540
[   51.790634]  [&lt;ffffffff8105e6f2&gt;] ? process_one_work+0x192/0x540
[   51.796711]  [&lt;ffffffff8105ef22&gt;] worker_thread+0x122/0x380
[   51.802350]  [&lt;ffffffff8105ee00&gt;] ? rescuer_thread+0x320/0x320
[   51.808264]  [&lt;ffffffff8106634a&gt;] kthread+0xea/0xf0
[   51.813200]  [&lt;ffffffff81066260&gt;] ? flush_kthread_worker+0x150/0x150
[   51.819644]  [&lt;ffffffff81623d5c&gt;] ret_from_fork+0x7c/0xb0
[   51.918165] nouveau E[     DRM] GPU lockup - switching to software fbcon
[   51.930505]  [&lt;ffffffff81066260&gt;] ? flush_kthread_worker+0x150/0x150
[   51.936994] ---[ end trace f419538ada83b5c5 ]---

It was caused by the policy-&gt;cpus changed during the process of
__gov_queue_work(), in other word, cpu offline happened.

Use get/put_online_cpus() to prevent the offline from happening while
__gov_queue_work() is running.

[rjw: The problem has been present since recent commit 031299b
(cpufreq: governors: Avoid unnecessary per cpu timer interrupts)]

References: https://lkml.org/lkml/2013/6/5/88
Reported-by: Borislav Petkov &lt;bp@alien8.de&gt;
Reported-and-tested-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Michael Wang &lt;wangyun@linux.vnet.ibm.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;
</pre>
</div>
</content>
</entry>
</feed>
