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

[Xen-devel] [PATCH v9 2/5] xen: add parent_domid field to createdomain domctl



When creating a domain that will be used as a VM fork some information is
required to set things up properly, like the max_vcpus count. Instead of the
toolstack having to gather this information for each fork in a separate
hypercall we can just include the parent domain's id in the createdomain domctl
so that Xen can copy the setting without the extra toolstack queries.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>
---
 xen/common/domctl.c         | 14 ++++++++++++++
 xen/include/public/domctl.h |  3 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index a69b3b59a8..22aceb3860 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -489,6 +489,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
u_domctl)
     case XEN_DOMCTL_createdomain:
     {
         domid_t        dom;
+        domid_t        parent_dom;
         static domid_t rover = 0;
 
         dom = op->domain;
@@ -515,6 +516,19 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
u_domctl)
             rover = dom;
         }
 
+        parent_dom = op->u.createdomain.parent_domid;
+        if ( parent_dom )
+        {
+            struct domain *pd = rcu_lock_domain_by_id(parent_dom);
+
+            ret = -EINVAL;
+            if ( !pd )
+                break;
+
+            op->u.createdomain.max_vcpus = pd->max_vcpus;
+            rcu_unlock_domain(pd);
+        }
+
         d = domain_create(dom, &op->u.createdomain, false);
         if ( IS_ERR(d) )
         {
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index fec6f6fdd1..251cc40ef6 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -38,7 +38,7 @@
 #include "hvm/save.h"
 #include "memory.h"
 
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000012
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000013
 
 /*
  * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
@@ -92,6 +92,7 @@ struct xen_domctl_createdomain {
     uint32_t max_evtchn_port;
     int32_t max_grant_frames;
     int32_t max_maptrack_frames;
+    domid_t parent_domid;
 
     struct xen_arch_domainconfig arch;
 };
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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