From: Kevin Winchester <kjwinchester@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Kevin Winchester <kjwinchester@gmail.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>,
Randy Dunlap <rdunlap@xenotime.net>,
Nick Bowler <nbowler@elliptictech.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86
Date: Sat, 11 Feb 2012 20:24:12 -0400 [thread overview]
Message-ID: <1329006252-1684-1-git-send-email-kjwinchester@gmail.com> (raw)
In-Reply-To: <20120211140737.GA26637@elte.hu>
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@gmail.com>
---
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(-)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index aa9088c..50389d2 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -110,6 +110,7 @@ struct cpuinfo_x86 {
/* Index into per_cpu list: */
u16 cpu_index;
u32 microcode;
+ cpumask_var_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..f7599d0 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -34,7 +34,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);
@@ -48,11 +47,6 @@ static inline struct cpumask *cpu_core_mask(int cpu)
return per_cpu(cpu_core_map, cpu);
}
-static inline struct cpumask *cpu_llc_shared_mask(int cpu)
-{
- return per_cpu(cpu_llc_shared_map, cpu);
-}
-
DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32)
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 73d08ed..03807f0 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -734,11 +734,11 @@ static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index)
ret = 0;
if (index == 3) {
ret = 1;
- for_each_cpu(i, cpu_llc_shared_mask(cpu)) {
+ for_each_cpu(i, c->llc_shared_map) {
if (!per_cpu(ici_cpuid4_info, i))
continue;
this_leaf = CPUID4_INFO_IDX(i, index);
- for_each_cpu(sibling, cpu_llc_shared_mask(cpu)) {
+ for_each_cpu(sibling, c->llc_shared_map) {
if (!cpu_online(sibling))
continue;
set_bit(sibling, this_leaf->shared_cpu_map);
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 786e76a..56899e1 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -525,11 +525,12 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
struct threshold_bank *b = NULL;
struct device *dev = mce_device[cpu];
char name[32];
+ struct cpuinfo_x86 *c = &cpu_data(cpu);
sprintf(name, "threshold_bank%i", bank);
- if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */
- i = cpumask_first(cpu_llc_shared_mask(cpu));
+ if (c->cpu_core_id && shared_bank[bank]) { /* symlink */
+ i = cpumask_first(c->llc_shared_map);
/* first core not up yet */
if (cpu_data(i).cpu_core_id)
@@ -548,7 +549,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
if (err)
goto out;
- cpumask_copy(b->cpus, cpu_llc_shared_mask(cpu));
+ cpumask_copy(b->cpus, c->llc_shared_map);
per_cpu(threshold_banks, cpu)[bank] = b;
goto out;
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 66d250c..2b18365 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -127,8 +127,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);
@@ -337,8 +335,8 @@ static void __cpuinit link_thread_siblings(int cpu1, int cpu2)
cpumask_set_cpu(cpu2, cpu_sibling_mask(cpu1));
cpumask_set_cpu(cpu1, cpu_core_mask(cpu2));
cpumask_set_cpu(cpu2, cpu_core_mask(cpu1));
- cpumask_set_cpu(cpu1, cpu_llc_shared_mask(cpu2));
- cpumask_set_cpu(cpu2, cpu_llc_shared_mask(cpu1));
+ cpumask_set_cpu(cpu1, cpu_data(cpu2).llc_shared_map);
+ cpumask_set_cpu(cpu2, cpu_data(cpu1).llc_shared_map);
}
@@ -367,7 +365,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
}
- cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu));
+ cpumask_set_cpu(cpu, c->llc_shared_map);
if (__this_cpu_read(cpu_info.x86_max_cores) == 1) {
cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu));
@@ -378,8 +376,8 @@ void __cpuinit set_cpu_sibling_map(int cpu)
for_each_cpu(i, cpu_sibling_setup_mask) {
if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
- cpumask_set_cpu(i, cpu_llc_shared_mask(cpu));
- cpumask_set_cpu(cpu, cpu_llc_shared_mask(i));
+ cpumask_set_cpu(i, c->llc_shared_map);
+ cpumask_set_cpu(cpu, cpu_data(i).llc_shared_map);
}
if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
cpumask_set_cpu(i, cpu_core_mask(cpu));
@@ -418,7 +416,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
!(cpu_has(c, X86_FEATURE_AMD_DCM)))
return cpu_core_mask(cpu);
else
- return cpu_llc_shared_mask(cpu);
+ return c->llc_shared_map;
}
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);
--
1.7.9
next prev parent reply other threads:[~2012-02-12 0:24 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 19:10 [PATCH] MCE, AMD: Select SMP explicitly Borislav Petkov
2012-02-02 19:37 ` Nick Bowler
2012-02-02 20:24 ` Borislav Petkov
2012-02-03 19:18 ` MCE, AMD: Hide smp-only code around CONFIG_SMP Borislav Petkov
2012-02-03 22:05 ` Randy Dunlap
2012-02-07 9:57 ` Ingo Molnar
2012-02-08 0:41 ` Kevin Winchester
2012-02-08 10:19 ` Borislav Petkov
2012-02-08 12:22 ` Kevin Winchester
2012-02-08 13:05 ` Borislav Petkov
2012-02-09 8:06 ` Ingo Molnar
2012-02-10 0:00 ` Kevin Winchester
2012-02-11 14:07 ` Ingo Molnar
2012-02-12 0:24 ` Kevin Winchester [this message]
2012-02-12 2:18 ` [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-12 11:19 ` Ingo Molnar
2012-02-14 0:12 ` [PATCH v2] " Kevin Winchester
2012-02-17 11:56 ` Ingo Molnar
2012-02-17 13:12 ` Kevin Winchester
2012-02-21 2:06 ` [PATCH 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-21 2:06 ` [PATCH 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-21 15:42 ` Borislav Petkov
2012-02-21 2:06 ` [PATCH 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-02-21 10:37 ` Borislav Petkov
2012-02-21 10:40 ` Borislav Petkov
2012-02-21 2:06 ` [PATCH 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-21 11:35 ` Borislav Petkov
2012-02-21 2:06 ` [PATCH 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-21 14:21 ` Borislav Petkov
2012-02-21 2:06 ` [PATCH 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-21 15:39 ` Borislav Petkov
2012-02-22 1:44 ` Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22 6:39 ` H. Peter Anvin
2012-02-22 9:27 ` Ingo Molnar
2012-02-22 12:24 ` Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-22 23:32 ` [PATCH v3 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-22 23:43 ` [PATCH v3 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-23 7:32 ` Ingo Molnar
2012-02-22 1:45 ` [PATCH v2 2/5] x86: Move per cpu cpu_llc_id to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-22 1:45 ` [PATCH v2 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-12 11:23 ` [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Borislav Petkov
2012-02-12 0:31 ` MCE, AMD: Hide smp-only code around CONFIG_SMP Kevin Winchester
2012-02-22 16:13 ` [tip:x86/urgent] x86/mce/AMD: Fix UP build error tip-bot for Borislav Petkov
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=1329006252-1684-1-git-send-email-kjwinchester@gmail.com \
--to=kjwinchester@gmail.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nbowler@elliptictech.com \
--cc=rdunlap@xenotime.net \
--cc=tglx@linutronix.de \
/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).