From patchwork Thu Feb 4 22:50:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chong Li X-Patchwork-Id: 8228831 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5F32B9F3CD for ; Thu, 4 Feb 2016 22:53:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64CB42039E for ; Thu, 4 Feb 2016 22:53:54 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60EA720390 for ; Thu, 4 Feb 2016 22:53:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aRSjs-0000JM-K3; Thu, 04 Feb 2016 22:51:00 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aRSjr-0000Im-4X for xen-devel@lists.xen.org; Thu, 04 Feb 2016 22:50:59 +0000 Received: from [85.158.139.211] by server-14.bemta-5.messagelabs.com id 31/50-18633-2D5D3B65; Thu, 04 Feb 2016 22:50:58 +0000 X-Env-Sender: lichong659@gmail.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1454626256!20377395!1 X-Originating-IP: [209.85.213.193] X-SpamReason: No, hits=0.3 required=7.0 tests=MAILTO_TO_SPAM_ADDR X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 39639 invoked from network); 4 Feb 2016 22:50:57 -0000 Received: from mail-ig0-f193.google.com (HELO mail-ig0-f193.google.com) (209.85.213.193) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Feb 2016 22:50:57 -0000 Received: by mail-ig0-f193.google.com with SMTP id mw1so141001igb.2 for ; Thu, 04 Feb 2016 14:50:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5rZOjiznQqm0tMva/doJ7H6Pg8/2S5L6YkmbDBIlYHg=; b=tfeMdUXUKA3CIjrbc3Ij4tjbCxWib5B+QPOF8kCUbr1J2QZVoM+8ME4akQrdmiqEb2 xIha2MBNkh8pdFaKL0L9zKNHEIdEtXhhn5EWW87po9nLT5A8SDzHLaFjP1mwg2nbzAR2 XyDXJhH1dUk4EYzKNygJVkxIGfJGqBR3BcFYvJ9sWjAeiWQYbC+wrS38Dypd5RzUkluM ITCeU4h1Yt+imajvteODQtdGfOU5suYCb3FvN84ivPxFCyzSJ74wsf9NaaI5+ecRSXtk K1rlWe67fitt+Xshuxeti3kaGVbFu2Zyyy5tgHGW1fjDM5mcpOeT5sFU3lzS5ZojugpZ smZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5rZOjiznQqm0tMva/doJ7H6Pg8/2S5L6YkmbDBIlYHg=; b=WKq6olPZRlvTjp3jD9yzDS1d16yUZv3adl4EMK2Y/XxA57pWX2/Ol8qen/cCgvhjBA QH48qYDslQiqqCE6xNf9zq69aFp2y1TJwWys97+L43JPlOkQhgOJddtPJ3QU9BBmxdEr INMKo2D5okDgXkZl+ltmVDXowfusLqNAurL6s1dgSdPumjAa/MR0IUlRXzNfmpuyr0qD 05GHGZF45Njv3ac/vwRrrNmIv6IY/DIfRiR9/PDZaNvtSHcLM/xR+kuFac4cd6raOCnh SP67etAxiKtluAAytYxQjVaOvhsMjo2YVZYm+IZLp8ZyZKO3U3yCl0CgA6M3OhkDurwA hbvw== X-Gm-Message-State: AG10YORzEsSucPC6bBsHbQqx/++kACflW9L65ayDx5A5Ir3C7iKzllJCfDgCZQOWoTiMVA== X-Received: by 10.50.110.5 with SMTP id hw5mr6933412igb.65.1454626256257; Thu, 04 Feb 2016 14:50:56 -0800 (PST) Received: from chong-OptiPlex-960.seas.wustl.edu (admin998.cec.wustl.edu. [128.252.20.193]) by smtp.googlemail.com with ESMTPSA id fk5sm5605439igb.6.2016.02.04.14.50.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 14:50:55 -0800 (PST) From: Chong Li To: xen-devel@lists.xen.org Date: Thu, 4 Feb 2016 16:50:42 -0600 Message-Id: <1454626244-5511-3-git-send-email-lichong659@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454626244-5511-1-git-send-email-lichong659@gmail.com> References: <1454626244-5511-1-git-send-email-lichong659@gmail.com> Cc: Chong Li , wei.liu2@citrix.com, Sisu Xi , george.dunlap@eu.citrix.com, dario.faggioli@citrix.com, Meng Xu , lichong659@gmail.com, dgolomb@seas.upenn.edu Subject: [Xen-devel] [PATCH v5 for Xen 4.7 2/4] libxc: enable per-VCPU parameter settings for RTDS scheduler X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add xc_sched_rtds_vcpu_get/set functions to interact with Xen to get/set a domain's per-VCPU parameters. Signed-off-by: Chong Li Signed-off-by: Meng Xu Signed-off-by: Sisu Xi --- Changes on PATCH v4: 1) Minor modifications on the function parameters. Changes on PATCH v2: 1) Minor modifications due to the change of struct xen_domctl_scheduler_op. CC: CC: CC: CC: CC: CC: --- tools/libxc/include/xenctrl.h | 8 +++++++ tools/libxc/xc_rt.c | 56 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 01a6dda..db13434 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -893,6 +893,14 @@ int xc_sched_rtds_domain_set(xc_interface *xch, int xc_sched_rtds_domain_get(xc_interface *xch, uint32_t domid, struct xen_domctl_sched_rtds *sdom); +int xc_sched_rtds_vcpu_set(xc_interface *xch, + uint32_t domid, + struct xen_domctl_schedparam_vcpu *vcpus, + uint32_t num_vcpus); +int xc_sched_rtds_vcpu_get(xc_interface *xch, + uint32_t domid, + struct xen_domctl_schedparam_vcpu *vcpus, + uint32_t num_vcpus); int xc_sched_arinc653_schedule_set( diff --git a/tools/libxc/xc_rt.c b/tools/libxc/xc_rt.c index d59e5ce..cb7bc1a 100644 --- a/tools/libxc/xc_rt.c +++ b/tools/libxc/xc_rt.c @@ -62,3 +62,59 @@ int xc_sched_rtds_domain_get(xc_interface *xch, return rc; } + +int xc_sched_rtds_vcpu_set(xc_interface *xch, + uint32_t domid, + struct xen_domctl_schedparam_vcpu *vcpus, + uint32_t num_vcpus) +{ + int rc; + DECLARE_DOMCTL; + DECLARE_HYPERCALL_BOUNCE(vcpus, sizeof(*vcpus) * num_vcpus, + XC_HYPERCALL_BUFFER_BOUNCE_IN); + + if ( xc_hypercall_bounce_pre(xch, vcpus) ) + return -1; + + domctl.cmd = XEN_DOMCTL_scheduler_op; + domctl.domain = (domid_t) domid; + domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS; + domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putvcpuinfo; + domctl.u.scheduler_op.u.v.nr_vcpus = num_vcpus; + set_xen_guest_handle(domctl.u.scheduler_op.u.v.vcpus, vcpus); + domctl.u.scheduler_op.u.v.vcpu_index = 0; + + rc = do_domctl(xch, &domctl); + + xc_hypercall_bounce_post(xch, vcpus); + + return rc; +} + +int xc_sched_rtds_vcpu_get(xc_interface *xch, + uint32_t domid, + struct xen_domctl_schedparam_vcpu *vcpus, + uint32_t num_vcpus) +{ + int rc; + DECLARE_DOMCTL; + DECLARE_HYPERCALL_BOUNCE(vcpus, sizeof(*vcpus) * num_vcpus, + XC_HYPERCALL_BUFFER_BOUNCE_BOTH); + + if ( xc_hypercall_bounce_pre(xch, vcpus) ) + return -1; + + domctl.cmd = XEN_DOMCTL_scheduler_op; + domctl.domain = (domid_t) domid; + domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS; + domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getvcpuinfo; + domctl.u.scheduler_op.u.v.nr_vcpus = num_vcpus; + set_xen_guest_handle(domctl.u.scheduler_op.u.v.vcpus, vcpus); + domctl.u.scheduler_op.u.v.vcpu_index = 0; + + rc = do_domctl(xch, &domctl); + + xc_hypercall_bounce_post(xch, vcpus); + + return rc; +}