Re: [PATCH 3/5] x86: add cpu_node topology detection for AMD Magny-Cours

From: Bert Wesarg
Date: Wed Jun 03 2009 - 10:48:23 EST


On Wed, Jun 3, 2009 at 16:35, Andreas Herrmann
<andreas.herrmann3@xxxxxxx> wrote:
> This adapts CPU topology detection for AMD Magny-Cours.
>
> Here is example output from two cores on same package but different
> internal cpu_nodes:
>
> /sys/devices/system/cpu/cpu5:
> Âphysical_package_id    Â: 0
> Âcore_id          Â: 5
> Âthread_siblings      Â: 00000020
> Âthread_siblings_list    : 5
> Âcpu_node_id        Â: 0
> Âcpu_node_siblings     Â: 0000003f
> Âcpu_node_siblings_list   : 0-5
> Âcore_siblings       Â: 00000fff
> Âcore_siblings_list     : 0-11
> /sys/devices/system/cpu/cpu6:
> Âphysical_package_id    Â: 0
> Âcore_id          Â: 0
> Âthread_siblings      Â: 00000040
> Âthread_siblings_list    : 6
> Âcpu_node_id        Â: 1
> Âcpu_node_siblings     Â: 00000fc0
> Âcpu_node_siblings_list   : 6-11
> Âcore_siblings       Â: 00000fff
> Âcore_siblings_list     : 0-11
>
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@xxxxxxx>
> ---
> Âarch/x86/include/asm/cpufeature.h | Â Â1 +
> Âarch/x86/kernel/cpu/amd.c     |  61 +++++++++++++++++++++++++++++++++++++
> Â2 files changed, 62 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 728b375..feed057 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -274,7 +328,14 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
> Â Â Â Âint node;
> Â Â Â Âunsigned apicid = cpu_has_apic ? hard_smp_processor_id() : c->apicid;
>
> +#ifdef CONFIG_MULTI_NODE_CPU
> + Â Â Â if (cpu_has(c, X86_FEATURE_AMD_DCM))
> + Â Â Â Â Â Â Â node = (c->phys_proc_id << 1) + c->cpu_node_id;
> + Â Â Â else
> + Â Â Â Â Â Â Â node = c->phys_proc_id;
> +#else
> Â Â Â Ânode = c->phys_proc_id;
> +#endif
Stale CONFIG_MULTI_NODE_CPU?

Regards,
Bert

> Â Â Â Âif (apicid_to_node[apicid] != NUMA_NO_NODE)
> Â Â Â Â Â Â Â Ânode = apicid_to_node[apicid];
> Â Â Â Âif (!node_online(node)) {
> --
> 1.6.3.1
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/