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-3.0-testing] Fix dummy domains (DOM_IO and DOM_XEN)

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.0-testing] Fix dummy domains (DOM_IO and DOM_XEN) creation so that
From: Xen patchbot-3.0-testing <patchbot-3.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 03 Jun 2006 00:01:29 +0000
Delivery-date: Fri, 02 Jun 2006 17:03:51 -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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 9dda8050d46df88d86f09772b9abf619a6adb475
# Parent  53bb8c0d9639251b61b203b55f9e6b046f8d99d6
Fix dummy domains (DOM_IO and DOM_XEN) creation so that
list heads are initialised.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
xen-unstable changeset:   10242:ab627e9da8fb7be385f4e713ac184c275aba7c7c
xen-unstable date:        Thu Jun 01 16:39:42 2006 +0100
---
 xen/arch/x86/mm.c       |   12 ++++--------
 xen/common/domain.c     |   19 +++++--------------
 xen/common/schedule.c   |   14 +++++++++++---
 xen/include/xen/sched.h |    4 ++--
 4 files changed, 22 insertions(+), 27 deletions(-)

diff -r 53bb8c0d9639 -r 9dda8050d46d xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Jun 01 16:33:38 2006 +0100
+++ b/xen/arch/x86/mm.c Thu Jun 01 16:42:40 2006 +0100
@@ -187,20 +187,16 @@ void arch_init_memory(void)
      * Any Xen-heap pages that we will allow to be mapped will have
      * their domain field set to dom_xen.
      */
-    dom_xen = alloc_domain();
-    spin_lock_init(&dom_xen->page_alloc_lock);
-    atomic_set(&dom_xen->refcnt, 1);
-    dom_xen->domain_id = DOMID_XEN;
+    dom_xen = alloc_domain(DOMID_XEN);
+    BUG_ON(dom_xen == NULL);
 
     /*
      * Initialise our DOMID_IO domain.
      * This domain owns I/O pages that are within the range of the page_info
      * array. Mappings occur at the priv of the caller.
      */
-    dom_io = alloc_domain();
-    spin_lock_init(&dom_io->page_alloc_lock);
-    atomic_set(&dom_io->refcnt, 1);
-    dom_io->domain_id = DOMID_IO;
+    dom_io = alloc_domain(DOMID_IO);
+    BUG_ON(dom_io == NULL);
 
     /* First 1MB of RAM is historically marked as I/O. */
     for ( i = 0; i < 0x100; i++ )
diff -r 53bb8c0d9639 -r 9dda8050d46d xen/common/domain.c
--- a/xen/common/domain.c       Thu Jun 01 16:33:38 2006 +0100
+++ b/xen/common/domain.c       Thu Jun 01 16:42:40 2006 +0100
@@ -32,22 +32,13 @@ struct domain *domain_list;
 
 struct domain *dom0;
 
-struct domain *domain_create(domid_t dom_id, unsigned int cpu)
+struct domain *domain_create(domid_t domid, unsigned int cpu)
 {
     struct domain *d, **pd;
     struct vcpu *v;
 
-    if ( (d = alloc_domain()) == NULL )
+    if ( (d = alloc_domain(domid)) == NULL )
         return NULL;
-
-    d->domain_id = dom_id;
-
-    atomic_set(&d->refcnt, 1);
-
-    spin_lock_init(&d->big_lock);
-    spin_lock_init(&d->page_alloc_lock);
-    INIT_LIST_HEAD(&d->page_list);
-    INIT_LIST_HEAD(&d->xenpage_list);
 
     rangeset_domain_initialise(d);
 
@@ -74,14 +65,14 @@ struct domain *domain_create(domid_t dom
     if ( !is_idle_domain(d) )
     {
         write_lock(&domlist_lock);
-        pd = &domain_list; /* NB. domain_list maintained in order of dom_id. */
+        pd = &domain_list; /* NB. domain_list maintained in order of domid. */
         for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_in_list )
             if ( (*pd)->domain_id > d->domain_id )
                 break;
         d->next_in_list = *pd;
         *pd = d;
-        d->next_in_hashbucket = domain_hash[DOMAIN_HASH(dom_id)];
-        domain_hash[DOMAIN_HASH(dom_id)] = d;
+        d->next_in_hashbucket = domain_hash[DOMAIN_HASH(domid)];
+        domain_hash[DOMAIN_HASH(domid)] = d;
         write_unlock(&domlist_lock);
     }
 
diff -r 53bb8c0d9639 -r 9dda8050d46d xen/common/schedule.c
--- a/xen/common/schedule.c     Thu Jun 01 16:33:38 2006 +0100
+++ b/xen/common/schedule.c     Thu Jun 01 16:42:40 2006 +0100
@@ -97,12 +97,20 @@ void vcpu_runstate_get(struct vcpu *v, s
     }
 }
 
-struct domain *alloc_domain(void)
+struct domain *alloc_domain(domid_t domid)
 {
     struct domain *d;
 
-    if ( (d = xmalloc(struct domain)) != NULL )
-        memset(d, 0, sizeof(*d));
+    if ( (d = xmalloc(struct domain)) == NULL )
+        return NULL;
+
+    memset(d, 0, sizeof(*d));
+    d->domain_id = domid;
+    atomic_set(&d->refcnt, 1);
+    spin_lock_init(&d->big_lock);
+    spin_lock_init(&d->page_alloc_lock);
+    INIT_LIST_HEAD(&d->page_list);
+    INIT_LIST_HEAD(&d->xenpage_list);
 
     return d;
 }
diff -r 53bb8c0d9639 -r 9dda8050d46d xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Thu Jun 01 16:33:38 2006 +0100
+++ b/xen/include/xen/sched.h   Thu Jun 01 16:42:40 2006 +0100
@@ -184,7 +184,7 @@ struct vcpu *alloc_vcpu(
 struct vcpu *alloc_vcpu(
     struct domain *d, unsigned int vcpu_id, unsigned int cpu_id);
 
-struct domain *alloc_domain(void);
+struct domain *alloc_domain(domid_t domid);
 void free_domain(struct domain *d);
 
 #define DOMAIN_DESTROYED (1<<31) /* assumes atomic_t is >= 32 bits */
@@ -221,7 +221,7 @@ static inline void get_knownalive_domain
 }
 
 extern struct domain *domain_create(
-    domid_t dom_id, unsigned int cpu);
+    domid_t domid, unsigned int cpu);
 extern int construct_dom0(
     struct domain *d,
     unsigned long image_start, unsigned long image_len, 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.0-testing] Fix dummy domains (DOM_IO and DOM_XEN) creation so that, Xen patchbot-3 . 0-testing <=