From patchwork Wed Oct 11 18:02:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meng Xu X-Patchwork-Id: 10000293 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 7CF8760216 for ; Wed, 11 Oct 2017 18:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C59428AFB for ; Wed, 11 Oct 2017 18:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7166728B00; Wed, 11 Oct 2017 18:04:46 +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 052A428AFB for ; Wed, 11 Oct 2017 18:04:46 +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 1e2LKz-0002uk-Ha; Wed, 11 Oct 2017 18:02:33 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2LKy-0002tv-O4 for xen-devel@lists.xen.org; Wed, 11 Oct 2017 18:02:32 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 47/D5-31244-8BC5ED95; Wed, 11 Oct 2017 18:02:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRWlGSWpSXmKPExsUyr8m9UXd7zL1 Ig5uvVC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxd/ROYC/5qVXxbr93A2KDcxcjFISTQzyRx vu8gUxcjJwebgIrE8Q2PWEFsEQFpiWufLzOCFDELbGSU2H38HTtIQljATeJJw1uwIhYBVYknz 5+D2bwCzhJnX+4Aq5EQkJM4eWwyWJxTwEXi+b9W5i5GDqBtzhK/u4whSkIl1iw+zwRT/vjhA8 YJjDwLGBlWMWoUpxaVpRbpGprqJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIEep0 BCHYwflsWcIhRkoNJSZQ3WO9epBBfUn5KZUZicUZ8UWlOavEhRhkODiUJXudooJxgUWp6akVa Zg4w/GDSEhw8SiK8uiBp3uKCxNzizHSI1ClGXY6Om3f/MAmx5OXnpUqJ814HKRIAKcoozYMbA YuFS4yyUsK8jEBHCfEUpBblZpagyr9iFOdgVBLmnQMyhSczrwRu0yugI5iAjhBNuwNyREkiQk qqgbFQWShJIVH2natW6VKxfJ5dJpNOX9oZvHmvtuvLm7ab7HT2zo64P1dT8ha/S3slU+GzT1t CL1QtOmJ6/nnW70euSROUrh37vPjaJea7LZFLBTtvNjHoatrfsa+4MXn6+sPX15X9nHDR1f2w R94XrpKd8lu23ViZZn96QtAO3m+TnaY5v9+a97FSiaU4I9FQi7moOBEAnG0hYoACAAA= X-Env-Sender: mengxu@cis.upenn.edu X-Msg-Ref: server-16.tower-27.messagelabs.com!1507744951!110897221!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.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44183 invoked from network); 11 Oct 2017 18:02:31 -0000 Received: from renard.seas.upenn.edu (HELO fox.seas.upenn.edu) (158.130.71.129) by server-16.tower-27.messagelabs.com with SMTP; 11 Oct 2017 18:02:31 -0000 Received: from panda-6c.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 v9BI2DV3017412 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT); Wed, 11 Oct 2017 14:02:14 -0400 From: Meng Xu To: xen-devel@lists.xen.org Date: Wed, 11 Oct 2017 14:02:03 -0400 Message-Id: <1507744926-3950-3-git-send-email-mengxu@cis.upenn.edu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507744926-3950-1-git-send-email-mengxu@cis.upenn.edu> References: <1507744926-3950-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: wei.liu2@citrix.com, george.dunlap@eu.citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xumengpanda@gmail.com, Meng Xu Subject: [Xen-devel] [PATCH v4 2/5] libxl: 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 Modify libxl_vcpu_sched_params_get/set and sched_rtds_vcpu_get/set functions to support per-VCPU extratime flag Signed-off-by: Meng Xu Reviewed-by: Dario Faggioli Acked-by: Wei Liu --- Changes from v2 1) Move extratime out of the section that is marked as depreciated in libxl_domain_sched_params. 2) Set vcpu extratime in sched_rtds_vcpu_get function function; This fix a bug in previous version when run command "xl sched-rtds -d 0 -v 1" which outputs vcpu extratime value incorrectly. Changes from v1 1) Add LIBXL_HAVE_SCHED_RTDS_VCPU_EXTRA to indicate if extratime flag is supported 2) Change flag name in domctl.h from XEN_DOMCTL_SCHED_RTDS_extratime to XEN_DOMCTL_SCHEDRT_extra Changes from RFC v1 Change work_conserving flag to extratime flag --- tools/libxl/libxl.h | 6 ++++++ tools/libxl/libxl_sched.c | 17 +++++++++++++++++ tools/libxl/libxl_types.idl | 8 ++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index f82b91e..5e9aed7 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -257,6 +257,12 @@ #define LIBXL_HAVE_SCHED_RTDS_VCPU_PARAMS 1 /* + * LIBXL_HAVE_SCHED_RTDS_VCPU_EXTRA indicates RTDS scheduler + * now supports per-vcpu extratime settings. + */ +#define LIBXL_HAVE_SCHED_RTDS_VCPU_EXTRA 1 + +/* * libxl_domain_build_info has the arm.gic_version field. */ #define LIBXL_HAVE_BUILDINFO_ARM_GIC_VERSION 1 diff --git a/tools/libxl/libxl_sched.c b/tools/libxl/libxl_sched.c index 7d144d0..512788f 100644 --- a/tools/libxl/libxl_sched.c +++ b/tools/libxl/libxl_sched.c @@ -532,6 +532,8 @@ static int sched_rtds_vcpu_get(libxl__gc *gc, uint32_t domid, for (i = 0; i < num_vcpus; i++) { scinfo->vcpus[i].period = vcpus[i].u.rtds.period; scinfo->vcpus[i].budget = vcpus[i].u.rtds.budget; + scinfo->vcpus[i].extratime = + !!(vcpus[i].u.rtds.flags & XEN_DOMCTL_SCHEDRT_extra); scinfo->vcpus[i].vcpuid = vcpus[i].vcpuid; } rc = 0; @@ -579,6 +581,8 @@ static int sched_rtds_vcpu_get_all(libxl__gc *gc, uint32_t domid, for (i = 0; i < num_vcpus; i++) { scinfo->vcpus[i].period = vcpus[i].u.rtds.period; scinfo->vcpus[i].budget = vcpus[i].u.rtds.budget; + scinfo->vcpus[i].extratime = + !!(vcpus[i].u.rtds.flags & XEN_DOMCTL_SCHEDRT_extra); scinfo->vcpus[i].vcpuid = vcpus[i].vcpuid; } rc = 0; @@ -628,6 +632,10 @@ static int sched_rtds_vcpu_set(libxl__gc *gc, uint32_t domid, vcpus[i].vcpuid = scinfo->vcpus[i].vcpuid; vcpus[i].u.rtds.period = scinfo->vcpus[i].period; vcpus[i].u.rtds.budget = scinfo->vcpus[i].budget; + if (scinfo->vcpus[i].extratime) + vcpus[i].u.rtds.flags |= XEN_DOMCTL_SCHEDRT_extra; + else + vcpus[i].u.rtds.flags &= ~XEN_DOMCTL_SCHEDRT_extra; } r = xc_sched_rtds_vcpu_set(CTX->xch, domid, @@ -676,6 +684,10 @@ static int sched_rtds_vcpu_set_all(libxl__gc *gc, uint32_t domid, vcpus[i].vcpuid = i; vcpus[i].u.rtds.period = scinfo->vcpus[0].period; vcpus[i].u.rtds.budget = scinfo->vcpus[0].budget; + if (scinfo->vcpus[0].extratime) + vcpus[i].u.rtds.flags |= XEN_DOMCTL_SCHEDRT_extra; + else + vcpus[i].u.rtds.flags &= ~XEN_DOMCTL_SCHEDRT_extra; } r = xc_sched_rtds_vcpu_set(CTX->xch, domid, @@ -726,6 +738,11 @@ static int sched_rtds_domain_set(libxl__gc *gc, uint32_t domid, sdom.period = scinfo->period; if (scinfo->budget != LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT) sdom.budget = scinfo->budget; + /* Set extratime by default */ + if (scinfo->extratime) + sdom.flags |= XEN_DOMCTL_SCHEDRT_extra; + else + sdom.flags &= ~XEN_DOMCTL_SCHEDRT_extra; if (sched_rtds_validate_params(gc, sdom.period, sdom.budget)) return ERROR_INVAL; diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 2d0bb8a..dd7d364 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -421,14 +421,14 @@ libxl_domain_sched_params = Struct("domain_sched_params",[ ("cap", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_CAP_DEFAULT'}), ("period", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT'}), ("budget", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT'}), + ("extratime", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}), - # The following three parameters ('slice', 'latency' and 'extratime') are deprecated, + # The following three parameters ('slice' and 'latency') are deprecated, # and will have no effect if used, since the SEDF scheduler has been removed. - # Note that 'period' was an SDF parameter too, but it is still effective as it is - # now used (together with 'budget') by the RTDS scheduler. + # Note that 'period' and 'extratime' was an SDF parameter too, but it is still effective + # as they are now used (together with 'budget') by the RTDS scheduler. ("slice", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT'}), ("latency", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT'}), - ("extratime", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}), ]) libxl_vnode_info = Struct("vnode_info", [