From patchwork Thu Feb 21 19:46:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 222409 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B70E42C02A4 for ; Fri, 22 Feb 2013 06:45:07 +1100 (EST) Received: from localhost ([::1]:59583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8c4j-0003le-Hi for incoming@patchwork.ozlabs.org; Thu, 21 Feb 2013 14:45:01 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8c4c-0003lP-Iy for qemu-devel@nongnu.org; Thu, 21 Feb 2013 14:44:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8c4a-0006W8-5g for qemu-devel@nongnu.org; Thu, 21 Feb 2013 14:44:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8c4Z-0006VT-UZ for qemu-devel@nongnu.org; Thu, 21 Feb 2013 14:44:52 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1LJinld023457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 21 Feb 2013 14:44:49 -0500 Received: from blackpad.lan.raisama.net (vpn1-4-196.gru2.redhat.com [10.97.4.196]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r1LJimj1027113; Thu, 21 Feb 2013 14:44:48 -0500 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 001F9204B7D; Thu, 21 Feb 2013 16:46:23 -0300 (BRT) From: Eduardo Habkost To: qemu-devel@nongnu.org, Anthony Liguori Date: Thu, 21 Feb 2013 16:46:19 -0300 Message-Id: <1361475979-26684-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: libvir-list@redhat.com, Chegu Vinod Subject: [Qemu-devel] [PATCH] vl.c: Support multiple CPU ranges on -numa option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This allows "," to be used a separator between each CPU range. Note that commas inside key=value command-line options have to be escaped using ",,", so the command-line will look like: -numa node,cpus=A,,B,,C,,D Note that the following format, currently used by libvirt: -numa nodes,cpus=A,B,C,D will _not_ work yet, as "," is the option separator for the command-line option parser, and it will require changing the -numa option parsing code to handle "cpus" as a special case. Signed-off-by: Eduardo Habkost --- vl.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 955d2ff..cd247be 100644 --- a/vl.c +++ b/vl.c @@ -1244,7 +1244,7 @@ char *get_boot_devices_list(size_t *size) return list; } -static void numa_node_parse_cpus(int nodenr, const char *cpus) +static void numa_node_parse_cpu_range(int nodenr, const char *cpus) { char *endptr; unsigned long long value, endvalue; @@ -1288,6 +1288,18 @@ error: exit(1); } +static void numa_node_parse_cpus(int nodenr, const char *option) +{ + char **parts; + int i; + + parts = g_strsplit(option, ",", 0); + for (i = 0; parts[i]; i++) { + numa_node_parse_cpu_range(nodenr, parts[i]); + } + g_strfreev(parts); +} + static void numa_add(const char *optarg) { char option[128];