xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: anshulmakkar <anshulmakkar@gmail.com>
To: xen-devel@lists.xen.org
Cc: jgross@suse.com, sstabellini@kernel.org, wei.liu2@citrix.com,
	George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
	dario.faggioli@citrix.com, ian.jackson@eu.citrix.com,
	marmarek@invisiblethingslab.com,
	robert.vanvossen@dornerworks.com, tim@xen.org,
	josh.whitehead@dornerworks.com, mengxu@cis.upenn.edu,
	jbeulich@suse.com, anshulmakkar <anshulmakkar@gmail.com>
Subject: [PATCH 2/3] credit2: libxl related changes to add support for runqueue per cpupool.
Date: Tue, 12 Sep 2017 01:45:41 +0100	[thread overview]
Message-ID: <1505177142-14864-3-git-send-email-anshulmakkar@gmail.com> (raw)
In-Reply-To: <1505177142-14864-1-git-send-email-anshulmakkar@gmail.com>

Introduces scheduler specific parameter at libxl level which are 
passed on to libxc. eg runqueue for credit2

Signed-off-by: Anshul Makkar <anshulmakkar@gmail.com>
---
 tools/libxl/libxl.h         |  2 +-
 tools/libxl/libxl_cpupool.c | 15 +++++++++++++--
 tools/libxl/libxl_types.idl | 46 ++++++++++++++++++++++++++++++++++-----------
 tools/xl/xl_cpupool.c       | 16 ++++++++++++++--
 4 files changed, 63 insertions(+), 16 deletions(-)

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 91408b4..6617c64 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -2150,7 +2150,7 @@ int libxl_get_freecpus(libxl_ctx *ctx, libxl_bitmap *cpumap);
 int libxl_cpupool_create(libxl_ctx *ctx, const char *name,
                          libxl_scheduler sched,
                          libxl_bitmap cpumap, libxl_uuid *uuid,
-                         uint32_t *poolid);
+                         uint32_t *poolid, const libxl_scheduler_params *sched_param);
 int libxl_cpupool_destroy(libxl_ctx *ctx, uint32_t poolid);
 int libxl_cpupool_rename(libxl_ctx *ctx, const char *name, uint32_t poolid);
 int libxl_cpupool_cpuadd(libxl_ctx *ctx, uint32_t poolid, int cpu);
diff --git a/tools/libxl/libxl_cpupool.c b/tools/libxl/libxl_cpupool.c
index 85b0688..e3ce7b3 100644
--- a/tools/libxl/libxl_cpupool.c
+++ b/tools/libxl/libxl_cpupool.c
@@ -130,7 +130,7 @@ int libxl_get_freecpus(libxl_ctx *ctx, libxl_bitmap *cpumap)
 int libxl_cpupool_create(libxl_ctx *ctx, const char *name,
                          libxl_scheduler sched,
                          libxl_bitmap cpumap, libxl_uuid *uuid,
-                         uint32_t *poolid)
+                         uint32_t *poolid, const libxl_scheduler_params *sched_params)
 {
     GC_INIT(ctx);
     int rc;
@@ -138,6 +138,7 @@ int libxl_cpupool_create(libxl_ctx *ctx, const char *name,
     xs_transaction_t t;
     char *uuid_string;
     uint32_t xcpoolid;
+    xc_schedparam_t xc_sched_param; 
 
     /* Accept '0' as 'any poolid' for backwards compatibility */
     if ( *poolid == LIBXL_CPUPOOL_POOLID_ANY
@@ -151,8 +152,18 @@ int libxl_cpupool_create(libxl_ctx *ctx, const char *name,
         GC_FREE;
         return ERROR_NOMEM;
     }
+    if (sched_params)
+    {
+        xc_sched_param.u.sched_credit2.ratelimit_us = 
+                                                    sched_params->u.credit2.ratelimit_us;
+        xc_sched_param.u.sched_credit2.runq = sched_params->u.credit2.runqueue;
+        xc_sched_param.u.sched_credit.tslice_ms = sched_params->u.credit.tslice_ms;
+        xc_sched_param.u.sched_credit.ratelimit_us = sched_params->u.credit.ratelimit_us; 
+    }
+    else 
+        xc_sched_param.u.sched_credit2.runq = LIBXL_CREDIT2_RUNQUEUE_DEFAULT; 
 
-    rc = xc_cpupool_create(ctx->xch, &xcpoolid, sched);
+    rc = xc_cpupool_create(ctx->xch, &xcpoolid, sched, &xc_sched_param);
     if (rc) {
         LOGEV(ERROR, rc, "Could not create cpupool");
         GC_FREE;
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 173d70a..f25429d 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -194,6 +194,16 @@ libxl_scheduler = Enumeration("scheduler", [
     (9, "null"),
     ])
 
+# consistent with sched_credit2.c
+libxl_credit2_runqueue = Enumeration("credit2_runqueue", [
+    (0, "CPU"),
+    (1, "CORE"),
+    (2, "SOCKET"),
+    (3, "NODE"),
+    (4, "ALL"),
+    (5, "DEFAULT"),
+    ])
+
 # Consistent with SHUTDOWN_* in sched.h (apart from UNKNOWN)
 libxl_shutdown_reason = Enumeration("shutdown_reason", [
     (-1, "unknown"),
@@ -326,15 +336,38 @@ libxl_dominfo = Struct("dominfo",[
     ("domain_type", libxl_domain_type),
     ], dir=DIR_OUT)
 
+libxl_sched_credit_params = Struct("sched_credit_params", [
+    ("tslice_ms", integer),
+    ("ratelimit_us", integer),
+    ], dispose_fn=None)
+
+libxl_sched_credit2_params = Struct("sched_credit2_params", [
+    ("ratelimit_us", integer),
+    ("runqueue", libxl_credit2_runqueue),
+    ], dispose_fn=None)
+ 
+libxl_scheduler_params = Struct("scheduler_params", [
+    ("u", KeyedUnion(None,libxl_scheduler_tpye "scheduler_type",
+          [("credit2", libxl_sched_credit2_params),
+           ("credit", libxl_sched_credit_params),
+           ("null", None),
+           ("arinc653", None),
+           ("rtds", None),
+           ("unknown", None),
+           ("sedf", None),
+          ])),
+     ])
+
 libxl_cpupoolinfo = Struct("cpupoolinfo", [
     ("poolid",      uint32),
     ("pool_name",   string),
     ("sched",       libxl_scheduler),
     ("n_dom",       uint32),
-    ("cpumap",      libxl_bitmap)
+    ("cpumap",      libxl_bitmap),
+    ("sched_param", libxl_scheduler_params),
     ], dir=DIR_OUT)
 
-libxl_channelinfo = Struct("channelinfo", [
+ibxl_channelinfo = Struct("channelinfo", [
     ("backend", string),
     ("backend_id", uint32),
     ("frontend", string),
@@ -910,15 +943,6 @@ libxl_pcitopology = Struct("pcitopology", [
     ("node", uint32),
     ], dir=DIR_OUT)
 
-libxl_sched_credit_params = Struct("sched_credit_params", [
-    ("tslice_ms", integer),
-    ("ratelimit_us", integer),
-    ], dispose_fn=None)
-
-libxl_sched_credit2_params = Struct("sched_credit2_params", [
-    ("ratelimit_us", integer),
-    ], dispose_fn=None)
-
 libxl_domain_remus_info = Struct("domain_remus_info",[
     ("interval",             integer),
     ("allow_unsafe",         libxl_defbool),
diff --git a/tools/xl/xl_cpupool.c b/tools/xl/xl_cpupool.c
index 273811b..dc419eb 100644
--- a/tools/xl/xl_cpupool.c
+++ b/tools/xl/xl_cpupool.c
@@ -43,6 +43,7 @@ int main_cpupoolcreate(int argc, char **argv)
     char *name = NULL;
     uint32_t poolid;
     libxl_scheduler sched = 0;
+    libxl_scheduler_params sched_params;
     XLU_ConfigList *cpus;
     XLU_ConfigList *nodes;
     int n_cpus, n_nodes, i, n;
@@ -207,16 +208,27 @@ int main_cpupoolcreate(int argc, char **argv)
     } else
         n_cpus = 0;
 
+    sched_params.u.credit2.runqueue = LIBXL_CREDIT2_RUNQUEUE_CORE;
+    if (!xlu_cfg_get_string (config, "runqueue", &buf, 0) &&
+        sched == LIBXL_SCHEDULER_CREDIT2) {
+        if ((libxl_credit2_runqueue_from_string(buf, &sched_params.u.credit2.runqueue)) < 0 ) {
+            fprintf(stderr, "Unknown runqueue option\n");
+           sched_params.u.credit2.runqueue =  LIBXL_CREDIT2_RUNQUEUE_CORE; /*default CORE */
+        }
+    }
+
     libxl_uuid_generate(&uuid);
 
     printf("Using config file \"%s\"\n", config_src);
     printf("cpupool name:   %s\n", name);
     printf("scheduler:      %s\n", libxl_scheduler_to_string(sched));
+    if (sched == LIBXL_SCHEDULER_CREDIT2)
+        printf(" runq: %s\n", libxl_credit2_runqueue_to_string(sched_params.u.credit2.runqueue));
     printf("number of cpus: %d\n", n_cpus);
 
     if (!dryrun_only) {
         poolid = LIBXL_CPUPOOL_POOLID_ANY;
-        if (libxl_cpupool_create(ctx, name, sched, cpumap, &uuid, &poolid)) {
+        if (libxl_cpupool_create(ctx, name, sched, cpumap, &uuid, &poolid, &sched_params)) {
             fprintf(stderr, "error on creating cpupool\n");
             goto out_cfg;
         }
@@ -587,7 +599,7 @@ int main_cpupoolnumasplit(int argc, char **argv)
         xasprintf(&name, "Pool-node%d", node);
         libxl_uuid_generate(&uuid);
         poolid = 0;
-        if (libxl_cpupool_create(ctx, name, sched, cpumap, &uuid, &poolid)) {
+        if (libxl_cpupool_create(ctx, name, sched, cpumap, &uuid, &poolid, NULL)) {
             fprintf(stderr, "error on creating cpupool\n");
             goto out;
         }
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-09-12  0:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12  0:45 implement runqueue per cpupool anshulmakkar
2017-09-12  0:45 ` [PATCH 1/3] credit2: libxc related changes to add support for " anshulmakkar
2017-09-14  6:42   ` Juergen Gross
2017-09-14 12:58     ` Dario Faggioli
2019-01-17 16:10       ` anshul
2019-01-17 16:17         ` Juergen Gross
2017-09-14 13:28   ` Dario Faggioli
2017-09-12  0:45 ` anshulmakkar [this message]
2017-09-14  6:37   ` [PATCH 2/3] credit2: libxl " Juergen Gross
2017-11-16 21:10     ` Anshul Makkar
2017-11-17  6:58       ` Juergen Gross
2017-09-12  0:45 ` [PATCH 3/3] credit2: xen " anshulmakkar
2017-09-14  6:24   ` Juergen Gross
2017-09-14 10:03   ` Jan Beulich
2017-09-14 14:08   ` Dario Faggioli
2017-09-14  4:21 ` implement " Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505177142-14864-3-git-send-email-anshulmakkar@gmail.com \
    --to=anshulmakkar@gmail.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=josh.whitehead@dornerworks.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=mengxu@cis.upenn.edu \
    --cc=robert.vanvossen@dornerworks.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).