From: Shriya <shriyak@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: aneesh.kumar@linux.vnet.ibm.com, ego@linux.vnet.ibm.com,
svaidy@linux.vnet.ibm.com, akshay.adiga@linux.vnet.ibm.com,
shilpa.bhat@linux.vnet.ibm.com, npiggin@gmail.com,
Shriya <shriyak@linux.vnet.ibm.com>
Subject: [PATCH] powerpc : Fix sleeping-in-atomic section warning triggered by /proc/cpuinfo
Date: Wed, 10 Jan 2018 15:22:58 +0530 [thread overview]
Message-ID: <1515577978-21701-1-git-send-email-shriyak@linux.vnet.ibm.com> (raw)
Commit cd77b5ce208c ("Fix the frequency read by /proc/cpuinfo")
to fix /proc/cpuinfo on POWERNV triggered a sleeping-in-atomic section
warning. This was because the place where we cpufreq_get (which takes
an rwsem) from show_cpuinfo is in a preempt_disabled. However, the
preempt_disable() in show_cpuinfo is for protection against
CPU-Hotplug, since we don't want to report the information of offline
CPUs in /proc/cpuinfo.
Fix this by replacing preempt_disable()/preempt_enable() in
show_cpuinfo() by get_online_cpus()/put_online_cpus() giving a proper
protection against CPU-Hotplug.
---
arch/powerpc/kernel/setup-common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 2075322..f772442 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -244,9 +244,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
/* We only show online cpus: disable preempt (overzealous, I
* knew) to prevent cpu going down. */
- preempt_disable();
+ get_online_cpus();
if (!cpu_online(cpu_id)) {
- preempt_enable();
+ put_online_cpus();
return 0;
}
@@ -359,7 +359,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, "\n");
#endif
- preempt_enable();
+ put_online_cpus();
/* If this is the last cpu, print the summary */
if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
--
1.9.1
reply other threads:[~2018-01-10 9:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1515577978-21701-1-git-send-email-shriyak@linux.vnet.ibm.com \
--to=shriyak@linux.vnet.ibm.com \
--cc=akshay.adiga@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=shilpa.bhat@linux.vnet.ibm.com \
--cc=svaidy@linux.vnet.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).