From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [PATCH] xl cpupool-numa-split: reduce number of Dom0 vcpus Date: Tue, 15 Feb 2011 07:02:11 +0100 Message-ID: <4D5A16E3.70000@ts.fujitsu.com> References: <4D592A6F.9040700@ts.fujitsu.com> <19801.19977.577959.1306@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040600060903020105010606" Return-path: In-Reply-To: <19801.19977.577959.1306@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: George Dunlap , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------040600060903020105010606 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 02/14/11 16:45, Ian Jackson wrote: > Juergen Gross writes ("Re: [Xen-devel] [PATCH] xl cpupool-numa-split: reduce number of Dom0 vcpus"): >> On 02/14/11 13:36, George Dunlap wrote: >>> Is looping 10 times really the best option? >> >> Oops! Forgot the sleep(1) :-( >> What about this one? > > Um, are you sure ? It still doesn't seem to have a sleep and you > haven't answered George's question ... Sigh. Modifying the patch isn't enough, have to send the modified version... Regarding the question: libxl_set_vcpuonline() is asynchronous. It will trigger the offlining (or onlining) of vcpus, but the result is not checked and will happen sometimes in the future, if ever. So some kind of timeout seems to be a good idea. 10 seconds should be enough to do the work. I added a failure exit if not all required vcpus are offlined. Juergen -- Juergen Gross Principal Developer Operating Systems TSP ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967 Fujitsu Technology Solutions e-mail: juergen.gross@ts.fujitsu.com Domagkstr. 28 Internet: ts.fujitsu.com D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html --------------040600060903020105010606 Content-Type: text/x-patch; name="xen-work.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-work.patch" # HG changeset patch # User Juergen Gross # Date 1297680409 -3600 # Node ID fdcb4e8eb4bb02f2c14b5333b9839dbd7b8786df # Parent f3579aa973c24a4ecee809a184b08c1855cd07ba xl cpupool-numa-split: reduce number of Dom0 vcpus When reducing the number of physical cpus available for Domain-0 by xl cpupool-numa-split, reduce the number of vcpus accordingly. Signed-off-by: juergen.gross@ts.fujitsu.com diff -r f3579aa973c2 -r fdcb4e8eb4bb tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Mon Feb 14 11:02:50 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Mon Feb 14 11:46:49 2011 +0100 @@ -5762,6 +5762,7 @@ int main_cpupoolnumasplit(int argc, char libxl_cpumap cpumap; libxl_cpupoolinfo *poolinfo; libxl_topologyinfo topology; + libxl_dominfo info; while ((opt = getopt(argc, argv, "h")) != -1) { switch (opt) { @@ -5817,11 +5818,33 @@ int main_cpupoolnumasplit(int argc, char goto out; } + n = 0; for (c = 0; c < topology.nodemap.entries; c++) { if (topology.nodemap.array[c] == node) { topology.nodemap.array[c] = LIBXL_CPUARRAY_INVALID_ENTRY; - } - } + libxl_cpumap_set(&cpumap, n); + n++; + } + } + if (libxl_set_vcpuonline(&ctx, 0, &cpumap)) { + fprintf(stderr, "error on removing vcpus for Domain-0\n"); + goto out; + } + for (c = 0; c < 10; c++) { + if (libxl_domain_info(&ctx, &info, 0)) { + fprintf(stderr, "error on getting info for Domain-0\n"); + goto out; + } + if (info.vcpu_online == n) { + break; + } + sleep(1); + } + if (info.vcpu_online > n) { + fprintf(stderr, "failed to offline vcpus\n"); + goto out; + } + memset(cpumap.map, 0, cpumap.size); for (c = 0; c < topology.nodemap.entries; c++) { if (topology.nodemap.array[c] == LIBXL_CPUARRAY_INVALID_ENTRY) { --------------040600060903020105010606 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------040600060903020105010606--