Skip to contentSkip to conversation

arm64: smp: Update the topology masks before calling CPU_STARTING notifiers

PATCH In review Rohit Vaswani 2 participants 3 messages Aug 13, 2014 – Aug 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: smp: Update the topology masks before calling CPU_STARTING notifiers

Currently, the CPU_STARTING notifiers would observe an incorrect sibling mask since the notifier chain is called before the topology masks are updated for the new cpu.
Update the topology masks before calling the notifier chain to fix this problem.

---
 arch/arm/kernel/smp.c   | 4 ++--
 arch/arm64/kernel/smp.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/kernel/smp.c +2 -2
index 7c4fada..0e2237c 100644
@@ -363,12 +363,12 @@ asmlinkage void secondary_start_kernel(void)
 	if (smp_ops.smp_secondary_init)
 		smp_ops.smp_secondary_init(cpu);
 
+	smp_store_cpu_info(cpu);
+
 	notify_cpu_starting(cpu);
 
 	calibrate_delay();
 
-	smp_store_cpu_info(cpu);
-
 	/*
 	 * OK, now it's safe to let the boot CPU continue.  Wait for
 	 * the CPU migration code to notice that the CPU is online
arch/arm64/kernel/smp.c +2 -2
index 3e2f5eb..4ae78fe 100644
@@ -163,10 +163,10 @@ asmlinkage void secondary_start_kernel(void)
 	/*
 	 * Enable GIC and timers.
 	 */
-	notify_cpu_starting(cpu);
-
 	smp_store_cpu_info(cpu);
 
+	notify_cpu_starting(cpu);
+
 	/*
 	 * OK, now it's safe to let the boot CPU continue.  Wait for
 	 * the CPU migration code to notice that the CPU is online
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw
Quoted 18 lines · Rohit Vaswani

Currently, the CPU_STARTING notifiers would observe an incorrect sibling mask since the notifier chain is called before the topology masks are updated for the new cpu.
Update the topology masks before calling the notifier chain to fix this problem.

---
 arch/arm/kernel/smp.c   | 4 ++--
 arch/arm64/kernel/smp.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/kernel/smp.c +0 -0
index 7c4fada..0e2237c 100644
@@ -363,12 +363,12 @@ asmlinkage void secondary_start_kernel(void)
 	if (smp_ops.smp_secondary_init)

arch/arm/kernel/smp.c asmlinkage void secondary_start_kernel(void) · line 371

Quoted 10 lines
arch/arm/kernel/smp.c +2 -2
 		smp_ops.smp_secondary_init(cpu);
 
+	smp_store_cpu_info(cpu);
+
 	notify_cpu_starting(cpu);
 
 	calibrate_delay();
 
-	smp_store_cpu_info(cpu);
-

Hmm, smp_store_cpu_info takes a copy of loops_per_jiffy. Are you sure it's safe to move the call before calibrate_delay?

Will

#2 lore raw
Quoted 25 lines · Will Deacon
Quoted 24 lines · Rohit Vaswani

Currently, the CPU_STARTING notifiers would observe an incorrect sibling mask since the notifier chain is called before the topology masks are updated for the new cpu.
Update the topology masks before calling the notifier chain to fix this problem.

---
  arch/arm/kernel/smp.c   | 4 ++--
  arch/arm64/kernel/smp.c | 4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/kernel/smp.c +2 -0
index 7c4fada..0e2237c 100644
@@ -363,12 +363,12 @@ asmlinkage void secondary_start_kernel(void)
  	if (smp_ops.smp_secondary_init)
  		smp_ops.smp_secondary_init(cpu);
 
+	smp_store_cpu_info(cpu);
+
  	notify_cpu_starting(cpu);
 
Quoted 6 lines

arch/arm/kernel/smp.c asmlinkage void secondary_start_kernel(void) · line 371

Quoted 4 lines
arch/arm/kernel/smp.c +0 -2
  	calibrate_delay();
 
-	smp_store_cpu_info(cpu);
-

Hmm, smp_store_cpu_info takes a copy of loops_per_jiffy. Are you sure it's safe to move the call before calibrate_delay?

Right! - I had looked at the arm64 version . I checked for arm32 now and I think we should be
safe to move calibrate_delay before the smp_store_cpu_info and I can push a v2 version if
there are no concerns. I did not see calibrate_delay having any dependency for cpu_starting notifiers.

-Rohit

Quoted 1 line

Will

Thanks,
Rohit Vaswani

Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation