linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc : Fix sleeping-in-atomic section warning triggered by /proc/cpuinfo
@ 2018-01-10  9:52 Shriya
  0 siblings, 0 replies; only message in thread
From: Shriya @ 2018-01-10  9:52 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: aneesh.kumar, ego, svaidy, akshay.adiga, shilpa.bhat, npiggin,
	Shriya

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-10  9:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10  9:52 [PATCH] powerpc : Fix sleeping-in-atomic section warning triggered by /proc/cpuinfo Shriya

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).