Skip to contentSkip to conversation

x86: Don't copy per_cpu cpuinfo for BSP two times

PATCH In review Yinghai Lu 2 participants 3 messages Jan 21, 2011 – Jan 26, 2011 x86

lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 x86: Don't copy per_cpu cpuinfo for BSP two times

smp_store_cpu_info(0) will do that.

---
 arch/x86/kernel/smpboot.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/smpboot.c +3 -3
Index: linux-2.6/arch/x86/kernel/smpboot.c
===================================================================
@@ -1071,13 +1071,13 @@ void __init native_smp_prepare_cpus(unsi
 
 	preempt_disable();
 	smp_cpu_index_default();
-	memcpy(__this_cpu_ptr(&cpu_info), &boot_cpu_data, sizeof(cpu_info));
-	cpumask_copy(cpu_callin_mask, cpumask_of(0));
-	mb();
+
 	/*
 	 * Setup boot CPU information
 	 */
 	smp_store_cpu_info(0); /* Final full version of the data */
+	cpumask_copy(cpu_callin_mask, cpumask_of(0));
+	mb();
 #ifdef CONFIG_X86_32
 	boot_cpu_logical_apicid = logical_smp_processor_id();
 #endif
maintainer
#1 lore raw
Quoted 17 lines · Yinghai Lu

smp_store_cpu_info(0) will do that.

---
 arch/x86/kernel/smpboot.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/kernel/smpboot.c
===================================================================

arch/x86/kernel/smpboot.c +0 -0
@@ -1071,13 +1071,13 @@ void __init native_smp_prepare_cpus(unsi
 
 	preempt_disable();
 	smp_cpu_index_default();

arch/x86/kernel/smpboot.c void __init native_smp_prepare_cpus(unsi · line 1080

Quoted 10 lines
arch/x86/kernel/smpboot.c +3 -3
-	memcpy(__this_cpu_ptr(&cpu_info), &boot_cpu_data, sizeof(cpu_info));
-	cpumask_copy(cpu_callin_mask, cpumask_of(0));
-	mb();
+
 	/*
 	 * Setup boot CPU information
 	 */
 	smp_store_cpu_info(0); /* Final full version of the data */
+	cpumask_copy(cpu_callin_mask, cpumask_of(0));
+	mb();

Question: why do we need the memory barrier there? We're running on the BSP and long before smp_init() to be all careful about the callin_mask. It could be there as a left over from the 32 and 64-bit merge, AFAICT from git history...

Thanks.

Signature · 2 lines
Regards/Gruss,
    Boris.
#2 lore raw
In reply to Yinghai Lu
Commit-ID:  792363d2beceb1c7d865e517fa9939c8b8c1442a
Gitweb:     http://git.kernel.org/tip/792363d2beceb1c7d865e517fa9939c8b8c1442a
Author:     Yinghai Lu <[email protected]>
AuthorDate: Fri, 21 Jan 2011 15:29:54 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 26 Jan 2011 08:44:50 +0100

x86: Don't copy per_cpu cpuinfo for BSP two times

smp_store_cpu_info(0) will do that.

Cc Suresh Siddha <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Borislav Petkov <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/smpboot.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/smpboot.c +3 -3
index d396155..a7a3d1a 100644
@@ -1071,13 +1071,13 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 
 	preempt_disable();
 	smp_cpu_index_default();
-	memcpy(__this_cpu_ptr(&cpu_info), &boot_cpu_data, sizeof(cpu_info));
-	cpumask_copy(cpu_callin_mask, cpumask_of(0));
-	mb();
+
 	/*
 	 * Setup boot CPU information
 	 */
 	smp_store_cpu_info(0); /* Final full version of the data */
+	cpumask_copy(cpu_callin_mask, cpumask_of(0));
+	mb();
 #ifdef CONFIG_X86_32
 	boot_cpu_logical_apicid = logical_smp_processor_id();
 #endif