From: Paolo Bonzini <pbonzini@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, Borislav Petkov <bp@suse.de>,
"H. Peter Anvin" <hpa@zytor.com>, Gleb Natapov <gleb@redhat.com>,
Andre Przywara <andre@andrep.de>, Joerg Roedel <joro@8bytes.org>,
X86 ML <x86@kernel.org>, KVM <kvm@vger.kernel.org>,
qemu-devel@nongnu.org, libvir-list@redhat.com,
Jiri Denemark <jdenemar@redhat.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: qemu, numa: non-contiguous cpusets
Date: Mon, 30 Sep 2013 11:05:10 +0200 [thread overview]
Message-ID: <52493EC6.4020403@redhat.com> (raw)
In-Reply-To: <20130929151044.GB5426@pd.tnic>
Il 29/09/2013 17:10, Borislav Petkov ha scritto:
> Btw,
>
> while I got your attention, on a not-really related topic: how do we
> feel about adding support for specifying a non-contiguous set of cpus
> for a numa node in qemu with the -numa option? I.e., like this, for
> example:
>
> x86_64-softmmu/qemu-system-x86_64 -smp 8 -numa node,nodeid=0,cpus=0\;2\;4-5 -numa node,nodeid=1,cpus=1\;3\;6-7
I think there are already patches on the list to do that, as part of the
NUMA memory binding series from Wanlong Gao.
Paolo
> The ';' needs to be escaped from the shell but I'm open for better
> suggestions.
>
> Here's a diff:
>
> ---
> diff --git a/vl.c b/vl.c
> index 4e709d5c1c20..82a6c8451fb0 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1261,9 +1261,27 @@ char *get_boot_devices_list(size_t *size)
> return list;
> }
>
> +static int __numa_set_cpus(unsigned long *map, int start, int end)
> +{
> + if (end >= MAX_CPUMASK_BITS) {
> + end = MAX_CPUMASK_BITS - 1;
> + fprintf(stderr,
> + "qemu: NUMA: A max of %d VCPUs are supported\n",
> + MAX_CPUMASK_BITS);
> + return -EINVAL;
> + }
> +
> + if (end < start) {
> + return -EINVAL;
> + }
> +
> + bitmap_set(map, start, end-start+1);
> + return 0;
> +}
> +
> static void numa_node_parse_cpus(int nodenr, const char *cpus)
> {
> - char *endptr;
> + char *endptr, *ptr = (char *)cpus;
> unsigned long long value, endvalue;
>
> /* Empty CPU range strings will be considered valid, they will simply
> @@ -1273,7 +1291,8 @@ static void numa_node_parse_cpus(int nodenr, const char *cpus)
> return;
> }
>
> - if (parse_uint(cpus, &value, &endptr, 10) < 0) {
> +fromthetop:
> + if (parse_uint(ptr, &value, &endptr, 10) < 0) {
> goto error;
> }
> if (*endptr == '-') {
> @@ -1282,22 +1301,22 @@ static void numa_node_parse_cpus(int nodenr, const char *cpus)
> }
> } else if (*endptr == '\0') {
> endvalue = value;
> - } else {
> - goto error;
> - }
> + } else if (*endptr == ';') {
> + if (__numa_set_cpus(node_cpumask[nodenr], value, value) < 0) {
> + goto error;
> + }
> + endptr++;
> + if (*endptr == '\0')
> + return;
>
> - if (endvalue >= MAX_CPUMASK_BITS) {
> - endvalue = MAX_CPUMASK_BITS - 1;
> - fprintf(stderr,
> - "qemu: NUMA: A max of %d VCPUs are supported\n",
> - MAX_CPUMASK_BITS);
> - }
> + ptr = endptr;
>
> - if (endvalue < value) {
> + goto fromthetop;
> + } else {
> goto error;
> }
>
> - bitmap_set(node_cpumask[nodenr], value, endvalue-value+1);
> + __numa_set_cpus(node_cpumask[nodenr], value, endvalue);
> return;
>
> error:
> --
>
> Thanks.
>
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Gleb Natapov <gleb@redhat.com>,
libvir-list@redhat.com, Joerg Roedel <joro@8bytes.org>,
X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
qemu-devel@nongnu.org, Andre Przywara <andre@andrep.de>,
KVM <kvm@vger.kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
Igor Mammedov <imammedo@redhat.com>,
Jiri Denemark <jdenemar@redhat.com>, Borislav Petkov <bp@suse.de>
Subject: Re: [Qemu-devel] qemu, numa: non-contiguous cpusets
Date: Mon, 30 Sep 2013 11:05:10 +0200 [thread overview]
Message-ID: <52493EC6.4020403@redhat.com> (raw)
In-Reply-To: <20130929151044.GB5426@pd.tnic>
Il 29/09/2013 17:10, Borislav Petkov ha scritto:
> Btw,
>
> while I got your attention, on a not-really related topic: how do we
> feel about adding support for specifying a non-contiguous set of cpus
> for a numa node in qemu with the -numa option? I.e., like this, for
> example:
>
> x86_64-softmmu/qemu-system-x86_64 -smp 8 -numa node,nodeid=0,cpus=0\;2\;4-5 -numa node,nodeid=1,cpus=1\;3\;6-7
I think there are already patches on the list to do that, as part of the
NUMA memory binding series from Wanlong Gao.
Paolo
> The ';' needs to be escaped from the shell but I'm open for better
> suggestions.
>
> Here's a diff:
>
> ---
> diff --git a/vl.c b/vl.c
> index 4e709d5c1c20..82a6c8451fb0 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1261,9 +1261,27 @@ char *get_boot_devices_list(size_t *size)
> return list;
> }
>
> +static int __numa_set_cpus(unsigned long *map, int start, int end)
> +{
> + if (end >= MAX_CPUMASK_BITS) {
> + end = MAX_CPUMASK_BITS - 1;
> + fprintf(stderr,
> + "qemu: NUMA: A max of %d VCPUs are supported\n",
> + MAX_CPUMASK_BITS);
> + return -EINVAL;
> + }
> +
> + if (end < start) {
> + return -EINVAL;
> + }
> +
> + bitmap_set(map, start, end-start+1);
> + return 0;
> +}
> +
> static void numa_node_parse_cpus(int nodenr, const char *cpus)
> {
> - char *endptr;
> + char *endptr, *ptr = (char *)cpus;
> unsigned long long value, endvalue;
>
> /* Empty CPU range strings will be considered valid, they will simply
> @@ -1273,7 +1291,8 @@ static void numa_node_parse_cpus(int nodenr, const char *cpus)
> return;
> }
>
> - if (parse_uint(cpus, &value, &endptr, 10) < 0) {
> +fromthetop:
> + if (parse_uint(ptr, &value, &endptr, 10) < 0) {
> goto error;
> }
> if (*endptr == '-') {
> @@ -1282,22 +1301,22 @@ static void numa_node_parse_cpus(int nodenr, const char *cpus)
> }
> } else if (*endptr == '\0') {
> endvalue = value;
> - } else {
> - goto error;
> - }
> + } else if (*endptr == ';') {
> + if (__numa_set_cpus(node_cpumask[nodenr], value, value) < 0) {
> + goto error;
> + }
> + endptr++;
> + if (*endptr == '\0')
> + return;
>
> - if (endvalue >= MAX_CPUMASK_BITS) {
> - endvalue = MAX_CPUMASK_BITS - 1;
> - fprintf(stderr,
> - "qemu: NUMA: A max of %d VCPUs are supported\n",
> - MAX_CPUMASK_BITS);
> - }
> + ptr = endptr;
>
> - if (endvalue < value) {
> + goto fromthetop;
> + } else {
> goto error;
> }
>
> - bitmap_set(node_cpumask[nodenr], value, endvalue-value+1);
> + __numa_set_cpus(node_cpumask[nodenr], value, endvalue);
> return;
>
> error:
> --
>
> Thanks.
>
next prev parent reply other threads:[~2013-09-30 9:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-29 15:10 qemu, numa: non-contiguous cpusets Borislav Petkov
2013-09-29 15:10 ` [Qemu-devel] " Borislav Petkov
2013-09-30 8:15 ` Daniel P. Berrange
2013-09-30 8:15 ` [Qemu-devel] " Daniel P. Berrange
2013-09-30 9:05 ` Paolo Bonzini [this message]
2013-09-30 9:05 ` Paolo Bonzini
2013-09-30 9:49 ` Borislav Petkov
2013-09-30 9:49 ` [Qemu-devel] " Borislav Petkov
2013-09-30 12:18 ` Paolo Bonzini
2013-09-30 12:18 ` [Qemu-devel] " Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52493EC6.4020403@redhat.com \
--to=pbonzini@redhat.com \
--cc=andre@andrep.de \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=ehabkost@redhat.com \
--cc=gleb@redhat.com \
--cc=hpa@zytor.com \
--cc=imammedo@redhat.com \
--cc=jdenemar@redhat.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=libvir-list@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.