Skip to contentSkip to conversation

arm64: Reduce verbosity on SMP CPU stop

PATCH In review Jan Glauber 3 participants 5 messages Apr 15, 2016 – Apr 18, 2016 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: Reduce verbosity on SMP CPU stop

When CPUs are stopped during an abnormal operation like panic for each CPU a line is printed and the stack trace is dumped.

This information is only interesting for the aborting CPU and on systems with many CPUs it only makes it harder to debug if after the aborting CPU the log is flooded with data about all other CPUs too.

Therefore remove the stack dump and printk of other CPUs and only print a single line that the other CPUs are going to be stopped.

---
 arch/arm64/kernel/smp.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
arch/arm64/kernel/smp.c +3 -8
index b2d5f4e..e6c2eb1 100644
@@ -770,14 +770,6 @@ static DEFINE_RAW_SPINLOCK(stop_lock);
  */
 static void ipi_cpu_stop(unsigned int cpu)
 {
-	if (system_state == SYSTEM_BOOTING ||
-	    system_state == SYSTEM_RUNNING) {
-		raw_spin_lock(&stop_lock);
-		pr_crit("CPU%u: stopping\n", cpu);
-		dump_stack();
-		raw_spin_unlock(&stop_lock);
-	}
-
 	set_cpu_online(cpu, false);
 
 	local_irq_disable();
@@ -872,6 +864,9 @@ void smp_send_stop(void)
 		cpumask_copy(&mask, cpu_online_mask);
 		cpumask_clear_cpu(smp_processor_id(), &mask);
 
+		if (system_state == SYSTEM_BOOTING ||
+		    system_state == SYSTEM_RUNNING)
+			pr_crit("SMP: stopping secondary CPUs\n");
 		smp_cross_call(&mask, IPI_CPU_STOP);
 	}
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 37 lines · Jan Glauber

When CPUs are stopped during an abnormal operation like panic for each CPU a line is printed and the stack trace is dumped.

This information is only interesting for the aborting CPU and on systems with many CPUs it only makes it harder to debug if after the aborting CPU the log is flooded with data about all other CPUs too.

Therefore remove the stack dump and printk of other CPUs and only print a single line that the other CPUs are going to be stopped.

---
 arch/arm64/kernel/smp.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
arch/arm64/kernel/smp.c +0 -8
index b2d5f4e..e6c2eb1 100644
@@ -770,14 +770,6 @@ static DEFINE_RAW_SPINLOCK(stop_lock);
  */
 static void ipi_cpu_stop(unsigned int cpu)
 {
-	if (system_state == SYSTEM_BOOTING ||
-	    system_state == SYSTEM_RUNNING) {
-		raw_spin_lock(&stop_lock);
-		pr_crit("CPU%u: stopping\n", cpu);
-		dump_stack();
-		raw_spin_unlock(&stop_lock);
-	}
-
 	set_cpu_online(cpu, false);
 
 	local_irq_disable();

arch/arm64/kernel/smp.c void smp_send_stop(void) · line 869

Quoted 6 lines
arch/arm64/kernel/smp.c +3 -0
@@ -872,6 +864,9 @@ void smp_send_stop(void)
 		cpumask_copy(&mask, cpu_online_mask);
 		cpumask_clear_cpu(smp_processor_id(), &mask);
 
+		if (system_state == SYSTEM_BOOTING ||
+		    system_state == SYSTEM_RUNNING)
+			pr_crit("SMP: stopping secondary CPUs\n");

You can remove stop_lock altogether now, right? I also wonder whether it would be worth printing out which CPUs are still online in the case where we fail to stop all the secondaries?

Will

#2 lore raw

PATCH v2 1/1 arm64: Reduce verbosity on SMP CPU stop

Quoted 3 lines · Will Deacon

You can remove stop_lock altogether now, right? I also wonder whether it would be worth printing out which CPUs are still online in the case where we fail to stop all the secondaries?

Sorry, I've been a bit offline. Yes, the stop_lock can also be removed.

How about below patch that prints the CPU ids for all CPUs that failed to stop?

Jan

--------------------------------

When CPUs are stopped during an abnormal operation like panic for each CPU a line is printed and the stack trace is dumped.

This information is only interesting for the aborting CPU and on systems with many CPUs it only makes it harder to debug if after the aborting CPU the log is flooded with data about all other CPUs too.

Therefore remove the stack dump and printk of other CPUs and only print a single line that the other CPUs are going to be stopped and, in case any CPUs remain online list them.

---
 arch/arm64/kernel/smp.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
arch/arm64/kernel/smp.c +5 -11
index b2d5f4e..29f4e37 100644
@@ -763,21 +763,11 @@ void arch_irq_work_raise(void)
 }
 #endif
 
-static DEFINE_RAW_SPINLOCK(stop_lock);
-
 /*
  * ipi_cpu_stop - handle IPI from smp_send_stop()
  */
 static void ipi_cpu_stop(unsigned int cpu)
 {
-	if (system_state == SYSTEM_BOOTING ||
-	    system_state == SYSTEM_RUNNING) {
-		raw_spin_lock(&stop_lock);
-		pr_crit("CPU%u: stopping\n", cpu);
-		dump_stack();
-		raw_spin_unlock(&stop_lock);
-	}
-
 	set_cpu_online(cpu, false);
 
 	local_irq_disable();
@@ -872,6 +862,9 @@ void smp_send_stop(void)
 		cpumask_copy(&mask, cpu_online_mask);
 		cpumask_clear_cpu(smp_processor_id(), &mask);
 
+		if (system_state == SYSTEM_BOOTING ||
+		    system_state == SYSTEM_RUNNING)
+			pr_crit("SMP: stopping secondary CPUs\n");
 		smp_cross_call(&mask, IPI_CPU_STOP);
 	}
 
@@ -881,7 +874,8 @@ void smp_send_stop(void)
 		udelay(1);
 
 	if (num_online_cpus() > 1)
-		pr_warning("SMP: failed to stop secondary CPUs\n");
+		pr_warning("SMP: failed to stop secondary CPUs %*pbl\n",
+			   cpumask_pr_args(cpu_online_mask));
 }
 
 /*
Signature · 1 line
1.9.1
#3 lore raw
Quoted 9 lines · Jan Glauber
Quoted 3 lines · Will Deacon

You can remove stop_lock altogether now, right? I also wonder whether it would be worth printing out which CPUs are still online in the case where we fail to stop all the secondaries?

Sorry, I've been a bit offline. Yes, the stop_lock can also be removed.

How about below patch that prints the CPU ids for all CPUs that failed to stop?

Yeah, this looks better, thanks. We might want to clear the "stopper" CPU from the mask, but it's hard to really care that much.

Will

Quoted 71 lines

Jan

--------------------------------

When CPUs are stopped during an abnormal operation like panic for each CPU a line is printed and the stack trace is dumped.

This information is only interesting for the aborting CPU and on systems with many CPUs it only makes it harder to debug if after the aborting CPU the log is flooded with data about all other CPUs too.

Therefore remove the stack dump and printk of other CPUs and only print a single line that the other CPUs are going to be stopped and, in case any CPUs remain online list them.

---
 arch/arm64/kernel/smp.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
arch/arm64/kernel/smp.c +5 -11
index b2d5f4e..29f4e37 100644
@@ -763,21 +763,11 @@ void arch_irq_work_raise(void)
 }
 #endif
 
-static DEFINE_RAW_SPINLOCK(stop_lock);
-
 /*
  * ipi_cpu_stop - handle IPI from smp_send_stop()
  */
 static void ipi_cpu_stop(unsigned int cpu)
 {
-	if (system_state == SYSTEM_BOOTING ||
-	    system_state == SYSTEM_RUNNING) {
-		raw_spin_lock(&stop_lock);
-		pr_crit("CPU%u: stopping\n", cpu);
-		dump_stack();
-		raw_spin_unlock(&stop_lock);
-	}
-
 	set_cpu_online(cpu, false);
 
 	local_irq_disable();
@@ -872,6 +862,9 @@ void smp_send_stop(void)
 		cpumask_copy(&mask, cpu_online_mask);
 		cpumask_clear_cpu(smp_processor_id(), &mask);
 
+		if (system_state == SYSTEM_BOOTING ||
+		    system_state == SYSTEM_RUNNING)
+			pr_crit("SMP: stopping secondary CPUs\n");
 		smp_cross_call(&mask, IPI_CPU_STOP);
 	}
 
@@ -881,7 +874,8 @@ void smp_send_stop(void)
 		udelay(1);
 
 	if (num_online_cpus() > 1)
-		pr_warning("SMP: failed to stop secondary CPUs\n");
+		pr_warning("SMP: failed to stop secondary CPUs %*pbl\n",
+			   cpumask_pr_args(cpu_online_mask));
 }
 
 /*
Signature · 1 line
1.9.1
#4 lore raw
Quoted 6 lines · Will Deacon
Quoted 5 lines · Jan Glauber
Quoted 3 lines · Will Deacon

You can remove stop_lock altogether now, right? I also wonder whether it would be worth printing out which CPUs are still online in the case where we fail to stop all the secondaries?

Quoted 7 lines
Quoted 4 lines

Sorry, I've been a bit offline. Yes, the stop_lock can also be removed.

How about below patch that prints the CPU ids for all CPUs that failed to stop?

Yeah, this looks better, thanks. We might want to clear the "stopper" CPU from the mask, but it's hard to really care that much.

Then let's not do it, the fact that "the CPU that executes this code is also still online" is not too wrong...

Jan

Quoted 73 lines

Will

Quoted 71 lines

Jan

--------------------------------

When CPUs are stopped during an abnormal operation like panic for each CPU a line is printed and the stack trace is dumped.

This information is only interesting for the aborting CPU and on systems with many CPUs it only makes it harder to debug if after the aborting CPU the log is flooded with data about all other CPUs too.

Therefore remove the stack dump and printk of other CPUs and only print a single line that the other CPUs are going to be stopped and, in case any CPUs remain online list them.

---
 arch/arm64/kernel/smp.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
arch/arm64/kernel/smp.c +5 -11
index b2d5f4e..29f4e37 100644
@@ -763,21 +763,11 @@ void arch_irq_work_raise(void)
 }
 #endif
 
-static DEFINE_RAW_SPINLOCK(stop_lock);
-
 /*
  * ipi_cpu_stop - handle IPI from smp_send_stop()
  */
 static void ipi_cpu_stop(unsigned int cpu)
 {
-	if (system_state == SYSTEM_BOOTING ||
-	    system_state == SYSTEM_RUNNING) {
-		raw_spin_lock(&stop_lock);
-		pr_crit("CPU%u: stopping\n", cpu);
-		dump_stack();
-		raw_spin_unlock(&stop_lock);
-	}
-
 	set_cpu_online(cpu, false);
 
 	local_irq_disable();
@@ -872,6 +862,9 @@ void smp_send_stop(void)
 		cpumask_copy(&mask, cpu_online_mask);
 		cpumask_clear_cpu(smp_processor_id(), &mask);
 
+		if (system_state == SYSTEM_BOOTING ||
+		    system_state == SYSTEM_RUNNING)
+			pr_crit("SMP: stopping secondary CPUs\n");
 		smp_cross_call(&mask, IPI_CPU_STOP);
 	}
 
@@ -881,7 +874,8 @@ void smp_send_stop(void)
 		udelay(1);
 
 	if (num_online_cpus() > 1)
-		pr_warning("SMP: failed to stop secondary CPUs\n");
+		pr_warning("SMP: failed to stop secondary CPUs %*pbl\n",
+			   cpumask_pr_args(cpu_online_mask));
 }
 
 /*
Signature · 1 line
1.9.1