All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Igor Mammedov" <imammedo@redhat.com>,
	qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 1/2][RFC] qom: introduce cpu QOM hierarchy tree /machine/node/socket/core/thread/cpu.
Date: Fri, 28 Feb 2014 10:01:56 +0800	[thread overview]
Message-ID: <1393552916.7774.17.camel@G08FNSTD131468> (raw)
In-Reply-To: <20140226185204.GV24353@otherpad.lan.raisama.net>

On Wed, 2014-02-26 at 15:52 -0300, Eduardo Habkost wrote:
> On Tue, Feb 25, 2014 at 05:07:31PM +0800, Chen Fan wrote:
> [...]
> > +Object *object_get_thread_from_index(int64_t cpu_index)
> 
> Probably the code that is going to call this function already knows what
> will be the node/socket/core/thread IDs for the CPU. And if it doesn't,
> we need to make the code node-/socket-/core-/thread-aware, instead of
> making the code dependent on CPU-index-based logic.
> 
> I believe we should try to make CPU indexes unnecessary, except on
> places where we are already forced to deal with them for compatibility
> reasons.
> 
firstly, thanks for you important feedback.

I suppose that if we try to make CPU indexes unnecessary we should add
"-device cpufoo" support, and we should also need to add a "path" in
command line to let function pc_new_cpu() know the IDs which can be
calculated from the "path". then which one should the commend line be 
"-device cpufoo,sockets=X,cores=Y,threads=Z" or "-device cpufoo,paths=/
node-/socket-/core-/thread-/", or any other better?


> > +{
> > +    gchar *path;
> > +    Object *thread;
> > +    int nodes, cpus_pre_nodes, smp_sockets;
> > +    unsigned node_id, socket_id, core_id, thread_id;
> > +    unsigned core_index, socket_index;
> > +
> > +    nodes = nb_numa_nodes ? nb_numa_nodes : 1;
> > +    cpus_pre_nodes = max_cpus / nodes;
> > +    smp_sockets = cpus_pre_nodes / (smp_cores * smp_threads);
> > +
> > +    core_index = cpu_index / smp_threads;
> > +    thread_id = cpu_index % smp_threads;
> > +    socket_index = core_index / smp_cores;
> > +    core_id = core_index % smp_cores;
> 
> This is duplicating logic that already exists at topo_ids_from_idx().
> 
> > +    node_id = socket_index / smp_sockets;
> 
> This is not how CPUs are distributed along NUMA nodes. They are
> distributed depending on the -numa options. Grep for node_cpumask in the
> code.
> 
> 
> > +    socket_id = socket_index % smp_sockets;
> > +
> > +    path = g_strdup_printf("/machine/node[%d]/socket[%d]/core[%d]/thread[%d]",
> > +                           node_id, socket_id, core_id, thread_id);
> > +    thread = object_resolve_path(path, NULL);
> > +    g_free(path);
> > +
> > +    return thread;
> > +}
> > +
> 

  reply	other threads:[~2014-02-28  2:04 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14  9:27 [Qemu-devel] [RFC 0/3] fix migration issues after hotplug a discontinuous cpuid Chen Fan
2014-01-14  9:27 ` [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn() Chen Fan
2014-01-14 10:40   ` Igor Mammedov
2014-01-15 12:24     ` Chen Fan
2014-01-15 14:37       ` Igor Mammedov
2014-01-17 19:13         ` [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()) Eduardo Habkost
2014-01-20 12:29           ` Igor Mammedov
2014-01-21  7:12             ` Chen Fan
2014-01-21  9:31               ` Igor Mammedov
2014-01-21  9:51                 ` Chen Fan
2014-01-21 10:10                   ` Andreas Färber
2014-02-13  6:14                     ` Chen Fan
2014-02-13  9:44                       ` Igor Mammedov
2014-02-17 10:24                         ` Chen Fan
2014-02-17 10:43                           ` Igor Mammedov
2014-02-25  9:07                             ` [Qemu-devel] [PATCH 0/2][RFC] prebuild cpu QOM tree /machine/node/socket/core/thread/ Chen Fan
2014-02-25  9:07                               ` [Qemu-devel] [PATCH 1/2][RFC] qom: introduce cpu QOM hierarchy tree /machine/node/socket/core/thread/cpu Chen Fan
2014-02-25 13:35                                 ` Eric Blake
2014-02-26  1:05                                   ` Chen Fan
2014-02-26 18:52                                 ` Eduardo Habkost
2014-02-28  2:01                                   ` Chen Fan [this message]
2014-03-04 10:50                                     ` [Qemu-devel] [RFC v2 0/2] prebuild cpu QOM tree /machine/node/socket/core/thread/ Chen Fan
2014-03-04 10:50                                       ` [Qemu-devel] [RFC v2 1/2] i386: introduce "struct X86TopoInfo" for saving cpu topology information Chen Fan
2014-03-04 19:35                                         ` Eduardo Habkost
2014-03-05  1:33                                           ` Chen Fan
2014-03-11 10:58                                             ` [Qemu-devel] [RFC v3 0/3] prebuild cpu QOM tree /machine/node/socket/core ->link-cpu chen.fan.fnst
2014-03-11 10:58                                               ` [Qemu-devel] [RFC v3 1/3] cpu: introduce CpuTopoInfo structure for argument simplification chen.fan.fnst
2014-03-11 17:10                                                 ` Eduardo Habkost
2014-03-11 10:58                                               ` [Qemu-devel] [RFC v3 2/3] i386: use CpuTopoInfo instead apic_id as argument for pc_new_cpu() chen.fan.fnst
2014-03-11 18:00                                                 ` Eduardo Habkost
2014-03-12  5:53                                                   ` Chen Fan
2014-03-12  7:51                                                   ` [Qemu-devel] [RFC v4 0/3] prebuild cpu QOM tree /machine/node/socket/core ->link-cpu Chen Fan
2014-03-12  7:51                                                     ` [Qemu-devel] [RFC v4 1/3] cpu: introduce CpuTopoInfo structure for argument simplification Chen Fan
2014-03-12 15:36                                                       ` Eduardo Habkost
2014-03-19  8:53                                                         ` [Qemu-devel] [PATCH v1 0/4] prebuild cpu QOM tree /machine/node/socket/core ->link-cpu Chen Fan
2014-03-19  8:53                                                           ` [Qemu-devel] [PATCH v1 1/4] cpu: introduce CpuTopoInfo structure for argument simplification Chen Fan
2014-03-19  8:53                                                           ` [Qemu-devel] [PATCH v1 2/4] i386: use CpuTopoInfo instead apic_id as argument for pc_new_cpu() Chen Fan
2014-03-19 19:27                                                             ` Eduardo Habkost
2014-03-20  6:25                                                               ` Chen Fan
2014-03-19  8:53                                                           ` [Qemu-devel] [PATCH v1 3/4] topo unit-test: update Unit tests to test-x86-cpuid.c Chen Fan
2014-03-19  8:53                                                           ` [Qemu-devel] [PATCH v1 4/4] i386: introduce cpu QOM hierarchy tree Chen Fan
2014-03-19 12:00                                                           ` [Qemu-devel] [PATCH v1 0/4] prebuild cpu QOM tree /machine/node/socket/core ->link-cpu Eric Blake
2014-03-20  0:55                                                             ` Chen Fan
2014-03-12  7:51                                                     ` [Qemu-devel] [RFC v4 2/3] i386: use CpuTopoInfo instead apic_id as argument for pc_new_cpu() Chen Fan
2014-03-12 15:39                                                       ` Eduardo Habkost
2014-03-12  7:51                                                     ` [Qemu-devel] [RFC v4 3/3] i386: introduce cpu QOM hierarchy tree Chen Fan
2014-03-11 10:58                                               ` [Qemu-devel] [RFC v3 " chen.fan.fnst
2014-03-04 10:50                                       ` [Qemu-devel] [RFC v2 2/2] " Chen Fan
2014-02-25  9:07                               ` [Qemu-devel] [PATCH 2/2][RFC] cpu: link each new cpu to QOM tree /machine/node/socket/core/thread/cpu respectively Chen Fan
2014-02-26 19:11                                 ` Eduardo Habkost
2014-02-13 10:00                     ` [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()) Igor Mammedov
2014-01-14  9:27 ` [Qemu-devel] [RFC 2/3] target-i386: add -smp X,apics=0x option Chen Fan
2014-02-17 18:37   ` Eric Blake
2014-02-18  1:49     ` Chen Fan
2014-01-14  9:27 ` [Qemu-devel] [RFC 3/3] target-i386: add qmp command 'query-cpus' to display apic_id Chen Fan
2014-02-17 18:37   ` Eric Blake

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=1393552916.7774.17.camel@G08FNSTD131468 \
    --to=chen.fan.fnst@cn.fujitsu.com \
    --cc=afaerber@suse.de \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@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 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.