Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH v6 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


kjwinchester at gmail

Apr 29, 2012, 4:33 PM

Post #1 of 4 (76 views)
Permalink
[PATCH v6 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86

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 cpumask_t field llc_shared_map in
struct cpuinfo_x86 and adjust all references to cpu_llc_shared_map.

Signed-off-by: Kevin Winchester <kjwinchester [at] gmail>
---
arch/x86/include/asm/processor.h | 2 ++
arch/x86/include/asm/smp.h | 4 +---
arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 --
arch/x86/kernel/smpboot.c | 3 ---
arch/x86/xen/smp.c | 1 -
5 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 4fa7dcc..c92ac6e 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -119,6 +119,8 @@ struct cpuinfo_x86 {
/* Index into per_cpu list: */
u16 cpu_index;
u32 microcode;
+ /* CPUs sharing the last level cache: */
+ cpumask_t llc_shared_map;
} __attribute__((__aligned__(SMP_CACHE_BYTES)));

#define X86_VENDOR_INTEL 0
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 0434c40..b6e034e 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -33,8 +33,6 @@ static inline bool cpu_has_ht_siblings(void)

DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_map);
DECLARE_PER_CPU(cpumask_var_t, cpu_core_map);
-/* cpus sharing the last level cache: */
-DECLARE_PER_CPU(cpumask_var_t, cpu_llc_shared_map);
DECLARE_PER_CPU(u16, cpu_llc_id);
DECLARE_PER_CPU(int, cpu_number);

@@ -50,7 +48,7 @@ static inline struct cpumask *cpu_core_mask(int cpu)

static inline struct cpumask *cpu_llc_shared_mask(int cpu)
{
- return per_cpu(cpu_llc_shared_map, cpu);
+ return &cpu_data(cpu).llc_shared_map;
}

DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 99b5717..a4bf9d2 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -528,7 +528,6 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)

sprintf(name, "threshold_bank%i", bank);

-#ifdef CONFIG_SMP
if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */
i = cpumask_first(cpu_llc_shared_mask(cpu));

@@ -554,7 +553,6 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)

goto out;
}
-#endif

b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL);
if (!b) {
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 6e1e406..589bf69 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -128,8 +128,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
DEFINE_PER_CPU(cpumask_var_t, cpu_core_map);
EXPORT_PER_CPU_SYMBOL(cpu_core_map);

-DEFINE_PER_CPU(cpumask_var_t, cpu_llc_shared_map);
-
/* Per CPU bogomips and other parameters */
DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
EXPORT_PER_CPU_SYMBOL(cpu_info);
@@ -1036,7 +1034,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 0503c0c..7f336a9 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -246,7 +246,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);

--
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hpa at zytor

Apr 29, 2012, 4:37 PM

Post #2 of 4 (73 views)
Permalink
Re: [PATCH v6 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 [In reply to]

On 04/29/2012 04:33 PM, Kevin Winchester 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 cpumask_t field llc_shared_map in
> struct cpuinfo_x86 and adjust all references to cpu_llc_shared_map.
>

Okay... I must not get this.

Why is this better than just moving the DEFINE_PER_CPU to a place which
isn't dependent on SMP?

-hpa


--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


kjwinchester at gmail

Apr 30, 2012, 8:05 AM

Post #3 of 4 (67 views)
Permalink
Re: [PATCH v6 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 [In reply to]

On 29 April 2012 20:37, H. Peter Anvin <hpa [at] zytor> wrote:
> On 04/29/2012 04:33 PM, Kevin Winchester 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 cpumask_t field llc_shared_map in
>> struct cpuinfo_x86 and adjust all references to cpu_llc_shared_map.
>>
>
> Okay...  I must not get this.
>
> Why is this better than just moving the DEFINE_PER_CPU to a place which
> isn't dependent on SMP?
>

To be honest, the idea was suggested by Ingo a while back, and I just
volunteered to implement it. I believe the idea was to work towards
gathering all CPU-specific data for SMP and !SMP into one place. That
said, moving the DEFINE_PER_CPU elsewhere would likely still give the
same benefits as my patch in terms of ifdef reduction. I cannot
really see a benefit/downside either way, really.

Perhaps Ingo will chime in, and you and he (and anyone else with an
opinion) can figure out the best way of accomplishing this
simplification, and then I can adjust my series accordingly.

--
Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


mingo at kernel

May 7, 2012, 1:32 AM

Post #4 of 4 (62 views)
Permalink
Re: [PATCH v6 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 [In reply to]

* Kevin Winchester <kjwinchester [at] gmail> wrote:

> On 29 April 2012 20:37, H. Peter Anvin <hpa [at] zytor> wrote:
> > On 04/29/2012 04:33 PM, Kevin Winchester 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 cpumask_t field llc_shared_map in
> >> struct cpuinfo_x86 and adjust all references to cpu_llc_shared_map.
> >>
> >
> > Okay...  I must not get this.
> >
> > Why is this better than just moving the DEFINE_PER_CPU to a place which
> > isn't dependent on SMP?
> >
>
> To be honest, the idea was suggested by Ingo a while back, and
> I just volunteered to implement it. I believe the idea was to
> work towards gathering all CPU-specific data for SMP and !SMP
> into one place. That said, moving the DEFINE_PER_CPU
> elsewhere would likely still give the same benefits as my
> patch in terms of ifdef reduction. I cannot really see a
> benefit/downside either way, really.
>
> Perhaps Ingo will chime in, and you and he (and anyone else
> with an opinion) can figure out the best way of accomplishing
> this simplification, and then I can adjust my series
> accordingly.

Well, cpu_llc_shared_map is really a CPU attribute and as such I
think the logical place for it is "struct cpuinfo_x86". Peter,
any objections to that?

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.