From patchwork Fri Jun 3 16:35:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9153653 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 F2F7B6074E for ; Fri, 3 Jun 2016 16:39:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1AC026C9B for ; Fri, 3 Jun 2016 16:39:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D639528309; Fri, 3 Jun 2016 16:39:48 +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 5FC7D27BFA for ; Fri, 3 Jun 2016 16:39:47 +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 1b8s60-0008Ti-79; Fri, 03 Jun 2016 16:37:16 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8s5z-0008Tc-7O for xen-devel@lists.xenproject.org; Fri, 03 Jun 2016 16:37:15 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id CD/8D-06230-A32B1575; Fri, 03 Jun 2016 16:37:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRWlGSWpSXmKPExsXitHRDpK7VpsB wgx//mCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozTNzQL/opW/Og4yNrA2CDYxcjJISHgL/Hj 6j92EJtFQEXiye+NTCA2m4CyxM/OXjYQWwTI7v31mwXEZhYolziw4w+YLSzgIrGoczlQLwcHr 4C+xIunYOVCAtMZJc4vDwWxeQUEJU7OfALVqiOxYPcnNpByZgFpieX/OEDCnAL2Ekc3NLCC2K JAF1yZ8JYdYoyCRMf0Y0wQV3JL3D49lXkCI/8sJFNnIZk6C2HqAkbmVYzqxalFZalFusZ6SUW Z6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBoccABDsYO/45HWKU5GBSEuU9fzYgXIgv KT+lMiOxOCO+qDQntfgQowwHh5IEr9jGwHAhwaLU9NSKtMwcYBTApCU4eJREeO9sAErzFhck5 hZnpkOkTjEqSonzPgdJCIAkMkrz4NpgkXeJUVZKmJcR6BAhnoLUotzMElT5V4ziHIxKwrwaIN t5MvNK4Ka/AlrMBLS44JE/yOKSRISUVAOjfT6r1b/IrLNqfvxLFJQun2Cexv1d286s/kz0xzV ZWn1Rlat2/c3yWHUnW9JyZfQtSdsrsz82OdTrdHHvf1E+ffUhv4OS/OFuGS+ddq4XtLC93uX0 kd2bU2znPKst3erC2om/160o2PKq4u2rtuSDdiYx755s2efQnu28IMWa78Fmn9cu0TZKLMUZi YZazEXFiQAkM3YrtwIAAA== X-Env-Sender: prvs=955226cfb=wei.liu2@citrix.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1464971832!12878460!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.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55104 invoked from network); 3 Jun 2016 16:37:13 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 3 Jun 2016 16:37:13 -0000 X-IronPort-AV: E=Sophos;i="5.26,413,1459814400"; d="scan'208";a="358335599" Date: Fri, 3 Jun 2016 17:35:20 +0100 From: Wei Liu To: Jan Beulich Message-ID: <20160603163519.GO14588@citrix.com> References: <57515BF802000078000F172B@prv-mh.provo.novell.com> <20160603134106.GJ14588@citrix.com> <5751B36302000078000F1A67@prv-mh.provo.novell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5751B36302000078000F1A67@prv-mh.provo.novell.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-DLP: MIA2 Cc: xen-devel , Wei Liu , Ian Jackson Subject: Re: [Xen-devel] "xl vcpu-set" not persistent across reboot? 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 On Fri, Jun 03, 2016 at 08:42:11AM -0600, Jan Beulich wrote: > >>> On 03.06.16 at 15:41, wrote: > > On Fri, Jun 03, 2016 at 02:29:12AM -0600, Jan Beulich wrote: > >> Ian, Wei, > >> > >> is it intentional that rebooting a (HVM) guest after having altered its > >> vCPU count will reset it back to the vCPU count it was originally > >> started with? That doesn't seem very natural - if one hotplugs a CPU > >> into a physical system and then reboots, that CPU will remain there. > >> > > > > This is probably an oversight. > > > > I've added this to my list of things to look at after the release. > > Thanks! > I got a patch ready. But QEMU upstream refuses to start on the receiving end with following error message: qemu-system-i386: Unknown savevm section or instance 'cpu_common' 1 qemu-system-i386: load of migration failed: Invalid argument With QEMU traditional HVM guest and PV guest, the guest works fine -- up and running with all hot plugged cpus available. So I think the relevant libxl information is transmitted but we also need to fix QEMU upstream. But that's a separate issue. Wei. ---8<--- From 790ff77c6307b341dec0b4cc5e2d394e42f82e7c Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Fri, 3 Jun 2016 16:38:32 +0100 Subject: [PATCH] libxl: update vcpus bitmap in retrieved geust config ... because the available vcpu bitmap can change during domain life time due to cpu hotplug and unplug. Reported-by: Jan Beulich Signed-off-by: Wei Liu --- tools/libxl/libxl.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 006b83f..99617f3 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -7270,6 +7270,37 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, libxl_dominfo_dispose(&info); } + /* VCPUs */ + { + libxl_vcpuinfo *vcpus; + libxl_bitmap *map; + int nr_vcpus, nr_cpus; + unsigned int i; + + vcpus = libxl_list_vcpu(ctx, domid, &nr_vcpus, &nr_cpus); + if (!vcpus) { + LOG(ERROR, "fail to get vcpu list for domain %d", domid); + rc = ERROR_FAIL; + goto out; + } + + /* Update the avail_vcpus bitmap accordingly */ + map = &d_config->b_info.avail_vcpus; + + libxl_bitmap_dispose(map); + + libxl_bitmap_alloc(ctx, map, nr_vcpus); + + libxl_bitmap_init(map); + + for (i = 0; i < nr_vcpus; i++) { + if (vcpus[i].online) + libxl_bitmap_set(map, i); + } + + libxl_vcpuinfo_list_free(vcpus, nr_vcpus); + } + /* Memory limits: * * Currently there are three memory limits: