Re: [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86

From: Kevin Winchester
Date: Sat Feb 11 2012 - 21:19:29 EST


On 11 February 2012 20:24, Kevin Winchester <kjwinchester@xxxxxxxxx> wrote:
> Commit 141168c36cde ("x86: Simplify code by removing a !SMP #ifdefs from
> 'struct cpuinfo_x86'") caused the compilation error:
>
> mce_amd.c:(.cpuinit.text+0x4723): undefined reference to 'cpu_llc_shared_map'
>
> by removing an #ifdef CONFIG_SMP around a block containing a reference
> to cpu_llc_shared_map.  Rather than replace the #ifdef, move
> cpu_llc_shared_map to be a new field llc_shared_map in struct
> cpuinfo_x86 and adjust all references to cpu_llc_shared_map.
>
> Signed-off-by: Kevin Winchester <kjwinchester@xxxxxxxxx>
> ---
>  arch/x86/include/asm/processor.h      |    1 +
>  arch/x86/include/asm/smp.h            |    6 ------
>  arch/x86/kernel/cpu/intel_cacheinfo.c |    4 ++--
>  arch/x86/kernel/cpu/mcheck/mce_amd.c  |    7 ++++---
>  arch/x86/kernel/smpboot.c             |   15 ++++++---------
>  arch/x86/xen/smp.c                    |    1 -
>  6 files changed, 13 insertions(+), 21 deletions(-)
>
>
>  static void impress_friends(void)
> @@ -1053,7 +1051,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
>        for_each_possible_cpu(i) {
>                zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
>                zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
> -               zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
>        }
>        set_cpu_sibling_map(0);
>
> diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
> index 041d4fe..a898ed5 100644
> --- a/arch/x86/xen/smp.c
> +++ b/arch/x86/xen/smp.c
> @@ -225,7 +225,6 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
>        for_each_possible_cpu(i) {
>                zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
>                zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
> -               zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
>        }
>        set_cpu_sibling_map(0);
>

I just realized that I took out a couple of allocations here for
cpu_llc_shared_map, without replacing them. Am I leaving
cpuinfo_x86.llc_shared_map unallocated then, and just writing to
whatever address that field happened to get?
--
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/