From patchwork Tue Sep 12 00:45:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: anshul makkar X-Patchwork-Id: 9952143 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E672B60360 for ; Wed, 13 Sep 2017 21:33:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D831D28C53 for ; Wed, 13 Sep 2017 21:33:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCFF228C6C; Wed, 13 Sep 2017 21:33:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3474528C53 for ; Wed, 13 Sep 2017 21:33:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsFGE-0000XA-As; Wed, 13 Sep 2017 21:31:54 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsFGD-0000WZ-1W for xen-devel@lists.xen.org; Wed, 13 Sep 2017 21:31:53 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 30/F8-01761-8C3A9B95; Wed, 13 Sep 2017 21:31:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIIsWRWlGSWpSXmKPExsVyMbThkO7xxTs jDQ50SVks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlnr5YW9FtXzD72hLWB8ZduFyMXh5DABEaJ 5q+fmUEcFoGXLBLTXz9gA3EkBPpZJY4/PM3axcgJ5CRJfF57AMpOk+jteARlV0hc+H2RGcQWE lCVmLxwAgvE2FVMEsfuXQVLsAloS6z6MBusQURAWuLa58uMIEXMAlOYJY48e8YCkhAWiJF40N HICGKzAE1qef4bLM4r4CYxed86FohtchI3z3WCDeUUcJdYPe8AE8RmN4mbGw4zT2AUXMDIsIp Rozi1qCy1SNfIWC+pKDM9oyQ3MTNH19DAVC83tbg4MT01JzGpWC85P3cTIzDo6hkYGHcw7mj3 O8QoycGkJMq7V3dnpBBfUn5KZUZicUZ8UWlOavEhRg0ODoEJZ+dOZ5JiycvPS1WS4C1ZBFQnW JSanlqRlpkDjAuYUgkOHiURXmeQNG9xQWJucWY6ROoUoyvHhTuX/jBxHNt0GUge2HMLSHbcvA skmxbc/8MkBDZbSpy3DaRZAKQ5ozQPbjQspi8xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEuZ lAyYIIZ7MvBK4C14BHccEdNyZ0ztAjitJREhJNTBOWBAo2xidubn2TWL6Xq5px8piXZ9PP++3 17GTW+97YNgc+08LAufcb+XSLQrf3FJSesJttrddgeO9UwqzNSN2VrnZhz0+WFLCteiX4WxNZ VOPpb1ZvhOebqvW+aXwoFnnfotgrcxEU0fTPc81Lrr5KzGXCXQxKdSVnDTZGV3E3hrtwRqqrs RSnJFoqMVcVJwIAE+8V7jkAgAA X-Env-Sender: anshulmakkar@gmail.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1505338311!97403311!1 X-Originating-IP: [209.85.128.194] X-SpamReason: No, hits=0.8 required=7.0 tests=DATE_IN_PAST_24_48 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 35096 invoked from network); 13 Sep 2017 21:31:51 -0000 Received: from mail-wr0-f194.google.com (HELO mail-wr0-f194.google.com) (209.85.128.194) by server-15.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 13 Sep 2017 21:31:51 -0000 Received: by mail-wr0-f194.google.com with SMTP id g50so695305wra.3 for ; Wed, 13 Sep 2017 14:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iEYxMwjYwtKrF+J8FFAez3xNqJ3lM180+63yVaxrPYc=; b=ViUDR3SwKL0BIA/lbk7MLbioCMOm/6Tp/CyqD5vYgDx5irnHsQfR6p8uTvxcJj+cyv WNKYobYGEtPRdLeR0gfoxhJrp/aDGg9lflHp+2dvdeQEHf8pVs2D4VbBUi/HjysYss2s r9lz8AuI5DemyGE+Mv3Ahah5I3regUl6VyuxeVLnRoL620GR626rYDBLnuceJIhH2vKU GmBRJVCuYyK+EjnsBi9ouKeEXYg9k4GoLWjBdKo9U5dkPXfZT+KOcwKVMVwL6K2UsLTx OHicWbTNMVXqhaViwZWLUi/Wjzcj5q85uPf6Z+oP0I+7eZ88SCNczB+Xx1hq4Tmu5QGM 47vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iEYxMwjYwtKrF+J8FFAez3xNqJ3lM180+63yVaxrPYc=; b=A/hzGW5ihgLS0QxphXuhVorwPPdAWCk2vhbDlRiz3unJpuAuYT5vYEiSaOLiMcQFI3 +fLGoA6itTiH1K2UaZj1/8Kzw2sHKR/zoJ+wX4GZxGE7s6p1nbjbMeZynntTA54cD6QP +p3aBOVVeupsqOVyBrhy7gXkbdek410XP/R1/BD5CpKF9Y12ieGh7C7/gr6yPyHWmWXk Os0m+JmuGmLqowihcF9NOgMCMG9LXF8N4HU+r3rTYRamrC3IQRNm/t0+oTYPV5ndDFYg oDJIxZtslvc/GJtnxvO8VQtCl8lYfp9AIiplYt/aa+C3P09mY5mpT6irGJHO294u3r0d zM+A== X-Gm-Message-State: AHPjjUg3hlJ5zPY9ToHeIJ+isBT4RJBmvOa4ts5NyxAd/9DHiselmzYt IW9cqDgbzLfULm5LpLo= X-Google-Smtp-Source: ADKCNb5h4ixTlnY2YIkXhHXBFFkqn4NRHv8ClHy4EjM4elHqroM2l962RVfd5dbAx6Sddj8yfZqEJw== X-Received: by 10.223.146.129 with SMTP id 1mr17024378wrn.1.1505338310665; Wed, 13 Sep 2017 14:31:50 -0700 (PDT) Received: from anshul-VirtualBox.home (host109-151-54-23.range109-151.btcentralplus.com. [109.151.54.23]) by smtp.gmail.com with ESMTPSA id j4sm9224317wrg.96.2017.09.13.14.31.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Sep 2017 14:31:49 -0700 (PDT) From: anshulmakkar To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 01:45:41 +0100 Message-Id: <1505177142-14864-3-git-send-email-anshulmakkar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505177142-14864-1-git-send-email-anshulmakkar@gmail.com> References: <1505177142-14864-1-git-send-email-anshulmakkar@gmail.com> 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 Subject: [Xen-devel] [PATCH 2/3] credit2: libxl related changes to add support for runqueue per cpupool. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Introduces scheduler specific parameter at libxl level which are passed on to libxc. eg runqueue for credit2 Signed-off-by: Anshul Makkar --- 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; }