xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jaeyong Yoo <jaeyong.yoo@samsung.com>
To: xen-devel@lists.xen.org
Subject: Bug report and patch about IRQ freezing after gic_restore_state
Date: Mon, 20 May 2013 00:41:57 +0000 (GMT)	[thread overview]
Message-ID: <19843405.178081369010517219.JavaMail.weblogic@epv6ml12> (raw)

Hello xen, 

I'm running xen on Arndale board and if I run both iperf and du command at Dom0, 
one of IRQ (either SATA or network) suddenly stop occuring anymore. 
After some investigation, I found out that when context switching at Xen, 
IRQs in LR (about to be delivered to Doms) could be lost and never occur anymore. 
Here goes function call sequence that this problem occurs: 
(in context switching)
  - schedule_tail 
      - ctxt_switch_from 
      - local_irq_enable 
      - // after this part, some IRQ can occur and could be directly written to LR 
      - ctxt_switch_to 
          - ... (some more functions) 
          - // before the above IRQ is delivered to Dom (and maintenance IRQ not called),
            // gic_restore_state can be called 
          - gic_restore_state /* when restoring gic state, the above IRQ 
                                       * (written to LR) is overwritten 
                                       * to the previous values, and somehow, 
                                       * the corresponding IRQ never occur again */ 

I made the following patch (i.e., enable local irq after gic_restore_state) 
for preventing the above problem. 

Signed-off-by: Jaeyong Yoo <jaeyong.yoo@samsung.com> 
--- 
 xen/arch/arm/domain.c |    4 ++-- 
 xen/arch/arm/gic.c    |    4 ++-- 
 2 files changed, 4 insertions(+), 4 deletions(-) 
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c 
index f71b582..2c3b132 100644 
--- a/xen/arch/arm/domain.c 
+++ b/xen/arch/arm/domain.c 
@@ -141,6 +141,8 @@ static void ctxt_switch_to(struct vcpu *n) 
     /* VGIC */ 
     gic_restore_state(n); 
+    local_irq_enable(); 
+ 
     /* 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); 
     */ 
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c 
index d4f0a43..8186ad8 100644 
--- a/xen/arch/arm/gic.c 
+++ b/xen/arch/arm/gic.c 
@@ -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); 
     this_cpu(lr_mask) = v->arch.lr_mask; 
     for ( i=0; i<nr_lrs; i++) 
         GICH[GICH_LR + i] = v->arch.gic_lr[i]; 
-    spin_unlock_irq(&gic.lock); 
+    spin_unlock(&gic.lock); 
     GICH[GICH_APR] = v->arch.gic_apr; 
     GICH[GICH_HCR] = GICH_HCR_EN; 
     isb(); 


best, 
Jaeyong

             reply	other threads:[~2013-05-20  0:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20  0:41 Jaeyong Yoo [this message]
2013-05-20 13:11 ` Bug report and patch about IRQ freezing after gic_restore_state Julien Grall
2013-05-21 12:00   ` Stefano Stabellini
  -- strict thread matches above, loose matches on Subject: below --
2013-05-21 11:13 유재용
2013-05-21 13:00 ` Ian Campbell
2013-05-22  2:34 Jaeyong Yoo
2013-05-22 16:55 ` Stefano Stabellini
2013-05-23 13:24   ` Ian Campbell
2013-05-23 23:57 Jaeyong Yoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19843405.178081369010517219.JavaMail.weblogic@epv6ml12 \
    --to=jaeyong.yoo@samsung.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).