WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] hvm: Fix deadlock in vpt.c and clean up s

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvm: Fix deadlock in vpt.c and clean up some more.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 19 Jun 2007 11:30:30 -0700
Delivery-date: Tue, 19 Jun 2007 11:28:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1182261173 -3600
# Node ID 5794f9b80c3fc4d55aeae892dcb099da4eccc21e
# Parent  75d82009ec707d013ac170b7896bd612099e43f7
hvm: Fix deadlock in vpt.c and clean up some more.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/vpt.c |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff -r 75d82009ec70 -r 5794f9b80c3f xen/arch/x86/hvm/vpt.c
--- a/xen/arch/x86/hvm/vpt.c    Tue Jun 19 11:06:25 2007 +0100
+++ b/xen/arch/x86/hvm/vpt.c    Tue Jun 19 14:52:53 2007 +0100
@@ -227,13 +227,10 @@ void pt_reset(struct vcpu *v)
 
     list_for_each_entry ( pt, head, list )
     {
-        if ( pt->enabled )
-        {
-            pt->pending_intr_nr = 0;
-            pt->last_plt_gtime = hvm_get_guest_time(pt->vcpu);
-            pt->scheduled = NOW() + pt->period;
-            set_timer(&pt->timer, pt->scheduled);
-        }
+        pt->pending_intr_nr = 0;
+        pt->last_plt_gtime = hvm_get_guest_time(pt->vcpu);
+        pt->scheduled = NOW() + pt->period;
+        set_timer(&pt->timer, pt->scheduled);
     }
 
     spin_unlock(&v->arch.hvm_vcpu.tm_lock);
@@ -247,10 +244,7 @@ void pt_migrate(struct vcpu *v)
     spin_lock(&v->arch.hvm_vcpu.tm_lock);
 
     list_for_each_entry ( pt, head, list )
-    {
-        if ( pt->enabled )
-            migrate_timer(&pt->timer, v->processor);
-    }
+        migrate_timer(&pt->timer, v->processor);
 
     spin_unlock(&v->arch.hvm_vcpu.tm_lock);
 }
@@ -263,8 +257,9 @@ void create_periodic_time(
 
     spin_lock(&v->arch.hvm_vcpu.tm_lock);
 
-    init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     pt->enabled = 1;
+    pt->pending_intr_nr = 0;
+
     if ( period < 900000 ) /* < 0.9 ms */
     {
         gdprintk(XENLOG_WARNING,
@@ -283,6 +278,8 @@ void create_periodic_time(
     pt->priv = data;
 
     list_add(&pt->list, &v->arch.hvm_vcpu.tm_list);
+
+    init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
 
     spin_unlock(&v->arch.hvm_vcpu.tm_lock);
@@ -295,8 +292,12 @@ void destroy_periodic_time(struct period
 
     pt_lock(pt);
     pt->enabled = 0;
-    pt->pending_intr_nr = 0;
     list_del(&pt->list);
+    pt_unlock(pt);
+
+    /*
+     * pt_timer_fn() can run until this kill_timer() returns. We must do this
+     * outside pt_lock() otherwise we can deadlock with pt_timer_fn().
+     */
     kill_timer(&pt->timer);
-    pt_unlock(pt);
-}
+}

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvm: Fix deadlock in vpt.c and clean up some more., Xen patchbot-unstable <=