From patchwork Fri Aug 12 13:11:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Davies X-Patchwork-Id: 9276955 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 CC53960752 for ; Fri, 12 Aug 2016 13:14:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDA9C289BF for ; Fri, 12 Aug 2016 13:14:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B26F6289EA; Fri, 12 Aug 2016 13:14:56 +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 2D65C289BF for ; Fri, 12 Aug 2016 13:14:55 +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 1bYCFz-0003n3-9F; Fri, 12 Aug 2016 13:12:15 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYCFx-0003mw-Vw for xen-devel@lists.xenproject.org; Fri, 12 Aug 2016 13:12:14 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id DD/DC-21406-D2BCDA75; Fri, 12 Aug 2016 13:12:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrohUlfn9Np wgxu39S2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozZ0++wFxzkq2hpUWhgnM3dxcjJISHgL3Hz 9jVGEJtNwEjixvtpLF2MHBwiAioSt/cadDFycTALzGaU2LB2IwtIjbBAgMShhovMIDaLgKrE9 0Vr2EBsXgEviZOzN7NCzJSTOHlsMpgtJKAu0fBoEhNEjaDEyZlPwOYwC0hIHHzxghminlvi9u mpzBMYeWYhKZuFpGwBI9MqRvXi1KKy1CJdQ72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3 k/NxNjMAAYQCCHYw7nzsdYpTkYFIS5XU/vDZciC8pP6UyI7E4I76oNCe1+BCjBgeHwOa1qy8w SrHk5eelKknwWp4CqhMsSk1PrUjLzAGGMEypBAePkggvA0iat7ggMbc4Mx0idYpRl2PLghtrm YTAZkiJ8344CVQkAFKUUZoHNwIWT5cYZaWEeRmBDhTiKUgtys0sQZV/xSjOwagkzMsJsoonM6 8EbtMroCOYgI44YbYG5IiSRISUVAPjlKNXW49N2aha+KznwyEB8aiXT24s2vhVs0si1ey2olX u3+ln/n3If7h1i9Q6+wKPNMN8bQf1wLR51zmePql8vUbRY/Yrm9MX2QT0npo/PRSll1x7lItT mN1y2Q0NhfhI1t/5XdJlD1Vu8+fKvF1v7xPrJrzKI8Tyq7m9sG1TgpcN43GDUiElluKMREMt5 qLiRADgks7/ogIAAA== X-Env-Sender: prvs=025df0a46=Jonathan.Davies@citrix.com X-Msg-Ref: server-13.tower-21.messagelabs.com!1471007531!28333758!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 62913 invoked from network); 12 Aug 2016 13:12:12 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-13.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 12 Aug 2016 13:12:12 -0000 X-IronPort-AV: E=Sophos;i="5.28,510,1464652800"; d="scan'208";a="371966447" From: Jonathan Davies To: Date: Fri, 12 Aug 2016 14:11:53 +0100 Message-ID: <1471007513-18155-1-git-send-email-jonathan.davies@citrix.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-DLP: MIA2 Cc: Juergen Gross , Jonathan Davies , Ian Jackson , Wei Liu Subject: [Xen-devel] [PATCH] xl cpupool-numa-split: don't try to bring any dom0 vCPUs online 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Since commit a9dd01431a799b6743193a75f4f1ce2fdfdb7296, main_cpupoolnumasplit wants to ensure that dom0 doesn't have more online vCPUs than the number of pCPUs in a NUMA node. However, if dom0 already has fewer online vCPUs than the number of pCPUs in a NUMA node, this will cause some to be made online. Furthermore, if dom0's maximum number of vCPUs is less than the number of pCPUs, this will result in an error like the following: libxl: error: libxl.c:5564:libxl_set_vcpuonline: Requested 24 VCPUs, however maxcpus is 12!: Function not implemented error on removing vcpus for Domain-0 Instead, make main_cpupoolnumasplit only reduce the number of vCPUs dom0 has online, and don't try to add any more. This incurs an extra call to libxl_domain_info to find out the current number of dom0 vCPUs. Conveniently, there is already an initialised libxl_dominfo that we can use. Signed-off-by: Jonathan Davies --- tools/libxl/xl_cmdimpl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 7f961e3..d5df20d 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -8614,12 +8614,19 @@ int main_cpupoolnumasplit(int argc, char **argv) goto out; } + if (libxl_domain_info(ctx, &info, 0)) { + fprintf(stderr, "error on getting info for Domain-0\n"); + goto out; + } + n = 0; for (c = 0; c < n_cpus; c++) { if (topology[c].node == node) { topology[c].node = LIBXL_CPUTOPOLOGY_INVALID_ENTRY; - libxl_bitmap_set(&cpumap, n); - n++; + if (n < info.vcpu_online) { + libxl_bitmap_set(&cpumap, n); + n++; + } } } if (libxl_domain_info(ctx, &info, 0)) {