From: Victor Aoqui <victora@linux.vnet.ibm.com>
To: rjw@rjwysocki.net, daniel.lezcano@linaro.org,
benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au,
linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Cc: ltc-interlock@lists.linux.ibm.com, victora@br.ibm.com,
victora@linux.vnet.ibm.com, mauricfo@linux.vnet.ibm.com
Subject: [PATCH] drivers: cpuidle: Disable preemption before get_lppaca function call in pseries_idle_probe function
Date: Thu, 20 Jul 2017 14:57:35 -0300 [thread overview]
Message-ID: <20170720175735.3957-1-victora@linux.vnet.ibm.com> (raw)
When CONFIG_PREEMPT=y, the following warning shows up:
BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is pseries_processor_idle_init+0x58/0x21c
This warning shows up because preemption cannot occur when using
get_paca(), otherwise the paca_struct it points to may be the wrong one
just after.
For this reason, preemption needs to be disabled before
lppaca_shared_proc(get_lppaca()).
Signed-off-by: Victor Aoqui <victora@linux.vnet.ibm.com>
---
drivers/cpuidle/cpuidle-pseries.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
index e9b3853..d6dda8c 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -233,12 +233,16 @@ static int pseries_cpuidle_driver_init(void)
*/
static int pseries_idle_probe(void)
{
+ int retval;
if (cpuidle_disable != IDLE_NO_OVERRIDE)
return -ENODEV;
if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
- if (lppaca_shared_proc(get_lppaca())) {
+ preempt_disable();
+ retval = lppaca_shared_proc(get_lppaca());
+ preempt_enable();
+ if (retval) {
cpuidle_state_table = shared_states;
max_idle_state = ARRAY_SIZE(shared_states);
} else {
--
1.8.3.1
next reply other threads:[~2017-07-20 17:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 17:57 Victor Aoqui [this message]
2017-07-20 21:21 ` [PATCH] drivers: cpuidle: Disable preemption before get_lppaca function call in pseries_idle_probe function Benjamin Herrenschmidt
2017-08-01 12:28 ` Victor Aoqui
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=20170720175735.3957-1-victora@linux.vnet.ibm.com \
--to=victora@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ltc-interlock@lists.linux.ibm.com \
--cc=mauricfo@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=rjw@rjwysocki.net \
--cc=victora@br.ibm.com \
/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).