From: Denis Kirjanov <kda@linux-powerpc.org>
To: rjw@rjwysocki.net, viresh.kumar@linaro.org
Cc: linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
ego@linux.vnet.ibm.com, shilpa.bhat@linux.vnet.ibm.com,
akshay.adiga@linux.vnet.ibm.com,
Denis Kirjanov <kda@linux-powerpc.org>
Subject: [PATCH v2] cpufreq, powernv: Disable preemption while checking CPU throttling state throttling state
Date: Tue, 8 Nov 2016 05:39:28 -0500 [thread overview]
Message-ID: <1478601568-15728-1-git-send-email-kda@linux-powerpc.org> (raw)
With preemption turned on we can read incorrect throttling state while being switched
to CPU on a different chip.
[ 67.700897] BUG: using smp_processor_id() in preemptible [00000000] code: cat/7343
[ 67.700988] caller is .powernv_cpufreq_throttle_check+0x2c/0x710
[ 67.700998] CPU: 13 PID: 7343 Comm: cat Not tainted 4.8.0-rc5-dirty #1
[ 67.701038] Call Trace:
[ 67.701066] [c0000007d25b75b0] [c000000000971378] .dump_stack+0xe4/0x150 (unreliable)
[ 67.701153] [c0000007d25b7640] [c0000000005162e4] .check_preemption_disabled+0x134/0x150
[ 67.701238] [c0000007d25b76e0] [c0000000007b63ac] .powernv_cpufreq_throttle_check+0x2c/0x710
[ 67.701322] [c0000007d25b7790] [c0000000007b6d18] .powernv_cpufreq_target_index+0x288/0x360
[ 67.701407] [c0000007d25b7870] [c0000000007acee4] .__cpufreq_driver_target+0x394/0x8c0
[ 67.701491] [c0000007d25b7920] [c0000000007b22ac] .cpufreq_set+0x7c/0xd0
[ 67.701565] [c0000007d25b79b0] [c0000000007adf50] .store_scaling_setspeed+0x80/0xc0
[ 67.701650] [c0000007d25b7a40] [c0000000007ae270] .store+0xa0/0x100
[ 67.701723] [c0000007d25b7ae0] [c0000000003566e8] .sysfs_kf_write+0x88/0xb0
[ 67.701796] [c0000007d25b7b70] [c0000000003553b8] .kernfs_fop_write+0x178/0x260
[ 67.701881] [c0000007d25b7c10] [c0000000002ac3cc] .__vfs_write+0x3c/0x1c0
[ 67.701954] [c0000007d25b7cf0] [c0000000002ad584] .vfs_write+0xc4/0x230
[ 67.702027] [c0000007d25b7d90] [c0000000002aeef8] .SyS_write+0x58/0x100
[ 67.702101] [c0000007d25b7e30] [c00000000000bfec] system_call+0x38/0xfc
Fixes: 09a972d16209 ("cpufreq: powernv: Report cpu frequency throttling")
Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
v2: added patch description
drivers/cpufreq/powernv-cpufreq.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
index d3ffde8..a84724e 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -647,8 +647,14 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
if (unlikely(rebooting) && new_index != get_nominal_index())
return 0;
- if (!throttled)
+ if (!throttled) {
+ /* we don't want to be preempted while
+ * checking if the CPU frequency has been throttled
+ */
+ preempt_disable();
powernv_cpufreq_throttle_check(NULL);
+ preempt_enable();
+ }
cur_msec = jiffies_to_msecs(get_jiffies_64());
--
1.8.3.1
next reply other threads:[~2016-11-08 10:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 10:39 Denis Kirjanov [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-11-22 13:07 [PATCH v2] cpufreq, powernv: Disable preemption while checking CPU throttling state throttling state Denis Kirjanov
2016-11-22 22:44 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1478601568-15728-1-git-send-email-kda@linux-powerpc.org \
--to=kda@linux-powerpc.org \
--cc=akshay.adiga@linux.vnet.ibm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=linux-pm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=rjw@rjwysocki.net \
--cc=shilpa.bhat@linux.vnet.ibm.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).