]> xenbits.xensource.com Git - xen.git/commitdiff
tools: Pass grant table limits to XEN_DOMCTL_set_gnttab_limits
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 27 Feb 2018 17:39:37 +0000 (17:39 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 31 Aug 2018 11:06:53 +0000 (12:06 +0100)
XEN_DOMCTL_set_gnttab_limits is a fairly new hypercall, and is strictly
mandatory.  As it pertains to domain limits, it should be provided at
createdomain time.

In preparation to remove the hypercall, extend xen_domctl_createdomain with
the fields and arrange for all callers to pass appropriate details.  There is
no change in construction behaviour yet, but later patches will rearrange the
hypervisor internals, then delete the hypercall.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/helpers/init-xenstore-domain.c
tools/libxl/libxl_create.c
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli
tools/ocaml/libs/xc/xenctrl_stubs.c
tools/python/xen/lowlevel/xc/xc.c
xen/include/public/domctl.h

index 89c329c7c6b34a10a9f8eaed834b4580914d40b5..cd27edccb7a129a1dcd0da005509d2f116608bb4 100644 (file)
@@ -67,6 +67,14 @@ static int build(xc_interface *xch)
         .ssidref = SECINITSID_DOMU,
         .flags = XEN_DOMCTL_CDF_xs_domain,
         .max_evtchn_port = -1, /* No limit. */
+
+        /*
+         * 1 grant frame is enough: we don't need many grants.
+         * Mini-OS doesn't like less than 4, though, so use 4.
+         * 128 maptrack frames: 256 entries per frame, enough for 32768 domains.
+         */
+        .max_grant_frames = 4,
+        .max_maptrack_frames = 128,
     };
 
     xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
@@ -104,12 +112,8 @@ static int build(xc_interface *xch)
         fprintf(stderr, "xc_domain_setmaxmem failed\n");
         goto err;
     }
-    /*
-     * 1 grant frame is enough: we don't need many grants.
-     * Mini-OS doesn't like less than 4, though, so use 4.
-     * 128 maptrack frames: 256 entries per frame, enough for 32768 domains.
-     */
-    rv = xc_domain_set_gnttab_limits(xch, domid, 4, 128);
+    rv = xc_domain_set_gnttab_limits(xch, domid, config.max_grant_frames,
+                                     config.max_maptrack_frames);
     if ( rv )
     {
         fprintf(stderr, "xc_domain_set_gnttab_limits failed\n");
index b7b44e280b5ef007b727b81447347ffd5fc64787..8b755e412d1423cb65e6f627589239d6d67d5eba 100644 (file)
@@ -567,6 +567,8 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
         struct xen_domctl_createdomain create = {
             .ssidref = info->ssidref,
             .max_evtchn_port = b_info->event_channels,
+            .max_grant_frames = b_info->max_grant_frames,
+            .max_maptrack_frames = b_info->max_maptrack_frames,
         };
 
         if (info->type != LIBXL_DOMAIN_TYPE_PV) {
index 219355aefe07fbdd575f4fa24c85f9e5926f2d2a..42f45c4b67e0dd48ce4a55d0eb620b0e2b9edfc1 100644 (file)
@@ -64,6 +64,8 @@ type domctl_create_config =
        handle: string;
        flags: domain_create_flag list;
        max_evtchn_port: int;
+       max_grant_frames: int;
+       max_maptrack_frames: int;
        arch: arch_domainconfig;
 }
 
index c0c724b09d73cbfeff12a9d4804240cf38d0544e..0db58162d0179d9c9e7d3b5f10948718c9d17783 100644 (file)
@@ -56,6 +56,8 @@ type domctl_create_config = {
   handle: string;
   flags: domain_create_flag list;
   max_evtchn_port: int;
+  max_grant_frames: int;
+  max_maptrack_frames: int;
   arch: arch_domainconfig;
 }
 
index f8bdebadb17066bcb62d45129d05bf1a058bf541..1b5abd9f3a8af58faaf47d80f556fb5d07d2a516 100644 (file)
@@ -129,13 +129,17 @@ CAMLprim value stub_xc_domain_create(value xch, value config)
 #define VAL_HANDLE              Field(config, 1)
 #define VAL_FLAGS               Field(config, 2)
 #define VAL_MAX_EVTCHN_PORT     Field(config, 3)
-#define VAL_ARCH                Field(config, 4)
+#define VAL_MAX_GRANT_FRAMES    Field(config, 4)
+#define VAL_MAX_MAPTRACK_FRAMES Field(config, 5)
+#define VAL_ARCH                Field(config, 6)
 
        uint32_t domid = 0;
        int result;
        struct xen_domctl_createdomain cfg = {
                .ssidref = Int32_val(VAL_SSIDREF),
                .max_evtchn_port = Int_val(VAL_MAX_EVTCHN_PORT),
+               .max_grant_frames = Int_val(VAL_MAX_GRANT_FRAMES),
+               .max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
        };
 
        domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
@@ -171,6 +175,8 @@ CAMLprim value stub_xc_domain_create(value xch, value config)
        }
 
 #undef VAL_ARCH
+#undef VAL_MAX_MAPTRACK_FRAMES
+#undef VAL_MAX_GRANT_FRAMES
 #undef VAL_MAX_EVTCHN_PORT
 #undef VAL_FLAGS
 #undef VAL_HANDLE
index 4dc6d1ca1e1e70be86c90d029eb06bab6a9add55..6bd58ecbcdc3c42a97ea9cb68fa1232eb0d74dd6 100644 (file)
@@ -126,6 +126,8 @@ static PyObject *pyxc_domain_create(XcObject *self,
             0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
         },
         .max_evtchn_port = -1, /* No limit. */
+        .max_grant_frames = 32,
+        .max_maptrack_frames = 1024,
     };
 
     static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", "target", NULL };
index 7fc07cce137f7d66c6258d9f11589a64b01653bb..59baa52716c90589fb494de0a659acc2fd54a279 100644 (file)
@@ -71,6 +71,8 @@ struct xen_domctl_createdomain {
      * mapping space, xenheap, etc) a guest may consume.
      */
     uint32_t max_evtchn_port;
+    uint32_t max_grant_frames;
+    uint32_t max_maptrack_frames;
 
     struct xen_arch_domainconfig arch;
 };