qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Hu Tao <hutao@cn.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/3] numa: Reject configuration if CPU appears on multiple nodes
Date: Thu, 12 Feb 2015 16:01:49 +0100	[thread overview]
Message-ID: <20150212160149.3adcf821@nial.brq.redhat.com> (raw)
In-Reply-To: <1423511596-2584-3-git-send-email-ehabkost@redhat.com>

On Mon,  9 Feb 2015 17:53:15 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Each CPU can appear in only one NUMA node on the NUMA config. Reject
> configuration if a CPU appears in multiple nodes.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  numa.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/numa.c b/numa.c
> index f768434..f004a74 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -167,6 +167,31 @@ error:
>      return -1;
>  }
>  
> +static void validate_numa_cpus(void)
> +{
> +    int i, cpu;
> +    DECLARE_BITMAP(present_cpus, MAX_CPUMASK_BITS);
naming is a bit confusing, it's not really present CPUs but
more like possible_cpus

> +
> +    bitmap_zero(present_cpus, MAX_CPUMASK_BITS);
> +    for (i = 0; i < nb_numa_nodes; i++) {
> +        if (bitmap_intersects(present_cpus, numa_info[i].node_cpu,
> +                              MAX_CPUMASK_BITS)) {
> +            bitmap_and(present_cpus, present_cpus,
> +                       numa_info[i].node_cpu, MAX_CPUMASK_BITS);
> +            fprintf(stderr, "CPU(s) present in multiple NUMA nodes:");
> +            for (cpu = find_first_bit(present_cpus, MAX_CPUMASK_BITS);
> +                cpu < MAX_CPUMASK_BITS;
> +                cpu = find_next_bit(present_cpus, MAX_CPUMASK_BITS, cpu + 1)) {
> +                fprintf(stderr, " %d", cpu);
> +            }
> +            fprintf(stderr, "\n");
> +            exit(1);
> +        }
> +        bitmap_or(present_cpus, present_cpus,
> +                  numa_info[i].node_cpu, MAX_CPUMASK_BITS);
> +    }
> +}
> +
>  void parse_numa_opts(void)
>  {
>      int i;
> @@ -244,6 +269,8 @@ void parse_numa_opts(void)
>                  set_bit(i, numa_info[i % nb_numa_nodes].node_cpu);
>              }
>          }
> +
> +        validate_numa_cpus();
>      }
>  }
>  

  parent reply	other threads:[~2015-02-12 15:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 19:53 [Qemu-devel] [PATCH v2 0/3] NUMA: Validate CPU configuration Eduardo Habkost
2015-02-09 19:53 ` [Qemu-devel] [PATCH v2 1/3] numa: Reject CPU indexes > max_cpus Eduardo Habkost
2015-02-12 13:42   ` Igor Mammedov
2015-02-09 19:53 ` [Qemu-devel] [PATCH v2 2/3] numa: Reject configuration if CPU appears on multiple nodes Eduardo Habkost
2015-02-12 14:22   ` Igor Mammedov
2015-02-12 15:18     ` Paolo Bonzini
2015-02-12 15:26       ` Eduardo Habkost
2015-02-12 16:04       ` Igor Mammedov
2015-02-12 15:01   ` Igor Mammedov [this message]
2015-02-12 15:24     ` Eduardo Habkost
2015-02-12 16:01       ` Igor Mammedov
2015-02-12 17:54         ` Eduardo Habkost
2015-02-09 19:53 ` [Qemu-devel] [PATCH v2 3/3] numa: Print warning if no node is assigned to a CPU Eduardo Habkost

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=20150212160149.3adcf821@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).