Skip to contentSkip to conversation

xen/arm: Init traps very early

PATCH In review Julien Grall 2 participants 2 messages Jun 19, 2014 – Jun 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/arm: Init traps very early

The function init_traps setups the handler taken when Xen hits a BUG_ON/ASSERT.

If an error happen before init_traps is called, we loose the backtrace.

When a trap is taken from HYP mode, we need to:
- get the processor ID, percpu has to be initialized and the
smp_processor_id correctly set.
- initialize current, even tho it's not used for the time being. Move the debug sanity ealier.

---
Changes in v2:
- Update a comment in the code to explain why we need to be set early.
- Move the call after smp_processor_id as it's requires to be there.
- Move set_current(...) ealier

---
 xen/arch/arm/setup.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
xen/arch/arm/setup.c +6 -5
index b9ce7a9..8c505cb 100644
@@ -670,6 +670,12 @@ void __init start_xen(unsigned long 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;
+
+    /* Initialize traps early allow us to get backtrace when an error occured */
+    init_traps();
+
     smp_clear_cpu_maps();
 
     /* This is mapped by head.S */
@@ -706,11 +712,6 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     gic_init();
 
-    set_current((struct vcpu *)0xfffff000); /* debug sanity */
-    idle_vcpu[0] = current;
-
-    init_traps();
-
     setup_virt_paging();
 
     p2m_vmid_allocator_init();
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 1 line · Julien Grall

The function init_traps setups the handler taken when Xen hits a BUG_ON/ASSERT.

"sets up"

Quoted 1 line

If an error happen before init_traps is called, we loose the backtrace.

"lose"

Quoted 4 lines

When a trap is taken from HYP mode, we need to:
- get the processor ID, percpu has to be initialized and the
smp_processor_id correctly set.

Wrapping.

Quoted 1 line

- initialize current, even tho it's not used for the time being. Move the

"though"

Quoted 1 line

debug sanity ealier.

"earlier"

Quoted 20 lines

---
Changes in v2:
- Update a comment in the code to explain why we need to be set early.
- Move the call after smp_processor_id as it's requires to be there.
- Move set_current(...) ealier

---
 xen/arch/arm/setup.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
xen/arch/arm/setup.c +0 -0
index b9ce7a9..8c505cb 100644

xen/arch/arm/setup.c void __init start_xen(unsigned long boot_phys_offset, · line 676

Quoted 7 lines
xen/arch/arm/setup.c +4 -0
@@ -670,6 +670,12 @@ void __init start_xen(unsigned long 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;
+
+    /* Initialize traps early allow us to get backtrace when an error occured */

"occurred". Typos fixed + acked + applied.

Quoted 17 lines
xen/arch/arm/setup.c +2 -5
+    init_traps();
+
     smp_clear_cpu_maps();
 
     /* This is mapped by head.S */
@@ -706,11 +712,6 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     gic_init();
 
-    set_current((struct vcpu *)0xfffff000); /* debug sanity */
-    idle_vcpu[0] = current;
-
-    init_traps();
-
     setup_virt_paging();
 
     p2m_vmid_allocator_init();