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] Remove the free_vcpu() interface I added in the precedin

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Remove the free_vcpu() interface I added in the preceding
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 15 Jan 2006 01:42:07 +0000
Delivery-date: Sun, 15 Jan 2006 01:49:34 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxx
# Node ID d783bdd14f2eff514e36b92ded0e3d22be7cf3d0
# Parent  1ccc28e075bad4306e3096d860f4bec2654f52b3
Remove the free_vcpu() interface I added in the preceding
changeset. It makes no sense, since an allocated VCPU
cannot be freed at any arbitrary point because individual
VCPUs are not refcounted.

Instead extend free_domain() slightly so it really does do
the reverse of alloc_vcpu() for every allocated VCPU.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 1ccc28e075ba -r d783bdd14f2e xen/common/domain.c
--- a/xen/common/domain.c       Sat Jan 14 22:16:43 2006
+++ b/xen/common/domain.c       Sat Jan 14 22:40:09 2006
@@ -66,7 +66,7 @@
     d->iomem_caps = rangeset_new(d, "I/O Memory", RANGESETF_prettyprint_hex);
     d->irq_caps   = rangeset_new(d, "Interrupts", 0);
     if ( (d->iomem_caps == NULL) || (d->irq_caps == NULL) )
-        goto fail5;
+        goto fail4; /* NB. alloc_vcpu() is undone in free_domain() */
 
     if ( !is_idle_domain(d) )
     {
@@ -84,8 +84,6 @@
 
     return d;
 
- fail5:
-    free_vcpu(v);
  fail4:
     arch_domain_destroy(d);
  fail3:
diff -r 1ccc28e075ba -r d783bdd14f2e xen/common/schedule.c
--- a/xen/common/schedule.c     Sat Jan 14 22:16:43 2006
+++ b/xen/common/schedule.c     Sat Jan 14 22:40:09 2006
@@ -73,15 +73,29 @@
 /* Per-CPU periodic timer sends an event to the currently-executing domain. */
 static struct timer t_timer[NR_CPUS]; 
 
+struct domain *alloc_domain(void)
+{
+    struct domain *d;
+
+    if ( (d = xmalloc(struct domain)) != NULL )
+        memset(d, 0, sizeof(*d));
+
+    return d;
+}
+
 void free_domain(struct domain *d)
 {
+    struct vcpu *v;
     int i;
 
+    for_each_vcpu ( d, v )
+        sched_rem_domain(v);
+
     SCHED_OP(free_task, d);
 
     for ( i = MAX_VIRT_CPUS-1; i >= 0; i-- )
-        if ( d->vcpu[i] != NULL )
-            free_vcpu_struct(d->vcpu[i]);
+        if ( (v = d->vcpu[i]) != NULL )
+            free_vcpu_struct(v);
 
     xfree(d);
 }
@@ -105,46 +119,24 @@
     v->cpu_affinity = is_idle_domain(d) ?
         cpumask_of_cpu(cpu_id) : CPU_MASK_ALL;
 
-    d->vcpu[vcpu_id] = v;
+    if ( (vcpu_id != 0) && !is_idle_domain(d) )
+        set_bit(_VCPUF_down, &v->vcpu_flags);
 
     if ( SCHED_OP(alloc_task, v) < 0 )
     {
-        d->vcpu[vcpu_id] = NULL;
         free_vcpu_struct(v);
         return NULL;
     }
 
+    d->vcpu[vcpu_id] = v;
+    if ( vcpu_id != 0 )
+        d->vcpu[v->vcpu_id-1]->next_in_list = v;
+
     sched_add_domain(v);
 
-    if ( vcpu_id != 0 )
-    {
-        d->vcpu[v->vcpu_id-1]->next_in_list = v;
-        if ( !is_idle_domain(d) )
-            set_bit(_VCPUF_down, &v->vcpu_flags);
-    }
-
     return v;
 }
 
-void free_vcpu(struct vcpu *v)
-{
-    /* NB. Rest of destruction is done in free_domain(). */
-    sched_rem_domain(v);
-}
-
-struct domain *alloc_domain(void)
-{
-    struct domain *d;
-
-    if ( (d = xmalloc(struct domain)) != NULL )
-        memset(d, 0, sizeof(*d));
-
-    return d;
-}
-
-/*
- * Add and remove a domain
- */
 void sched_add_domain(struct vcpu *v) 
 {
     /* Initialise the per-domain timer. */
diff -r 1ccc28e075ba -r d783bdd14f2e xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Sat Jan 14 22:16:43 2006
+++ b/xen/include/xen/sched.h   Sat Jan 14 22:40:09 2006
@@ -181,7 +181,6 @@
 
 struct vcpu *alloc_vcpu(
     struct domain *d, unsigned int vcpu_id, unsigned int cpu_id);
-void free_vcpu(struct vcpu *v);
 
 struct domain *alloc_domain(void);
 void free_domain(struct domain *d);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Remove the free_vcpu() interface I added in the preceding, Xen patchbot -unstable <=