Skip to contentSkip to conversation

xen/arm: Initialize PERCPU variables at the beginning of start_xen

PATCH In review Julien Grall 3 participants 3 messages Jul 24, 2013 – Jul 29, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Initialize PERCPU variables at the beginning of start_xen

PERCPU variables rely on HTPIDR (TPIDR_EL2) which is in an unknown state when a processor boot.

For the boot CPU, the first use of PERCPU is in setup_pagetables. So initialize PERCPU and set the processor ID before.

---
 xen/arch/arm/setup.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +3 -2
index 2f9fdc8..1ec5e38 100644
@@ -428,6 +428,9 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     setup_cache();
 
+    percpu_init_areas();
+    set_processor_id(0); /* needed early, for smp_processor_id() */
+
     smp_clear_cpu_maps();
 
     device_tree_flattened = (void *)BOOT_MISC_VIRT_START
@@ -458,8 +461,6 @@ void __init start_xen(unsigned long boot_phys_offset,
     gic_init();
     make_cpus_ready(cpus, boot_phys_offset);
 
-    percpu_init_areas();
-    set_processor_id(0); /* needed early, for smp_processor_id() */
     set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;
 
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Julien Grall

PERCPU variables rely on HTPIDR (TPIDR_EL2) which is in an unknown state when a processor boot.

For the boot CPU, the first use of PERCPU is in setup_pagetables. So initialize PERCPU and set the processor ID before.

Quoted 35 lines
---
 xen/arch/arm/setup.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +3 -2
index 2f9fdc8..1ec5e38 100644
@@ -428,6 +428,9 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     setup_cache();
 
+    percpu_init_areas();
+    set_processor_id(0); /* needed early, for smp_processor_id() */
+
     smp_clear_cpu_maps();
 
     device_tree_flattened = (void *)BOOT_MISC_VIRT_START
@@ -458,8 +461,6 @@ void __init start_xen(unsigned long boot_phys_offset,
     gic_init();
     make_cpus_ready(cpus, boot_phys_offset);
 
-    percpu_init_areas();
-    set_processor_id(0); /* needed early, for smp_processor_id() */
     set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;
 
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw
In reply to Julien Grall
Quoted 7 lines · Julien Grall

PERCPU variables rely on HTPIDR (TPIDR_EL2) which is in an unknown state when a processor boot.

For the boot CPU, the first use of PERCPU is in setup_pagetables. So initialize PERCPU and set the processor ID before.

Acked + Tim's Ack + applied.

I modified the commit message to a) note that Banvor sent a very similar patch and b) to note that this had a realworld impact on sun6i.

Quoted 27 lines
---
 xen/arch/arm/setup.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +3 -2
index 2f9fdc8..1ec5e38 100644
@@ -428,6 +428,9 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     setup_cache();
 
+    percpu_init_areas();
+    set_processor_id(0); /* needed early, for smp_processor_id() */
+
     smp_clear_cpu_maps();
 
     device_tree_flattened = (void *)BOOT_MISC_VIRT_START
@@ -458,8 +461,6 @@ void __init start_xen(unsigned long boot_phys_offset,
     gic_init();
     make_cpus_ready(cpus, boot_phys_offset);
 
-    percpu_init_areas();
-    set_processor_id(0); /* needed early, for smp_processor_id() */
     set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;