Skip to contentSkip to conversation

Bug report and patch about IRQ freezing after gic_restore_state

DISCUSSION 유재용 2 participants 2 messages May 21, 2013

lore
Share & tools
lore

유재용

author
#0 lore raw
Quoted 8 lines
Quoted 8 lines

Signed-off-by: Jaeyong Yoo
---

 xen/arch/arm/domain.c |    4 ++-- 
 xen/arch/arm/gic.c    |    4 ++-- 
 2 files changed, 4 insertions(+), 4 deletions(-) 
xen/arch/arm/domain.c +0 -1
index f71b582..2c3b132 100644 
--- a/xen/arch/arm/domain.c 
Quoted 8 lines

xen/arch/arm/domain.c static void ctxt_switch_to(struct vcpu *n) · line 144

Quoted 6 lines

+++ b/xen/arch/arm/domain.c

xen/arch/arm/domain.c +2 -0
@@ -141,6 +141,8 @@ static void ctxt_switch_to(struct vcpu *n) 
     /* VGIC */ 
     gic_restore_state(n); 
+    local_irq_enable(); 
+

Could you move the local_irq_enable right after ctxt_switch_to?

Of course.
Just one small concern:
Would it be more efficient (i.e., less scheduling latency) if we enable irq right after gic_restore state similar to lock-breaking effect?

Quoted 20 lines
Quoted 20 lines
xen/arch/arm/domain.c +0 -2
     /* XXX VFP */ 
     /* XXX MPU */ 
@@ -215,8 +217,6 @@ static void schedule_tail(struct vcpu *prev) 
 { 
     ctxt_switch_from(prev); 
-    local_irq_enable(); 
- 
     /* TODO 
        update_runstate_area(current); 
     */ 
xen/arch/arm/gic.c +1 -1
index d4f0a43..8186ad8 100644 
@@ -81,11 +81,11 @@ void gic_restore_state(struct vcpu *v) 
     if ( is_idle_vcpu(v) ) 
         return; 
-    spin_lock_irq(&gic.lock); 
+    spin_lock(&gic.lock); 
Quoted 8 lines

xen/arch/arm/gic.c void gic_restore_state(struct vcpu *v) · line 86

Quoted 4 lines
xen/arch/arm/gic.c +1 -1
     this_cpu(lr_mask) = v->arch.lr_mask; 
     for ( i=0; i>          GICH[GICH_LR + i] = v->arch.gic_lr[i]; 
-    spin_unlock_irq(&gic.lock); 
+    spin_unlock(&gic.lock); 

As the IRQ is disabled and the GICH registers can only be modified by the current physical CPU, I think you can remove the spin_{,un}lock and replace it by a dsb.

dsb sounds ok.

Quoted 5 lines

xen/arch/arm/gic.c void gic_restore_state(struct vcpu *v) · line 89

Quoted 4 lines
xen/arch/arm/gic.c +0 -0
     GICH[GICH_APR] = v->arch.gic_apr; 
     GICH[GICH_HCR] = GICH_HCR_EN; 
     isb(); 

Best,
Jaeyong

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 17 lines · 유재용
Quoted 8 lines
Quoted 8 lines

Signed-off-by: Jaeyong Yoo
---

 xen/arch/arm/domain.c |    4 ++-- 
 xen/arch/arm/gic.c    |    4 ++-- 
 2 files changed, 4 insertions(+), 4 deletions(-) 
xen/arch/arm/domain.c +0 -1
index f71b582..2c3b132 100644 
--- a/xen/arch/arm/domain.c 
Quoted 8 lines

xen/arch/arm/domain.c static void ctxt_switch_to(struct vcpu *n) · line 144

Quoted 6 lines

+++ b/xen/arch/arm/domain.c

xen/arch/arm/domain.c +2 -0
@@ -141,6 +141,8 @@ static void ctxt_switch_to(struct vcpu *n) 
     /* VGIC */ 
     gic_restore_state(n); 
+    local_irq_enable(); 
+

Could you move the local_irq_enable right after ctxt_switch_to?

Quoted 5 lines

Of course.
Just one small concern:
Would it be more efficient (i.e., less scheduling latency) if we enable irq right after gic_restore state similar to lock-breaking effect?

Perhaps, but I think at this stage we should aim for obvious correctness.

Optimising things for IRQ/scheduler latency is a complete project in its own right.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel