Skip to contentSkip to conversation

powerpc: Don't preempt_disable() in show_cpuinfo()

PATCH Applied Benjamin Herrenschmidt 2 participants 7 messages Jan 10, 2018 – Jan 17, 2018 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 powerpc: Don't preempt_disable() in show_cpuinfo()

This causes warnings from cpufreq mutex code. This is also rather unnecessary and ineffective. If we really want to prevent concurrent unplug, we could take the unplug read lock but I don't see this being critical.

---
 arch/powerpc/kernel/setup-common.c | 11 -----------
 1 file changed, 11 deletions(-)
arch/powerpc/kernel/setup-common.c +0 -11
index 9d213542a48b..8fd3a70047f1 100644
@@ -242,14 +242,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	unsigned short maj;
 	unsigned short min;
 
-	/* We only show online cpus: disable preempt (overzealous, I
-	 * knew) to prevent cpu going down. */
-	preempt_disable();
-	if (!cpu_online(cpu_id)) {
-		preempt_enable();
-		return 0;
-	}
-
 #ifdef CONFIG_SMP
 	pvr = per_cpu(cpu_pvr, cpu_id);
 #else
@@ -358,9 +350,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 #ifdef CONFIG_SMP
 	seq_printf(m, "\n");
 #endif
-
-	preempt_enable();
-
 	/* If this is the last cpu, print the summary */
 	if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
 		show_cpuinfo_summary(m);
Signature · 1 line
2.14.3
#1 lore raw

PATCH 2/3 powerpc: Make newline in cpuinfo unconditional

We used to not put the newline between the CPU part and the summary part on UP kernels. This is a rather pointless ifdef so take it out.

---
 arch/powerpc/kernel/setup-common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/kernel/setup-common.c +1 -3
index 8fd3a70047f1..c1df4ba0094c 100644
@@ -346,10 +346,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		   loops_per_jiffy / (500000/HZ),
 		   (loops_per_jiffy / (5000/HZ)) % 100);
 #endif
-
-#ifdef CONFIG_SMP
 	seq_printf(m, "\n");
-#endif
+
 	/* If this is the last cpu, print the summary */
 	if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
 		show_cpuinfo_summary(m);
Signature · 1 line
2.14.3
#3 lore raw

PATCH 3/3 powerpc: Cosmetic cleanup of cpuinfo_op

In reply to Benjamin Herrenschmidt
---
 arch/powerpc/kernel/setup-common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/setup-common.c +4 -4
index c1df4ba0094c..9f9524bdd3f1 100644
@@ -377,10 +377,10 @@ static void c_stop(struct seq_file *m, void *v)
 }
 
 const struct seq_operations cpuinfo_op = {
-	.start =c_start,
-	.next =	c_next,
-	.stop =	c_stop,
-	.show =	show_cpuinfo,
+	.start	= c_start,
+	.next	= c_next,
+	.stop	= c_stop,
+	.show	= show_cpuinfo,
 };
 
 void __init check_for_initrd(void)
Signature · 1 line
2.14.3
#5 lore raw
In reply to Benjamin Herrenschmidt
Quoted 6 lines · Benjamin Herrenschmidt

This causes warnings from cpufreq mutex code. This is also rather unnecessary and ineffective. If we really want to prevent concurrent unplug, we could take the unplug read lock but I don't see this being critical.

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/349524bc0da698ec77f2057cf4a494

cheers

#6 lore raw
In reply to Benjamin Herrenschmidt
Quoted 6 lines · Benjamin Herrenschmidt

This causes warnings from cpufreq mutex code. This is also rather unnecessary and ineffective. If we really want to prevent concurrent unplug, we could take the unplug read lock but I don't see this being critical.

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/349524bc0da698ec77f2057cf4a494

cheers