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] [XEN] Simplify domain shutdown -- no need

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Simplify domain shutdown -- no need to synchronously halt execution.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 06 Nov 2006 16:50:31 +0000
Delivery-date: Mon, 06 Nov 2006 08:53:12 -0800
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 kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID cf8e65797826dc86cab5ebfd735dd9823853e5c0
# Parent  5ec45b46456350f23e0aa4148bd52cbb64f1addf
[XEN] Simplify domain shutdown -- no need to synchronously halt execution.

This avoids a possible deadlock on the per-domain 'big lock'.

No control tools depend on synchronous halting of execution (e.g.,
save/restore already expect that secondary CPUs were halted
synchronously under the control of the guest itself). This makes the
code rather less complex.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/common/domain.c       |   55 +++-------------------------------------------
 xen/common/domctl.c       |    4 +--
 xen/include/xen/softirq.h |    5 +---
 3 files changed, 8 insertions(+), 56 deletions(-)

diff -r 5ec45b464563 -r cf8e65797826 xen/common/domain.c
--- a/xen/common/domain.c       Sat Nov 04 19:26:29 2006 +0000
+++ b/xen/common/domain.c       Sat Nov 04 19:50:59 2006 +0000
@@ -247,42 +247,6 @@ void __domain_crash_synchronous(void)
 }
 
 
-static DEFINE_PER_CPU(struct domain *, domain_shuttingdown);
-
-static void domain_shutdown_finalise(void)
-{
-    struct domain *d;
-    struct vcpu *v;
-
-    d = this_cpu(domain_shuttingdown);
-    this_cpu(domain_shuttingdown) = NULL;
-
-    BUG_ON(d == NULL);
-    BUG_ON(d == current->domain);
-
-    LOCK_BIGLOCK(d);
-
-    /* Make sure that every vcpu is descheduled before we finalise. */
-    for_each_vcpu ( d, v )
-        vcpu_sleep_sync(v);
-    BUG_ON(!cpus_empty(d->domain_dirty_cpumask));
-
-    /* Don't set DOMF_shutdown until execution contexts are sync'ed. */
-    if ( !test_and_set_bit(_DOMF_shutdown, &d->domain_flags) )
-        send_guest_global_virq(dom0, VIRQ_DOM_EXC);
-
-    UNLOCK_BIGLOCK(d);
-
-    put_domain(d);
-}
-
-static __init int domain_shutdown_finaliser_init(void)
-{
-    open_softirq(DOMAIN_SHUTDOWN_FINALISE_SOFTIRQ, domain_shutdown_finalise);
-    return 0;
-}
-__initcall(domain_shutdown_finaliser_init);
-
 void domain_shutdown(struct domain *d, u8 reason)
 {
     struct vcpu *v;
@@ -290,20 +254,13 @@ void domain_shutdown(struct domain *d, u
     if ( d->domain_id == 0 )
         dom0_shutdown(reason);
 
-    /* Mark the domain as shutting down. */
     d->shutdown_code = reason;
-
-    /* Put every vcpu to sleep, but don't wait (avoids inter-vcpu deadlock). */
-    spin_lock(&d->pause_lock);
-    d->pause_count++;
-    set_bit(_DOMF_paused, &d->domain_flags);
-    spin_unlock(&d->pause_lock);
+    set_bit(_DOMF_shutdown, &d->domain_flags);
+
     for_each_vcpu ( d, v )
         vcpu_sleep_nosync(v);
 
-    get_knownalive_domain(d);
-    this_cpu(domain_shuttingdown) = d;
-    raise_softirq(DOMAIN_SHUTDOWN_FINALISE_SOFTIRQ);
+    send_guest_global_virq(dom0, VIRQ_DOM_EXC);
 }
 
 
@@ -312,12 +269,8 @@ void domain_pause_for_debugger(void)
     struct domain *d = current->domain;
     struct vcpu *v;
 
-    /*
-     * NOTE: This does not synchronously pause the domain. The debugger
-     * must issue a PAUSEDOMAIN command to ensure that all execution
-     * has ceased and guest state is committed to memory.
-     */
     set_bit(_DOMF_ctrl_pause, &d->domain_flags);
+
     for_each_vcpu ( d, v )
         vcpu_sleep_nosync(v);
 
diff -r 5ec45b464563 -r cf8e65797826 xen/common/domctl.c
--- a/xen/common/domctl.c       Sat Nov 04 19:26:29 2006 +0000
+++ b/xen/common/domctl.c       Sat Nov 04 19:50:59 2006 +0000
@@ -107,9 +107,9 @@ void getdomaininfo(struct domain *d, str
             info->nr_online_vcpus++;
         }
     }
-    
+
     info->cpu_time = cpu_time;
-    
+
     info->flags = flags |
         ((d->domain_flags & DOMF_dying)      ? XEN_DOMINF_dying    : 0) |
         ((d->domain_flags & DOMF_shutdown)   ? XEN_DOMINF_shutdown : 0) |
diff -r 5ec45b464563 -r cf8e65797826 xen/include/xen/softirq.h
--- a/xen/include/xen/softirq.h Sat Nov 04 19:26:29 2006 +0000
+++ b/xen/include/xen/softirq.h Sat Nov 04 19:50:59 2006 +0000
@@ -8,9 +8,8 @@
 #define KEYPRESS_SOFTIRQ                  3
 #define NMI_SOFTIRQ                       4
 #define PAGE_SCRUB_SOFTIRQ                5
-#define DOMAIN_SHUTDOWN_FINALISE_SOFTIRQ  6
-#define TRACE_SOFTIRQ                     7
-#define NR_SOFTIRQS                       8
+#define TRACE_SOFTIRQ                     6
+#define NR_SOFTIRQS                       7
 
 #ifndef __ASSEMBLY__
 

_______________________________________________
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] [XEN] Simplify domain shutdown -- no need to synchronously halt execution., Xen patchbot-unstable <=