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-devel

[Xen-devel] [PATCH 4/8] [xen] Domain Groups: VMM domain group framework

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 4/8] [xen] Domain Groups: VMM domain group framework
From: Chris <hap10@xxxxxxxxxxxxxx>
Date: Tue, 20 Feb 2007 14:56:22 -0500
Delivery-date: Tue, 20 Feb 2007 11:58:40 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.9 (Macintosh/20061207)
xen:

1. Create generic support data structures for group information.

2. Add domgrpctl interface (similar to domctl).



diff -r ecb6cd61a9cf xen/common/Makefile
--- a/xen/common/Makefile       Tue Feb 20 12:27:03 2007 +0000
+++ b/xen/common/Makefile       Tue Feb 20 12:59:11 2007 -0500
@@ -1,7 +1,9 @@ obj-y += acm_ops.o
 obj-y += acm_ops.o
 obj-y += bitmap.o
 obj-y += domctl.o
+obj-y += domgrpctl.o
 obj-y += domain.o
+obj-y += domgrp.o
 obj-y += event_channel.o
 obj-y += grant_table.o
 obj-y += kernel.o
diff -r ecb6cd61a9cf xen/common/domain.c
--- a/xen/common/domain.c       Tue Feb 20 12:27:03 2007 +0000
+++ b/xen/common/domain.c       Tue Feb 20 12:59:11 2007 -0500
@@ -11,6 +11,7 @@
 #include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/domain.h>
+#include <xen/domgrp.h>
 #include <xen/mm.h>
 #include <xen/event.h>
 #include <xen/time.h>
@@ -51,6 +52,7 @@ struct domain *alloc_domain(domid_t domi
 
     memset(d, 0, sizeof(*d));
     d->domain_id = domid;
+    d->group_id = INVAL_GROUP_ID;
     atomic_set(&d->refcnt, 1);
     spin_lock_init(&d->big_lock);
     spin_lock_init(&d->page_alloc_lock);
@@ -184,6 +186,8 @@ struct domain *domain_create(domid_t dom
         d->next_in_hashbucket = domain_hash[DOMAIN_HASH(domid)];
         domain_hash[DOMAIN_HASH(domid)] = d;
         write_unlock(&domlist_lock);
+
+        add_dom_to_grp(d, NULL_GROUP_ID);
     }
 
     return d;
@@ -288,6 +292,8 @@ void domain_shutdown(struct domain *d, u
 {
     struct vcpu *v;
 
+    del_dom_from_grp(d);
+
     if ( d->domain_id == 0 )
         dom0_shutdown(reason);
 
@@ -329,6 +335,8 @@ void domain_destroy(struct domain *d)
     old = atomic_compareandswap(old, new, &d->refcnt);
     if ( _atomic_read(old) != 0 )
         return;
+
+    del_dom_from_grp(d);
 
     /* Delete from task list and task hashtable. */
     write_lock(&domlist_lock);
diff -r ecb6cd61a9cf xen/common/domctl.c
--- a/xen/common/domctl.c       Tue Feb 20 12:27:03 2007 +0000
+++ b/xen/common/domctl.c       Tue Feb 20 12:59:11 2007 -0500
@@ -12,6 +12,7 @@
 #include <xen/mm.h>
 #include <xen/sched.h>
 #include <xen/domain.h>
+#include <xen/domgrp.h>
 #include <xen/event.h>
 #include <xen/domain_page.h>
 #include <xen/trace.h>
@@ -86,8 +87,10 @@ void getdomaininfo(struct domain *d, str
     u64 cpu_time = 0;
     int flags = XEN_DOMINF_blocked;
     struct vcpu_runstate_info runstate;
-    
+    struct domain_group *grp;
+
     info->domain = d->domain_id;
+    info->group = d->group_id;
     info->nr_online_vcpus = 0;
     
     /* 
@@ -130,6 +133,9 @@ void getdomaininfo(struct domain *d, str
     info->shared_info_frame = mfn_to_gmfn(d, __pa(d->shared_info)>>PAGE_SHIFT);
 
     memcpy(info->handle, d->handle, sizeof(xen_domain_handle_t));
+    grp = find_grp_by_id(info->group);
+    if (grp)
+        memcpy(info->dg_handle, grp->handle, 
sizeof(xen_domain_group_handle_t));
 }
 
 static unsigned int default_vcpu0_location(void)
@@ -250,6 +256,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
     {
         struct domain *d = get_domain_by_id(op->domain);
         ret = -ESRCH;
+
         if ( d != NULL )
         {
             ret = -EINVAL;
@@ -267,6 +274,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
     {
         struct domain *d = get_domain_by_id(op->domain);
         ret = -ESRCH;
+
         if ( d != NULL )
         {
             ret = -EINVAL;
@@ -404,6 +412,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
     {
         struct domain *d = get_domain_by_id(op->domain);
         ret = -ESRCH;
+
         if ( d != NULL )
         {
             ret = -EINVAL;
diff -r ecb6cd61a9cf xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Tue Feb 20 12:27:03 2007 +0000
+++ b/xen/include/public/domctl.h       Tue Feb 20 12:59:11 2007 -0500
@@ -67,6 +67,7 @@ struct xen_domctl_getdomaininfo {
 struct xen_domctl_getdomaininfo {
     /* OUT variables. */
     domid_t  domain;              /* Also echoed in domctl.domain */
+    dgid_t   group;
  /* Domain is scheduled to die. */
 #define _XEN_DOMINF_dying     0
 #define XEN_DOMINF_dying      (1U<<_XEN_DOMINF_dying)
@@ -100,6 +101,7 @@ struct xen_domctl_getdomaininfo {
     uint32_t max_vcpu_id;        /* Maximum VCPUID in use by this domain. */
     uint32_t ssidref;
     xen_domain_handle_t handle;
+    xen_domain_group_handle_t dg_handle;
 };
 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
diff -r ecb6cd61a9cf xen/include/public/xen.h
--- a/xen/include/public/xen.h  Tue Feb 20 12:27:03 2007 +0000
+++ b/xen/include/public/xen.h  Tue Feb 20 12:59:11 2007 -0500
@@ -80,6 +80,7 @@
 #define __HYPERVISOR_sysctl               35
 #define __HYPERVISOR_domctl               36
 #define __HYPERVISOR_kexec_op             37
+#define __HYPERVISOR_domgrpctl            38
 
 /* Architecture-specific hypercall definitions. */
 #define __HYPERVISOR_arch_0               48
@@ -295,6 +296,8 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
 #ifndef __ASSEMBLY__
 
 typedef uint16_t domid_t;
+
+typedef uint16_t dgid_t;
 
 /* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
 #define DOMID_FIRST_RESERVED (0x7FF0U)
@@ -572,6 +575,8 @@ typedef struct dom0_vga_console_info {
 
 typedef uint8_t xen_domain_handle_t[16];
 
+typedef uint8_t xen_domain_group_handle_t[16];
+
 /* Turn a plain number into a C unsigned long constant. */
 #define __mk_unsigned_long(x) x ## UL
 #define mk_unsigned_long(x) __mk_unsigned_long(x)
diff -r ecb6cd61a9cf xen/include/xen/hypercall.h
--- a/xen/include/xen/hypercall.h       Tue Feb 20 12:27:03 2007 +0000
+++ b/xen/include/xen/hypercall.h       Tue Feb 20 12:59:11 2007 -0500
@@ -10,6 +10,7 @@
 #include <xen/time.h>
 #include <public/xen.h>
 #include <public/domctl.h>
+#include <public/domgrpctl.h>
 #include <public/sysctl.h>
 #include <public/platform.h>
 #include <public/acm_ops.h>
@@ -33,6 +34,10 @@ extern long
 extern long
 do_domctl(
     XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
+
+extern long
+do_domgrpctl(
+    XEN_GUEST_HANDLE(xen_domgrpctl_t) u_domgrpctl);
 
 extern long
 do_sysctl(
diff -r ecb6cd61a9cf xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Tue Feb 20 12:27:03 2007 +0000
+++ b/xen/include/xen/sched.h   Tue Feb 20 12:59:11 2007 -0500
@@ -9,6 +9,7 @@
 #include <xen/shared.h>
 #include <public/xen.h>
 #include <public/domctl.h>
+#include <public/domgrpctl.h>
 #include <public/vcpu.h>
 #include <xen/time.h>
 #include <xen/timer.h>
@@ -25,6 +26,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_runstate_in
 
 extern unsigned long volatile jiffies;
 extern rwlock_t domlist_lock;
+extern rwlock_t domgrplist_lock;
 
 /* A global pointer to the initial domain (DOM0). */
 extern struct domain *dom0;
@@ -124,9 +126,13 @@ struct domain
 {
     domid_t          domain_id;
 
+    dgid_t           group_id;        /* TODO: replace struct group ptr */
+    struct list_head member;
+
     shared_info_t   *shared_info;     /* shared data area */
 
     spinlock_t       big_lock;
+    spinlock_t      *grp_big_lock;
 
     spinlock_t       page_alloc_lock; /* protects all the following fields  */
     struct list_head page_list;       /* linked list, of size tot_pages     */
@@ -193,6 +199,21 @@ struct domain
     /* OProfile support. */
     struct xenoprof *xenoprof;
     int32_t time_offset_seconds;
+};
+
+struct domain_group
+{
+    dgid_t                              group_id;
+    uint16_t                            size;
+
+    struct list_head                    groups;
+
+    struct list_head                    member_list;
+
+    spinlock_t                          grp_big_lock;
+    rwlock_t                            member_list_lock;
+
+    xen_domain_group_handle_t           handle;
 };
 
 struct domain_setup_info
diff -r ecb6cd61a9cf xen/common/domgrp.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/domgrp.c       Tue Feb 20 12:59:11 2007 -0500
@@ -0,0 +1,317 @@
+/******************************************************************************
+ * domgrp.c
+ *
+ * Generic domain group-handling functions.
+ *
+ * Author: Chris Bookholt (hap10@xxxxxxxxxxxxxx)
+ */
+
+#include <xen/sched.h>
+#include <xen/list.h>
+#include <xen/xmalloc.h>
+#include <public/domgrpctl.h>
+
+DEFINE_RWLOCK(domgrplist_lock);
+struct list_head domgrplist;
+
+#define SERIALIZE_LINKED_LIST(op_name, list_name)              \
+    read_lock(&grp->op_name##_lock);                           \
+    memset(&info->op_name, 0, sizeof(domid_t)*MAX_GROUP_SIZE); \
+    if (!list_empty(&grp->op_name)) {                          \
+        i = 0;                                                 \
+        list_for_each_entry(dom, &grp->op_name, list_name) {   \
+            info->op_name[i] = dom->domain_id;                 \
+                   i++;                                                \
+       }                                                       \
+    } else                                                     \
+       info->op_name[i] = NULL_GROUP_ID;                       \
+    read_unlock(&grp->op_name##_lock);
+
+void get_grp_info(struct domain_group *grp, xen_domgrpctl_getgrpinfo_t * info)
+{
+       struct domain *dom;
+       uint16_t i = 0;
+
+       info->dgid = grp->group_id;
+       info->size = grp->size;
+
+       SERIALIZE_LINKED_LIST(member_list, member);
+
+       memcpy(info->handle, grp->handle, sizeof(xen_domain_group_handle_t));
+}
+
+struct domain_group *alloc_domain_group(void)
+{
+       struct domain_group *grp = NULL;
+
+       if ((grp = xmalloc(struct domain_group)) != NULL)
+                memset(grp, 0, sizeof(*grp));
+
+       return grp;
+}
+
+struct domain_group *find_grp_by_id(dgid_t dgid)
+{
+       struct domain_group *grp;
+
+       read_lock(&domgrplist_lock);
+       list_for_each_entry(grp, &domgrplist, groups)
+           if (grp->group_id == dgid) 
+               goto out;
+       grp = NULL;
+      out:
+       read_unlock(&domgrplist_lock);
+       return grp;
+}
+
+uint16_t get_new_group_id(void)
+{
+       static DEFINE_SPINLOCK(domgrpcnt_lock);
+       static dgid_t group_counter = 1;
+       dgid_t ret;
+       
+       if (group_counter < NULL_GROUP_ID - 1) {
+               spin_lock(&domgrpcnt_lock);
+               ret = group_counter++;
+               spin_unlock(&domgrpcnt_lock);
+       } else
+               ret = NULL_GROUP_ID;
+       return ret;
+}
+
+struct domain_group *domain_group_create(dgid_t dgid)
+{
+       struct domain_group *grp = NULL, *tail;
+
+       grp = alloc_domain_group();
+       if (!grp)
+               goto out;
+
+       grp->group_id = dgid;
+       grp->size = 0;
+       if (dgid == 0)
+               memset(grp->handle, 0, sizeof(xen_domain_group_handle_t));
+       else if (dgid == NULL_GROUP_ID)
+               memset(grp->handle, 0xFF, sizeof(xen_domain_group_handle_t));
+
+       /* init group's lists */
+       INIT_LIST_HEAD(&grp->member_list);
+
+       /* init group's locks */
+       spin_lock_init(&grp->grp_big_lock);
+       rwlock_init(&grp->member_list_lock);
+
+       /* add new group to domgrplist *
+        * TODO: This is a candidate for optimization. Could 
+        * be optimized by maintaining a ptr to the tail, but 
+        * list size is small, so search isn't expensive */
+       if (dgid != 0 && dgid != NULL_GROUP_ID) {
+               tail = find_grp_by_id(NULL_GROUP_ID);
+               write_lock(&domgrplist_lock);
+               list_add_tail(&grp->groups, &tail->groups);
+               write_unlock(&domgrplist_lock);
+       } else {
+               write_lock(&domgrplist_lock);
+               list_add_tail(&grp->groups, &domgrplist);
+               write_unlock(&domgrplist_lock);
+       }
+
+      out:
+       return grp;
+}
+
+int dom_in_member_list(domid_t domid, struct domain_group *grp)
+{
+       struct domain *dom;
+       int ret = 0;
+
+       if (grp == NULL) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       read_lock(&grp->member_list_lock);
+       list_for_each_entry(dom, &grp->member_list, member) {
+               if (dom->domain_id == domid) {
+                       ret = 1;
+                       break;
+               }
+       }
+       read_unlock(&grp->member_list_lock);
+      out:
+       return ret;
+}
+
+#define RM_DOM_FROM_LIST(list_name, entry)     \
+    write_lock(&grp->list_name##_lock);                \
+    if (!list_empty(&grp->list_name))          \
+        list_del(&dom->entry);                 \
+    write_unlock(&grp->list_name##_lock);
+
+void del_dom_from_grp(struct domain *dom)
+{
+       struct domain_group *grp;
+
+       grp = find_grp_by_id(dom->group_id);
+
+       if (grp == NULL)
+               goto out;
+
+       if (dom_in_member_list(dom->domain_id, grp) <= 0)
+               goto out;
+
+       RM_DOM_FROM_LIST(member_list, member);
+       dom->group_id = INVAL_GROUP_ID;
+       grp->size--;
+       
+      out:
+       return;
+}
+
+int add_dom_to_grp(struct domain *dom, dgid_t dgid)
+{
+       struct domain_group *grp = NULL;
+       int ret = 0;
+
+       grp = find_grp_by_id(dgid);
+       if (grp == NULL) {
+               ret = -ESRCH;
+               goto out;
+       } 
+
+       if (grp->size >= MAX_GROUP_SIZE) {
+               ret = -EPERM;
+               goto out;
+       } 
+
+       /* skip it if dom is already a member */
+       if (dom_in_member_list(dom->domain_id, grp))
+               goto out;
+       
+       /* remove dom from old group */
+       if (dom->group_id != INVAL_GROUP_ID)
+               del_dom_from_grp(dom);
+
+       /* add dom to end of new group list */
+       write_lock(&grp->member_list_lock);
+       list_add_tail(&dom->member, &grp->member_list);
+       write_unlock(&grp->member_list_lock);
+
+       dom->group_id = dgid;
+       dom->grp_big_lock = &grp->grp_big_lock;
+
+       grp->size++;
+      out:
+       return ret;
+}
+
+int pause_grp(dgid_t dgid)
+{
+       int ret = 0;
+       struct domain *member;
+       struct domain_group *grp;
+
+       if (dgid == 0) {
+               ret = -EPERM;
+               goto out;
+       }
+
+       grp = find_grp_by_id(dgid);
+
+       if (grp == NULL) {
+               ret = -ESRCH;
+               goto out;
+       }
+
+       spin_lock_recursive(&grp->grp_big_lock);
+       read_lock(&grp->member_list_lock);
+       /* could ignore interupts during this loop to increase atomicity */
+       list_for_each_entry(member, &grp->member_list, member) {
+               if (member != current->domain
+                   && member->domain_id != 0)
+                       domain_pause_by_systemcontroller
+                           (member);
+       }
+       read_unlock(&grp->member_list_lock);
+       spin_unlock_recursive(&grp->grp_big_lock);
+      out:
+       return ret;
+}
+
+int unpause_grp(dgid_t dgid)
+{
+       int ret = 0;
+       struct domain *member;
+       struct domain_group *grp;
+
+       if (dgid == 0) {
+               ret = -EPERM;
+               goto out;
+       }
+
+       grp = find_grp_by_id(dgid);
+
+       if (grp == NULL) {
+               ret = -ESRCH;
+               goto out;
+       }
+
+       spin_lock_recursive(&grp->grp_big_lock);
+       read_lock(&grp->member_list_lock);
+       /* could ignore interupts during this loop to increase atomicity */
+       list_for_each_entry(member, &grp->member_list, member) {
+               if (member != current->domain &&
+                   member->domain_id != 0 &&
+                   test_bit(_VCPUF_initialised,
+                            &member->vcpu[0]->vcpu_flags))
+                       domain_unpause_by_systemcontroller
+                           (member);
+       }
+       read_unlock(&grp->member_list_lock);
+       spin_unlock_recursive(&grp->grp_big_lock);
+      out:
+       return ret;
+}
+
+int domain_group_destroy(dgid_t dgid)
+{
+       int ret = 0;
+       struct domain_group *grp;
+
+       grp = find_grp_by_id(dgid);
+       if (grp == NULL) {
+               ret = -ESRCH;
+               goto out;
+       }
+
+       if (grp->size != 0) {
+               ret = -EPERM;
+               printk(KERN_INFO "refusing to destroy non-emtpry group %d\n", 
grp->group_id);
+               goto out;
+       }
+
+       write_lock(&domgrplist_lock);
+       list_del(&grp->groups);
+       write_unlock(&domgrplist_lock);
+
+       xfree(grp);
+      out:
+       return ret;
+}
+
+int init_domain_groups(void)
+{
+       struct domain_group *grp0, *nullgrp;
+       int ret = 0;
+       INIT_LIST_HEAD(&domgrplist);
+
+       /* order matters for creation of default groups: 
+        * create default groups in order of ascending dgid so they 
+        * are added to the group list in the expected order */
+       grp0 = domain_group_create(0);
+       nullgrp = domain_group_create(NULL_GROUP_ID);
+
+       if (!grp0 || !nullgrp)
+           ret = -ENOMEM;
+       return ret;
+}
diff -r ecb6cd61a9cf xen/common/domgrpctl.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/domgrpctl.c    Tue Feb 20 12:59:11 2007 -0500
@@ -0,0 +1,134 @@
+/******************************************************************************
+ * domgrpctl.c
+ *
+ * Domain group management operations. For use by node control stack.
+ *
+ * Author: Chris Bookholt (hap10@xxxxxxxxxxxxxx)
+ */
+
+#include <xen/sched.h>
+#include <xen/domgrp.h>
+#include <xen/guest_access.h>
+#include <public/domgrpctl.h>
+#include <asm/current.h>
+
+long do_domgrpctl(XEN_GUEST_HANDLE(xen_domgrpctl_t) u_domgrpctl)
+{
+       long ret = 0;
+       struct xen_domgrpctl curop, *op = &curop;
+       static DEFINE_SPINLOCK(domgrpctl_lock);
+       struct domain_group *grp;
+       dgid_t dgid;
+
+       if (!IS_PRIV(current->domain)) {
+               ret = -EPERM;
+               goto out;
+       }
+
+       if (copy_from_guest(op, u_domgrpctl, 1)) {
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (op->interface_version != XEN_DOMGRPCTL_INTERFACE_VERSION) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       spin_lock(&domgrpctl_lock);
+
+       switch (op->cmd) {
+
+       case XEN_DOMGRPCTL_getgrpinfo:
+               {
+                       read_lock(&domgrplist_lock);
+                       ret = -ESRCH;
+                       dgid = op->u.get_grp_info.dgid;
+
+                       list_for_each_entry(grp, &domgrplist, groups) {
+                               if (grp->group_id >= dgid) {
+                                       ret = 0;
+                                       break;
+                               }
+                       }
+                       if (ret)
+                               goto getgrpinfo_out;
+
+                       get_grp_info(grp, &op->u.get_grp_info);
+
+                       if (copy_to_guest(u_domgrpctl, op, 1))
+                               ret = -EFAULT;
+
+                     getgrpinfo_out:
+                       read_unlock(&domgrplist_lock);
+                       break;
+               }
+
+       case XEN_DOMGRPCTL_creategrp:
+               {
+                       dgid = get_new_group_id();
+                       if (dgid == NULL_GROUP_ID) {
+                               ret = -EINVAL;
+                               break;
+                       }
+
+                       grp = domain_group_create(dgid);
+                       if (grp == NULL) {
+                               ret = -ENOMEM;
+                               break;
+                       }
+
+                       memcpy(grp->handle, op->u.create_grp.handle,
+                              sizeof(xen_domain_group_handle_t));
+
+                       op->u.create_grp.dgid = grp->group_id;
+                       if (copy_to_guest(u_domgrpctl, op, 1))
+                               ret = -EFAULT;
+
+                       break;
+               }
+
+       case XEN_DOMGRPCTL_joingrp:
+               {
+                       domid_t domid;
+                       struct domain *dom;
+
+                       domid = op->u.join_grp.domid;
+                       dgid = op->u.join_grp.dgid;
+
+                       dom = get_domain_by_id(domid);
+                       if (dom == NULL)
+                               ret = -ESRCH;
+                       else
+                               ret = add_dom_to_grp(dom, dgid);
+                       put_domain(dom);
+
+                       break;
+               }
+
+       case XEN_DOMGRPCTL_pausegrp:
+               {
+                       ret = pause_grp(op->u.pause_grp.dgid);
+                       break;
+               }
+
+       case XEN_DOMGRPCTL_unpausegrp:
+               {
+                       ret = unpause_grp(op->u.unpause_grp.dgid);
+                       break;
+               }
+
+       case XEN_DOMGRPCTL_destroygrp:
+               {
+                       ret = domain_group_destroy(op->u.destroy_grp.dgid);
+                       break;
+               }
+
+       default:
+               ret = -EINVAL;
+       }
+
+       spin_unlock(&domgrpctl_lock);
+      out:
+       return ret;
+}
diff -r ecb6cd61a9cf xen/include/public/domgrpctl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/public/domgrpctl.h    Tue Feb 20 12:59:11 2007 -0500
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * domgrpctl.h
+ *
+ * Domain group management operations. For use by node control stack.
+ *
+ * Author: Chris Bookholt (hap10@xxxxxxxxxxxxxx)
+ */
+
+#ifndef __XEN_PUBLIC_DOMGRPCTL_H__
+#define __XEN_PUBLIC_DOMGRPCTL_H__
+
+#if !defined(__XEN__) && !defined(__XEN_TOOLS__)
+#error "domgrpctl operations are intended for use by node control tools only"
+#endif
+
+#include "xen.h"
+
+#define XEN_DOMGRPCTL_INTERFACE_VERSION 0x00000001
+
+#define MAX_GROUP_SIZE                 24
+#define NULL_GROUP_ID                  (0x7FFFU)
+#define INVAL_GROUP_ID                 (0xFFFFU)
+
+#define XEN_DOMGRPCTL_creategrp                1
+struct xen_domgrpctl_creategrp {
+       dgid_t dgid;
+       xen_domain_group_handle_t handle;
+};
+typedef struct xen_domgrpctl_creategrp xen_domgrpctl_creategrp_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domgrpctl_creategrp_t);
+
+#define XEN_DOMGRPCTL_joingrp          2
+struct xen_domgrpctl_joingrp {
+       domid_t domid;
+       dgid_t dgid;
+};
+typedef struct xen_domgrpctl_joingrp xen_domgrpctl_joingrp_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domgrpctl_joingrp_t);
+
+#define XEN_DOMGRPCTL_pausegrp         3
+struct xen_domgrpctl_pausegrp {
+       dgid_t dgid;
+};
+typedef struct xen_domgrpctl_pausegrp xen_domgrpctl_pausegrp_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domgrpctl_pausegrp_t);
+
+#define XEN_DOMGRPCTL_unpausegrp       4
+struct xen_domgrpctl_unpausegrp {
+       dgid_t dgid;
+};
+typedef struct xen_domgrpctl_unpausegrp xen_domgrpctl_unpausegrp_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domgrpctl_unpausegrp_t);
+
+#define XEN_DOMGRPCTL_destroygrp       5
+struct xen_domgrpctl_destroygrp {
+       dgid_t dgid;
+};
+typedef struct xen_domgrpctl_destroygrp xen_domgrpctl_destroygrp_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domgrpctl_destroygrp_t);
+
+#define XEN_DOMGRPCTL_getgrpinfo       6
+struct xen_domgrpctl_getgrpinfo {
+       dgid_t dgid;
+       uint16_t size;
+       domid_t member_list[MAX_GROUP_SIZE];
+       xen_domain_group_handle_t handle;
+};
+typedef struct xen_domgrpctl_getgrpinfo xen_domgrpctl_getgrpinfo_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domgrpctl_getgrpinfo_t);
+
+struct xen_domgrpctl {
+       uint32_t cmd;
+       uint32_t interface_version;
+       union {
+               struct xen_domgrpctl_creategrp create_grp;
+               struct xen_domgrpctl_joingrp join_grp;
+               struct xen_domgrpctl_pausegrp pause_grp;
+               struct xen_domgrpctl_unpausegrp unpause_grp;
+               struct xen_domgrpctl_destroygrp destroy_grp;
+               struct xen_domgrpctl_getgrpinfo get_grp_info;
+       } u;
+};
+typedef struct xen_domgrpctl xen_domgrpctl_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domgrpctl_t);
+
+#endif                         /* __XEN_PUBLIC_DOMGRPCTL_H__ */
diff -r ecb6cd61a9cf xen/include/xen/domgrp.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/xen/domgrp.h  Tue Feb 20 12:59:11 2007 -0500
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * domgrp.h
+ *
+ * Generic domain group-handling functions.
+ *
+ * Author: Chris Bookholt (hap10@xxxxxxxxxxxxxx)
+ */
+
+#ifndef __XEN_DOM_GROUP_H__
+#define __XEN_DOM_GROUP_H__
+
+#include <public/domgrpctl.h>
+
+extern struct list_head domgrplist;
+
+void get_grp_info(struct domain_group *grp, xen_domgrpctl_getgrpinfo_t * info);
+
+struct domain_group *find_grp_by_id(dgid_t dgid);
+
+uint16_t get_new_group_id(void);
+
+struct domain_group *domain_group_create(dgid_t dgid);
+
+int del_dom_from_grp(struct domain *old_dom);
+
+int add_dom_to_grp(struct domain *dom, dgid_t dgid);
+
+int pause_grp(dgid_t dgid);
+
+int unpause_grp(dgid_t dgid);
+
+int domain_group_destroy(dgid_t dgid);
+
+int init_domain_groups(void);
+
+#endif                         /* __XEN_DOM_GROUP_H__ */



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 4/8] [xen] Domain Groups: VMM domain group framework, Chris <=