Skip to contentSkip to conversation

xen/arm: Clean up identify processor call for secondary cpus

PATCH Superseded Julien Grall 2 participants 4 messages Jul 25, 2013 – Jul 29, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Clean up identify processor call for secondary cpus

The smp_processor_id() is set at the beginning of start_secondary. We don't need to compute ourself the offset of the cpu data.

---
 xen/arch/arm/smpboot.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
xen/arch/arm/smpboot.c +1 -4
index 5895178..872cc25 100644
@@ -137,15 +137,12 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
                                unsigned long fdt_paddr,
                                unsigned long cpuid)
 {
-    struct cpuinfo_arm *c = cpu_data + cpuid;
-
     memset(get_cpu_info(), 0, sizeof (struct cpu_info));
 
     /* TODO: handle boards where CPUIDs are not contiguous */
     set_processor_id(cpuid);
 
-    *c = boot_cpu_data;
-    identify_cpu(c);
+    identify_cpu(&current_cpu_data);
 
     init_traps();
 
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 2 lines · Julien Grall

The smp_processor_id() is set at the beginning of start_secondary. We don't need to compute ourself the offset of the cpu data.

I forgot the signed-off-by.

Quoted 26 lines
---
 xen/arch/arm/smpboot.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
xen/arch/arm/smpboot.c +1 -4
index 5895178..872cc25 100644
@@ -137,15 +137,12 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
                                unsigned long fdt_paddr,
                                unsigned long cpuid)
 {
-    struct cpuinfo_arm *c = cpu_data + cpuid;
-
     memset(get_cpu_info(), 0, sizeof (struct cpu_info));
 
     /* TODO: handle boards where CPUIDs are not contiguous */
     set_processor_id(cpuid);
 
-    *c = boot_cpu_data;
-    identify_cpu(c);
+    identify_cpu(&current_cpu_data);
 
     init_traps();
 
#2 lore raw
In reply to Julien Grall
Quoted 12 lines · Julien Grall

The smp_processor_id() is set at the beginning of start_secondary. We don't need to compute ourself the offset of the cpu data.

---
 xen/arch/arm/smpboot.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
xen/arch/arm/smpboot.c +0 -0
index 5895178..872cc25 100644
@@ -137,15 +137,12 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
                                unsigned long fdt_paddr,

xen/arch/arm/smpboot.c void __cpuinit start_secondary(unsigned long boot_phys_offset, · line 147

Quoted 10 lines
xen/arch/arm/smpboot.c +0 -3
                                unsigned long cpuid)
 {
-    struct cpuinfo_arm *c = cpu_data + cpuid;
-
     memset(get_cpu_info(), 0, sizeof (struct cpu_info));
 
     /* TODO: handle boards where CPUIDs are not contiguous */
     set_processor_id(cpuid);
 
-    *c = boot_cpu_data;

This step defaults everything to the boot cpu's settings. You could argue that this isn't necessary iff identify_cpu always reinitialises everything but it doesn't belong in this change IMHO.

I think the defaulting behaviour is fine BTW, even if we don't currently make use of it today.

Ian.

Quoted 5 lines
xen/arch/arm/smpboot.c +1 -1
-    identify_cpu(c);
+    identify_cpu(&current_cpu_data);
 
     init_traps();
 
#3 lore raw
Quoted 22 lines · Ian Campbell
Quoted 21 lines · Julien Grall

The smp_processor_id() is set at the beginning of start_secondary. We don't need to compute ourself the offset of the cpu data.

---
 xen/arch/arm/smpboot.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
xen/arch/arm/smpboot.c +0 -2
index 5895178..872cc25 100644
@@ -137,15 +137,12 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
                                unsigned long fdt_paddr,
                                unsigned long cpuid)
 {
-    struct cpuinfo_arm *c = cpu_data + cpuid;
-
     memset(get_cpu_info(), 0, sizeof (struct cpu_info));
 
     /* TODO: handle boards where CPUIDs are not contiguous */
     set_processor_id(cpuid);
 
Quoted 8 lines

xen/arch/arm/smpboot.c void __cpuinit start_secondary(unsigned long boot_phys_offset, · line 147

Quoted 1 line
xen/arch/arm/smpboot.c +0 -1
-    *c = boot_cpu_data;

This step defaults everything to the boot cpu's settings. You could argue that this isn't necessary iff identify_cpu always reinitialises everything but it doesn't belong in this change IMHO.

I think the defaulting behaviour is fine BTW, even if we don't currently make use of it today.

I will remove this line from the patch.

Signature · 1 line
Julien