qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Dou Liyang <douly.fnst@cn.fujitsu.com>,
	fanc.fnst@cn.fujitsu.com, caoj.fnst@cn.fujitsu.com,
	stefanha@redhat.com, izumi.taku@jp.fujitsu.com,
	vilanova@ac.upc.edu, peter.maydell@linaro.org,
	Andrew Jones <drjones@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Thomas Huth <thuth@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] numa: access CPU's node id via property in hmp_info_numa()
Date: Wed, 18 Jan 2017 18:08:24 +0100	[thread overview]
Message-ID: <20170118180824.52d84031@nial.brq.redhat.com> (raw)
In-Reply-To: <20170118151945.GY3491@thinpad.lan.raisama.net>

On Wed, 18 Jan 2017 13:19:45 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> On Wed, Jan 18, 2017 at 03:48:45PM +0100, Igor Mammedov wrote:
> > Move vcpu's assocciated numa_node field out of generic CPUState
> > into inherited classes that actually care about cpu<->numa mapping
> > and make monitor 'info numa' get vcpu's assocciated node id via
> > node-id property.
> > It allows to drop implicit node id intialization in
> > numa_post_machine_init() and would allow switching to mapping
> > defined by target's CpuInstanceProperties instead of global
> > numa_info[i].node_cpu bitmaps.  
> 
> I agree to allow the node-id assignment logic to be defined by
> arch-specific code, but:
> 
> Considering that we still have the generic CPU<->node mapping in
> numa_info[].node_cpu, I don't see the benefit of moving the
> numa_info[].node_cpu => node-id translation from common generic
> code to duplicated arch-specific code.
it's duplicated for a time being until all targets that use
node_cpu are internally converted to socket/core/thread-id interface.
This patch is a part if re-factoring RFC which I'm about to post.


> What about adding this to cpu_generic_realize():
> 
>   node = (numa_get_node_for_cpu(cpu)
>   if (node >= 0) {
>      int cur_node = object_property_find(cpu, "node-id") ?
>                     object_property_get_int(cpu, "node-id") : -1;
>      if (cur_node >= 0 && cur_node != node) {
>          error_setg(&err, "Conflict between -numa option and CPU node-id");
>          goto out;
>      }
>      object_property_set_int(cpu, "node-id", node, &err);
>   }
What I don't like here is that putting above snippet into
cpu_generic_realize() is just doing the same implicit init
that numa_post_machine_init() has been doing before just
a bit later. It looks like a quick fix for 'info numa' issues.

However it would add stumble block on getting rid of 
numa_get_node_for_cpu() { numa_info[].node_cpu } and keeping
node-mapping along with the rest of topology in Machine object
instead of globals.

I'm in process of getting rid of numa_info[].node_cpu/numa_get_node_for_cpu()
altogether. And incrementally done it for PC, so I'd be forced
to reduplicate above snippet from cpu_generic_realize() in concrete
users anyway to do conversion without breaking other users.
 
[...]
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -1978,6 +1978,11 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
> >  
> >      cs = CPU(cpu);
> >      cs->cpu_index = idx;
> > +
> > +    idx = numa_get_node_for_cpu(cs->cpu_index);
> > +    if (idx < nb_numa_nodes) {
> > +        cpu->numa_nid = idx;
> > +    }
this is the only place where I add above mentioned duplication,
which sort of compensated by removed numa_post_machine_init().
And it's here only to keep working+fix 'info numa'.
The other targets currently already do numa_get_node_for_cpu(),
lookup so I'm not changing there anything.
Later(not in this patch) I'm removing numa_get_node_for_cpu() from
pc_cpu_pre_plug() and from PC code altogether and replacing it
with node-id from possible_cpus.

PS:
since travis-ci seems to be broken, I'll post re-factoring
RFC without building there and it includes this patch as well.

  reply	other threads:[~2017-01-18 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 14:48 [Qemu-devel] [PATCH] numa: access CPU's node id via property in hmp_info_numa() Igor Mammedov
2017-01-18 15:19 ` Eduardo Habkost
2017-01-18 17:08   ` Igor Mammedov [this message]
2017-01-18 18:06     ` 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=20170118180824.52d84031@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=caoj.fnst@cn.fujitsu.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=douly.fnst@cn.fujitsu.com \
    --cc=drjones@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=fanc.fnst@cn.fujitsu.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --cc=vilanova@ac.upc.edu \
    /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).