[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Merge



ChangeSet 1.1413, 2005/03/31 22:36:33+01:00, iap10@xxxxxxxxxxxxxxxxxxxxx

        Merge



 dom0_ops.c |  168 ++++++++++++++++++++++++-------------------------------------
 1 files changed, 68 insertions(+), 100 deletions(-)


diff -Nru a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     2005-03-31 17:03:01 -05:00
+++ b/xen/common/dom0_ops.c     2005-03-31 17:03:01 -05:00
@@ -14,9 +14,9 @@
 #include <xen/sched.h>
 #include <xen/event.h>
 #include <asm/domain_page.h>
-#include <asm/pdb.h>
 #include <xen/trace.h>
 #include <xen/console.h>
+#include <xen/physdev.h>
 #include <asm/shadow.h>
 #include <public/sched_ctl.h>
 
@@ -26,7 +26,7 @@
 extern unsigned int alloc_new_dom_mem(struct domain *, unsigned int);
 extern long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op);
 extern void arch_getdomaininfo_ctxt(
-    struct domain *, full_execution_context_t *);
+    struct exec_domain *, full_execution_context_t *);
 
 static inline int is_free_domid(domid_t dom)
 {
@@ -96,7 +96,7 @@
     long ret = 0;
     dom0_op_t curop, *op = &curop;
 
-    if ( !IS_PRIV(current) )
+    if ( !IS_PRIV(current->domain) )
         return -EPERM;
 
     if ( copy_from_user(op, u_dom0_op, sizeof(*op)) )
@@ -112,13 +112,13 @@
     switch ( op->cmd )
     {
 
-    case DOM0_BUILDDOMAIN:
+    case DOM0_SETDOMAININFO:
     {
-        struct domain *d = find_domain_by_id(op->u.builddomain.domain);
-        ret = -EINVAL;
+        struct domain *d = find_domain_by_id(op->u.setdomaininfo.domain);
+        ret = -ESRCH;
         if ( d != NULL )
         {
-            ret = final_setup_guestos(d, &op->u.builddomain);
+            ret = set_info_guest(d, &op->u.setdomaininfo);
             put_domain(d);
         }
     }
@@ -131,7 +131,7 @@
         if ( d != NULL )
         {
             ret = -EINVAL;
-            if ( d != current )
+            if ( d != current->domain )
             {
                 domain_pause_by_systemcontroller(d);
                 ret = 0;
@@ -148,7 +148,8 @@
         if ( d != NULL )
         {
             ret = -EINVAL;
-            if ( test_bit(DF_CONSTRUCTED, &d->flags) )
+            if ( (d != current->domain) && 
+                 test_bit(DF_CONSTRUCTED, &d->d_flags) )
             {
                 domain_unpause_by_systemcontroller(d);
                 ret = 0;
@@ -178,11 +179,14 @@
         {
             /* Do an initial placement. Pick the least-populated CPU. */
             struct domain *d;
+            struct exec_domain *ed;
             unsigned int i, ht, cnt[NR_CPUS] = { 0 };
 
             read_lock(&domlist_lock);
-            for_each_domain ( d )
-                cnt[d->processor]++;
+            for_each_domain ( d ) {
+                for_each_exec_domain ( d, ed )
+                    cnt[ed->processor]++;
+            }
             read_unlock(&domlist_lock);
 
             /* If we're on a HT system, we only use the first HT for dom0,
@@ -223,7 +227,7 @@
         if ( d != NULL )
         {
             ret = -EINVAL;
-            if ( d != current )
+            if ( d != current->domain )
             {
                 domain_kill(d);
                 ret = 0;
@@ -237,6 +241,7 @@
     {
         domid_t dom = op->u.pincpudomain.domain;
         struct domain *d = find_domain_by_id(dom);
+        struct exec_domain *ed;
         int cpu = op->u.pincpudomain.cpu;
 
         if ( d == NULL )
@@ -245,7 +250,15 @@
             break;
         }
         
-        if ( d == current )
+        ed = d->exec_domain[op->u.pincpudomain.exec_domain];
+        if ( ed == NULL )
+        {
+            ret = -ESRCH;
+            put_domain(d);
+            break;
+        }
+
+        if ( ed == current )
         {
             ret = -EINVAL;
             put_domain(d);
@@ -254,17 +267,16 @@
 
         if ( cpu == -1 )
         {
-            clear_bit(DF_CPUPINNED, &d->flags);
+            clear_bit(EDF_CPUPINNED, &ed->ed_flags);
         }
         else
         {
-            domain_pause(d);
-            synchronise_pagetables(~0UL);
-            if ( d->processor != (cpu % smp_num_cpus) )
-                set_bit(DF_MIGRATED, &d->flags);
-            set_bit(DF_CPUPINNED, &d->flags);
-            d->processor = cpu % smp_num_cpus;
-            domain_unpause(d);
+            exec_domain_pause(ed);
+            if ( ed->processor != (cpu % smp_num_cpus) )
+                set_bit(EDF_MIGRATED, &ed->ed_flags);
+            set_bit(EDF_CPUPINNED, &ed->ed_flags);
+            ed->processor = cpu % smp_num_cpus;
+            exec_domain_unpause(ed);
         }
 
         put_domain(d);
@@ -285,48 +297,11 @@
     }
     break;
 
-    case DOM0_GETMEMLIST:
-    {
-        int i;
-        struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
-        unsigned long max_pfns = op->u.getmemlist.max_pfns;
-        unsigned long pfn;
-        unsigned long *buffer = op->u.getmemlist.buffer;
-        struct list_head *list_ent;
-
-        ret = -EINVAL;
-        if ( d != NULL )
-        {
-            ret = 0;
-
-            spin_lock(&d->page_alloc_lock);
-            list_ent = d->page_list.next;
-            for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
-            {
-                pfn = list_entry(list_ent, struct pfn_info, list) - 
-                    frame_table;
-                if ( put_user(pfn, buffer) )
-                {
-                    ret = -EFAULT;
-                    break;
-                }
-                buffer++;
-                list_ent = frame_table[pfn].list.next;
-            }
-            spin_unlock(&d->page_alloc_lock);
-
-            op->u.getmemlist.num_pfns = i;
-            copy_to_user(u_dom0_op, op, sizeof(*op));
-            
-            put_domain(d);
-        }
-    }
-    break;
-
     case DOM0_GETDOMAININFO:
     { 
         full_execution_context_t *c;
         struct domain            *d;
+        struct exec_domain       *ed;
 
         read_lock(&domlist_lock);
 
@@ -346,41 +321,50 @@
         read_unlock(&domlist_lock);
 
         op->u.getdomaininfo.domain = d->id;
+
+        if ( (op->u.getdomaininfo.exec_domain >= MAX_VIRT_CPUS) ||
+             !d->exec_domain[op->u.getdomaininfo.exec_domain] )
+        {
+            ret = -EINVAL;
+            break;
+        }
         
+        ed = d->exec_domain[op->u.getdomaininfo.exec_domain];
+
         op->u.getdomaininfo.flags =
-            (test_bit(DF_DYING,     &d->flags) ? DOMFLAGS_DYING    : 0) |
-            (test_bit(DF_CRASHED,   &d->flags) ? DOMFLAGS_CRASHED  : 0) |
-            (test_bit(DF_SHUTDOWN,  &d->flags) ? DOMFLAGS_SHUTDOWN : 0) |
-            (test_bit(DF_CTRLPAUSE, &d->flags) ? DOMFLAGS_PAUSED   : 0) |
-            (test_bit(DF_BLOCKED,   &d->flags) ? DOMFLAGS_BLOCKED  : 0) |
-            (test_bit(DF_RUNNING,   &d->flags) ? DOMFLAGS_RUNNING  : 0);
+            (test_bit( DF_DYING,      &d->d_flags)  ? DOMFLAGS_DYING    : 0) |
+            (test_bit( DF_CRASHED,    &d->d_flags)  ? DOMFLAGS_CRASHED  : 0) |
+            (test_bit( DF_SHUTDOWN,   &d->d_flags)  ? DOMFLAGS_SHUTDOWN : 0) |
+            (test_bit(EDF_CTRLPAUSE, &ed->ed_flags) ? DOMFLAGS_PAUSED   : 0) |
+            (test_bit(EDF_BLOCKED,   &ed->ed_flags) ? DOMFLAGS_BLOCKED  : 0) |
+            (test_bit(EDF_RUNNING,   &ed->ed_flags) ? DOMFLAGS_RUNNING  : 0);
 
-        op->u.getdomaininfo.flags |= d->processor << DOMFLAGS_CPUSHIFT;
+        op->u.getdomaininfo.flags |= ed->processor << DOMFLAGS_CPUSHIFT;
         op->u.getdomaininfo.flags |= 
             d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
 
         op->u.getdomaininfo.tot_pages   = d->tot_pages;
         op->u.getdomaininfo.max_pages   = d->max_pages;
-        op->u.getdomaininfo.cpu_time    = d->cpu_time;
+        op->u.getdomaininfo.cpu_time    = ed->cpu_time;
         op->u.getdomaininfo.shared_info_frame = 
             __pa(d->shared_info) >> PAGE_SHIFT;
 
         if ( op->u.getdomaininfo.ctxt != NULL )
         {
-            if ( (c = xmalloc(sizeof(*c))) == NULL )
+            if ( (c = xmalloc(full_execution_context_t)) == NULL )
             {
                 ret = -ENOMEM;
                 put_domain(d);
                 break;
             }
 
-            if ( d != current )
-                domain_pause(d);
+            if ( ed != current )
+                exec_domain_pause(ed);
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.