From patchwork Sun Aug 6 16:22:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meng Xu X-Patchwork-Id: 9883867 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 290E56031B for ; Sun, 6 Aug 2017 16:25:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A357285AE for ; Sun, 6 Aug 2017 16:25:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EB16285B0; Sun, 6 Aug 2017 16:25:59 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 6F76B285AE for ; Sun, 6 Aug 2017 16:25:58 +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 1deOKf-0007I2-Sg; Sun, 06 Aug 2017 16:23:13 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deOKe-0007Hh-49 for xen-devel@lists.xen.org; Sun, 06 Aug 2017 16:23:12 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 2B/74-02181-F6247895; Sun, 06 Aug 2017 16:23:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRWlGSWpSXmKPExsUyr8m9UTfPqT3 SYMsMCYslHxezODB6HN39mymAMYo1My8pvyKBNaPn5AXGgrsuFRdvNLA2MK4x6GLk5BASmMEk cXBnDIjNJqAicXzDI1YQW0RAWuLa58uMIDazwAZGidtngWo4OIQFnCUO/s8ACbMIqEpM+HubH cTmBQp/O9UAVi4hICdx8thksDGcAi4S//6cYYFY5SzxeNsGVoiaUIk1i88zwdQ/fviAcQIjzw JGhlWM6sWpRWWpRbqWeklFmekZJbmJmTm6hgbGermpxcWJ6ak5iUnFesn5uZsYgR6vZ2Bg3MH 4+qfTIUZJDiYlUd74FW2RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4Lzq0RwoJFqWmp1akZeYA Qw8mLcHBoyTCewAkzVtckJhbnJkOkTrFaMyxYfX6L0wcryb8/8YkxJKXn5cqJc47FaRUAKQ0o zQPbhAsJi4xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEua9CjKFJzOvBG7fK6BTmIBOeZPYCn JKSSJCSqqB0SRd0VCQqeBfqP2qxjc3lBZ/FSoXucaWNEWxx+5/0T0dk7jCRel+HyZenJU1Q/z Nl/pfgo979q55JHqFVdu8YLrQ63arLY2Tft3doL07icP0h7qZYnqM3DKfz+lLw5Vn7dRW3Ke7 zCIuZd2Hgre3VvwxX5FSlba+6aVxXm6h6JvPesZeURceKrEUZyQaajEXFScCAPrcctKEAgAA X-Env-Sender: mengxu@cis.upenn.edu X-Msg-Ref: server-16.tower-31.messagelabs.com!1502036589!101200293!1 X-Originating-IP: [158.130.71.129] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7175 invoked from network); 6 Aug 2017 16:23:10 -0000 Received: from renard.seas.upenn.edu (HELO fox.seas.upenn.edu) (158.130.71.129) by server-16.tower-31.messagelabs.com with SMTP; 6 Aug 2017 16:23:10 -0000 Received: from panda-catbroadwell.cis.upenn.edu (SEASnet-48-12.cis.upenn.edu [158.130.48.13]) (authenticated bits=0) by fox.seas.upenn.edu (8.15.2/8.14.5) with ESMTPSA id v76GMxOq022037 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT); Sun, 6 Aug 2017 12:23:01 -0400 From: Meng Xu To: xen-devel@lists.xen.org Date: Sun, 6 Aug 2017 12:22:43 -0400 Message-Id: <1502036563-4275-4-git-send-email-mengxu@cis.upenn.edu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502036563-4275-1-git-send-email-mengxu@cis.upenn.edu> References: <1502036563-4275-1-git-send-email-mengxu@cis.upenn.edu> X-Proofpoint-Virus-Version: vendor=nai engine=5600 definitions=5800 signatures=585085 X-Proofpoint-Spam-Reason: safe Cc: george.dunlap@eu.citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xumengpanda@gmail.com, Meng Xu , wei.liu@citrix.com Subject: [Xen-devel] [PATCH v1 3/3] xl: enable per-VCPU extratime flag for RTDS 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 Change main_sched_rtds and related output functions to support per-VCPU extratime flag. Signed-off-by: Meng Xu --- Changes from RFC v1 Changes work_conserving flag to extratime flag --- tools/xl/xl_cmdtable.c | 3 ++- tools/xl/xl_sched.c | 56 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 2c71a9f..88933a4 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -272,12 +272,13 @@ struct cmd_spec cmd_table[] = { { "sched-rtds", &main_sched_rtds, 0, 1, "Get/set rtds scheduler parameters", - "[-d [-v[=VCPUID/all]] [-p[=PERIOD]] [-b[=BUDGET]]]", + "[-d [-v[=VCPUID/all]] [-p[=PERIOD]] [-b[=BUDGET]] [-e[=EXTRATIME]]]", "-d DOMAIN, --domain=DOMAIN Domain to modify\n" "-v VCPUID/all, --vcpuid=VCPUID/all VCPU to modify or output;\n" " Using '-v all' to modify/output all vcpus\n" "-p PERIOD, --period=PERIOD Period (us)\n" "-b BUDGET, --budget=BUDGET Budget (us)\n" + "-e EXTRATIME, --extratime=EXTRATIME EXTRATIME (1=yes, 0=no)\n" }, { "domid", &main_domid, 0, 0, diff --git a/tools/xl/xl_sched.c b/tools/xl/xl_sched.c index 85722fe..5138012 100644 --- a/tools/xl/xl_sched.c +++ b/tools/xl/xl_sched.c @@ -251,7 +251,7 @@ static int sched_rtds_domain_output( libxl_domain_sched_params scinfo; if (domid < 0) { - printf("%-33s %4s %9s %9s\n", "Name", "ID", "Period", "Budget"); + printf("%-33s %4s %9s %9s %10s\n", "Name", "ID", "Period", "Budget", "Extra time"); return 0; } @@ -262,11 +262,12 @@ static int sched_rtds_domain_output( } domname = libxl_domid_to_name(ctx, domid); - printf("%-33s %4d %9d %9d\n", + printf("%-33s %4d %9d %9d %10s\n", domname, domid, scinfo.period, - scinfo.budget); + scinfo.budget, + scinfo.extratime ? "yes" : "no"); free(domname); libxl_domain_sched_params_dispose(&scinfo); return 0; @@ -279,8 +280,8 @@ static int sched_rtds_vcpu_output(int domid, libxl_vcpu_sched_params *scinfo) int i; if (domid < 0) { - printf("%-33s %4s %4s %9s %9s\n", "Name", "ID", - "VCPU", "Period", "Budget"); + printf("%-33s %4s %4s %9s %9s %10s\n", "Name", "ID", + "VCPU", "Period", "Budget", "Extra time"); return 0; } @@ -290,12 +291,13 @@ static int sched_rtds_vcpu_output(int domid, libxl_vcpu_sched_params *scinfo) domname = libxl_domid_to_name(ctx, domid); for ( i = 0; i < scinfo->num_vcpus; i++ ) { - printf("%-33s %4d %4d %9"PRIu32" %9"PRIu32"\n", + printf("%-33s %4d %4d %9"PRIu32" %9"PRIu32" %10s\n", domname, domid, scinfo->vcpus[i].vcpuid, scinfo->vcpus[i].period, - scinfo->vcpus[i].budget); + scinfo->vcpus[i].budget, + scinfo->vcpus[i].extratime ? "yes" : "no"); } free(domname); return 0; @@ -309,8 +311,8 @@ static int sched_rtds_vcpu_output_all(int domid, int i; if (domid < 0) { - printf("%-33s %4s %4s %9s %9s\n", "Name", "ID", - "VCPU", "Period", "Budget"); + printf("%-33s %4s %4s %9s %9s %10s\n", "Name", "ID", + "VCPU", "Period", "Budget", "Extra time"); return 0; } @@ -321,12 +323,13 @@ static int sched_rtds_vcpu_output_all(int domid, domname = libxl_domid_to_name(ctx, domid); for ( i = 0; i < scinfo->num_vcpus; i++ ) { - printf("%-33s %4d %4d %9"PRIu32" %9"PRIu32"\n", + printf("%-33s %4d %4d %9"PRIu32" %9"PRIu32" %10s\n", domname, domid, scinfo->vcpus[i].vcpuid, scinfo->vcpus[i].period, - scinfo->vcpus[i].budget); + scinfo->vcpus[i].budget, + scinfo->vcpus[i].extratime ? "yes" : "no"); } free(domname); return 0; @@ -702,14 +705,18 @@ int main_sched_rtds(int argc, char **argv) int *vcpus = (int *)xmalloc(sizeof(int)); /* IDs of VCPUs that change */ int *periods = (int *)xmalloc(sizeof(int)); /* period is in microsecond */ int *budgets = (int *)xmalloc(sizeof(int)); /* budget is in microsecond */ + bool *extratimes = (bool *)xmalloc(sizeof(bool)); /* extratime is bool */ int v_size = 1; /* size of vcpus array */ int p_size = 1; /* size of periods array */ int b_size = 1; /* size of budgets array */ + int e_size = 1; /* size of extratimes array */ int v_index = 0; /* index in vcpus array */ int p_index =0; /* index in periods array */ int b_index =0; /* index for in budgets array */ + int e_index = 0; /* index in extratimes array */ bool opt_p = false; bool opt_b = false; + bool opt_e = false; bool opt_v = false; bool opt_all = false; /* output per-dom parameters */ int opt, i, rc, r; @@ -717,12 +724,13 @@ int main_sched_rtds(int argc, char **argv) {"domain", 1, 0, 'd'}, {"period", 1, 0, 'p'}, {"budget", 1, 0, 'b'}, + {"extratime", 1, 0, 'e'}, {"vcpuid",1, 0, 'v'}, {"cpupool", 1, 0, 'c'}, COMMON_LONG_OPTS }; - SWITCH_FOREACH_OPT(opt, "d:p:b:v:c", opts, "sched-rtds", 0) { + SWITCH_FOREACH_OPT(opt, "d:p:b:e:v:c", opts, "sched-rtds", 0) { case 'd': dom = optarg; break; @@ -746,6 +754,14 @@ int main_sched_rtds(int argc, char **argv) budgets[b_index++] = strtol(optarg, NULL, 10); opt_b = 1; break; + case 'e': + if (e_index >= e_size) { /* extratime array is full */ + e_size *= 2; + extratimes = xrealloc(extratimes, e_size); + } + extratimes[e_index++] = strtol(optarg, NULL, 10); + opt_e = 1; + break; case 'v': if (!strcmp(optarg, "all")) { /* get or set all vcpus of a domain */ opt_all = 1; @@ -763,18 +779,18 @@ int main_sched_rtds(int argc, char **argv) break; } - if (cpupool && (dom || opt_p || opt_b || opt_v || opt_all)) { + if (cpupool && (dom || opt_p || opt_b || opt_e || opt_v || opt_all)) { fprintf(stderr, "Specifying a cpupool is not allowed with " "other options.\n"); r = EXIT_FAILURE; goto out; } - if (!dom && (opt_p || opt_b || opt_v)) { + if (!dom && (opt_p || opt_b || opt_e || opt_v)) { fprintf(stderr, "Missing parameters.\n"); r = EXIT_FAILURE; goto out; } - if (dom && !opt_v && !opt_all && (opt_p || opt_b)) { + if (dom && !opt_v && !opt_all && (opt_p || opt_b || opt_e)) { fprintf(stderr, "Must specify VCPU.\n"); r = EXIT_FAILURE; goto out; @@ -785,8 +801,9 @@ int main_sched_rtds(int argc, char **argv) goto out; } if (((v_index > b_index) && opt_b) || ((v_index > p_index) && opt_p) - || p_index != b_index) { - fprintf(stderr, "Incorrect number of period and budget\n"); + || ((v_index > e_index) && opt_e) || p_index != b_index + || p_index != e_index || b_index != e_index ) { + fprintf(stderr, "Incorrect number of period, budget and extratime\n"); r = EXIT_FAILURE; goto out; } @@ -820,7 +837,7 @@ int main_sched_rtds(int argc, char **argv) r = EXIT_FAILURE; goto out; } - } else if (!opt_p && !opt_b) { + } else if (!opt_p && !opt_b && !opt_e) { /* get per-vcpu rtds scheduling parameters */ libxl_vcpu_sched_params scinfo; libxl_vcpu_sched_params_init(&scinfo); @@ -852,6 +869,7 @@ int main_sched_rtds(int argc, char **argv) scinfo.vcpus[i].vcpuid = vcpus[i]; scinfo.vcpus[i].period = periods[i]; scinfo.vcpus[i].budget = budgets[i]; + scinfo.vcpus[i].extratime = extratimes[i] ? 1 : 0; } rc = sched_vcpu_set(domid, &scinfo); } else { /* set params for all vcpus */ @@ -860,6 +878,7 @@ int main_sched_rtds(int argc, char **argv) xmalloc(sizeof(libxl_sched_params)); scinfo.vcpus[0].period = periods[0]; scinfo.vcpus[0].budget = budgets[0]; + scinfo.vcpus[0].extratime = extratimes[0] ? 1 : 0; rc = sched_vcpu_set_all(domid, &scinfo); } @@ -876,6 +895,7 @@ out: free(vcpus); free(periods); free(budgets); + free(extratimes); return r; }