All of lore.kernel.org
 help / color / mirror / Atom feed
From: He Chen <he.chen@linux.intel.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S . Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Eric Blake <eblake@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Andrew Jones <drjones@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v7] Allow setting NUMA distance for different NUMA nodes
Date: Mon, 24 Apr 2017 16:52:48 +0800	[thread overview]
Message-ID: <20170424085248.GA16098@he> (raw)
In-Reply-To: <20170421115301.4475eff6@nial.brq.redhat.com>

On Fri, Apr 21, 2017 at 11:53:01AM +0200, Igor Mammedov wrote:
> On Fri, 21 Apr 2017 15:32:15 +0800
> He Chen <he.chen@linux.intel.com> wrote:
> 
...
> > +static void validate_numa_distance(void)
> > +{
> > +    int src, dst;
> > +    bool is_asymmetrical = false;
> > +
> > +    for (src = 0; src < nb_numa_nodes; src++) {
> > +        for (dst = 0; dst < nb_numa_nodes; dst++) {
>                 ^^^ checks inside this loop are symmetric,
>                 is there any reason it wouldn't work wit previous variant 'dst = src'?
> 
I am sorry I don't have a clear understanding about what you suggested
here. You mean we should check whether the table is symmetric in this
loop?
Regarding 'dst = src', it represents local distance, user would
omit setting it and we will fix it in complete_init_numa_distance. Did I
mistake something? Could you please explain in more detail? Thanks.
> > +            if (numa_info[src].present && numa_info[dst].present) {
> we don't support sparse nodes, so this condition is always true
> and not needed as earlier code assures that all nodes upto nb_numa_nodes
> are present, greep for "numa: Node ID missing: %d"
> so you can remove this check in this func and in complete_init_numa_distance()
> 
> > +                if (numa_info[src].distance[dst] == 0 &&
> > +                    numa_info[dst].distance[src] == 0) {
> > +                    if (src != dst) {
> > +                        error_report("The distance between node %d and %d is missing, "
> > +                                     "please provide all unique node pair distances.",
> > +                                     src, dst);
> s/all unique node .../ at least one distance value between each nodes should be provided/
> 
> or something like this
> 
> > +                        exit(EXIT_FAILURE);
> > +                    }
> > +                }
> > +
> > +                if (((numa_info[src].distance[dst] != 0) &&
> > +                    (numa_info[dst].distance[src] != 0)) &&
> > +                    (numa_info[src].distance[dst] !=
> > +                    numa_info[dst].distance[src])) {
> > +                    is_asymmetrical = true;
> > +                }
> > +            }
> > +        }
> > +    }
> > +
> > +    if (is_asymmetrical) {
> > +        for (src = 0; src < nb_numa_nodes; src++) {
> > +            for (dst = 0; dst < nb_numa_nodes; dst++) {
> > +                if (numa_info[src].present && numa_info[dst].present) {
> > +                    if ((src != dst) && (numa_info[src].distance[dst] == 0)) {
> > +                        error_report("At least one asymmetrical pair of "
> > +                                "distances is given, please provide distances "
> > +                                "for both directions of all node pairs.");
> > +                        exit(EXIT_FAILURE);
> > +                    }
> > +                }
> > +            }
> > +        }
> > +    }
> > +}
> > +
> > +static void complete_init_numa_distance(void)
> > +{
> > +    int src, dst;
> > +
> > +    /* fixup NUMA distance by symmetric policy because if it is an
> > +     * asymmtric distance table, it should be a complete table and there
> > +     * would not be any missing distance except local node, which is
> > +     * verified by validate_numa_distance above.
> > +     */
> > +    for (src = 0; src < nb_numa_nodes; src++) {
> > +        for (dst = 0; dst < nb_numa_nodes; dst++) {
> > +            if (numa_info[src].present && numa_info[dst].present) {
> > +                if (numa_info[src].distance[dst] == 0) {
> > +                    if (src == dst) {
> > +                        numa_info[src].distance[dst] = NUMA_DISTANCE_MIN;
> > +                    } else {
> > +                        numa_info[src].distance[dst] = numa_info[dst].distance[src];
> > +                    }
> > +                }
> > +            }
> > +        }
> > +    }
> > +}
...

  reply	other threads:[~2017-04-24  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21  7:32 [Qemu-devel] [PATCH v7] Allow setting NUMA distance for different NUMA nodes He Chen
2017-04-21  9:53 ` Igor Mammedov
2017-04-24  8:52   ` He Chen [this message]
2017-04-24  9:20     ` Igor Mammedov

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=20170424085248.GA16098@he \
    --to=he.chen@linux.intel.com \
    --cc=armbru@redhat.com \
    --cc=drjones@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.