diff options
author | Kevin Winchester <kjwinchester@gmail.com> | 2011-12-20 19:52:22 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-12-21 03:25:09 -0500 |
commit | 141168c36cdee3ff23d9c7700b0edc47cb65479f (patch) | |
tree | 9b307514252062a7bd0cfa593e56e1843975e1c2 | |
parent | b49d7d877ff96428c8cd2076b33ba72bf85ceaba (diff) |
x86: Simplify code by removing a !SMP #ifdefs from 'struct cpuinfo_x86'
Several fields in struct cpuinfo_x86 were not defined for the
!SMP case, likely to save space. However, those fields still
have some meaning for UP, and keeping them allows some #ifdef
removal from other files. The additional size of the UP kernel
from this change is not significant enough to worry about
keeping up the distinction:
text data bss dec hex filename
4737168 506459 972040 6215667 5ed7f3 vmlinux.o.before
4737444 506459 972040 6215943 5ed907 vmlinux.o.after
for a difference of 276 bytes for an example UP config.
If someone wants those 276 bytes back badly then it should
be implemented in a cleaner way.
Signed-off-by: Kevin Winchester <kjwinchester@gmail.com>
Cc: Steffen Persvold <sp@numascale.com>
Link: http://lkml.kernel.org/r/1324428742-12498-1-git-send-email-kjwinchester@gmail.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/include/asm/processor.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/amd_nb.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/amd.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_amd.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/proc.c | 4 | ||||
-rw-r--r-- | drivers/edac/sb_edac.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/coretemp.c | 7 |
10 files changed, 7 insertions, 36 deletions
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index b650435ffb53..aa9088c26931 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -99,7 +99,6 @@ struct cpuinfo_x86 { | |||
99 | u16 apicid; | 99 | u16 apicid; |
100 | u16 initial_apicid; | 100 | u16 initial_apicid; |
101 | u16 x86_clflush_size; | 101 | u16 x86_clflush_size; |
102 | #ifdef CONFIG_SMP | ||
103 | /* number of cores as seen by the OS: */ | 102 | /* number of cores as seen by the OS: */ |
104 | u16 booted_cores; | 103 | u16 booted_cores; |
105 | /* Physical processor id: */ | 104 | /* Physical processor id: */ |
@@ -110,7 +109,6 @@ struct cpuinfo_x86 { | |||
110 | u8 compute_unit_id; | 109 | u8 compute_unit_id; |
111 | /* Index into per_cpu list: */ | 110 | /* Index into per_cpu list: */ |
112 | u16 cpu_index; | 111 | u16 cpu_index; |
113 | #endif | ||
114 | u32 microcode; | 112 | u32 microcode; |
115 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | 113 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); |
116 | 114 | ||
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 4c39baa8facc..013c1810ce72 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -123,16 +123,14 @@ int amd_get_subcaches(int cpu) | |||
123 | { | 123 | { |
124 | struct pci_dev *link = node_to_amd_nb(amd_get_nb_id(cpu))->link; | 124 | struct pci_dev *link = node_to_amd_nb(amd_get_nb_id(cpu))->link; |
125 | unsigned int mask; | 125 | unsigned int mask; |
126 | int cuid = 0; | 126 | int cuid; |
127 | 127 | ||
128 | if (!amd_nb_has_feature(AMD_NB_L3_PARTITIONING)) | 128 | if (!amd_nb_has_feature(AMD_NB_L3_PARTITIONING)) |
129 | return 0; | 129 | return 0; |
130 | 130 | ||
131 | pci_read_config_dword(link, 0x1d4, &mask); | 131 | pci_read_config_dword(link, 0x1d4, &mask); |
132 | 132 | ||
133 | #ifdef CONFIG_SMP | ||
134 | cuid = cpu_data(cpu).compute_unit_id; | 133 | cuid = cpu_data(cpu).compute_unit_id; |
135 | #endif | ||
136 | return (mask >> (4 * cuid)) & 0xf; | 134 | return (mask >> (4 * cuid)) & 0xf; |
137 | } | 135 | } |
138 | 136 | ||
@@ -141,7 +139,7 @@ int amd_set_subcaches(int cpu, int mask) | |||
141 | static unsigned int reset, ban; | 139 | static unsigned int reset, ban; |
142 | struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); | 140 | struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); |
143 | unsigned int reg; | 141 | unsigned int reg; |
144 | int cuid = 0; | 142 | int cuid; |
145 | 143 | ||
146 | if (!amd_nb_has_feature(AMD_NB_L3_PARTITIONING) || mask > 0xf) | 144 | if (!amd_nb_has_feature(AMD_NB_L3_PARTITIONING) || mask > 0xf) |
147 | return -EINVAL; | 145 | return -EINVAL; |
@@ -159,9 +157,7 @@ int amd_set_subcaches(int cpu, int mask) | |||
159 | pci_write_config_dword(nb->misc, 0x1b8, reg & ~0x180000); | 157 | pci_write_config_dword(nb->misc, 0x1b8, reg & ~0x180000); |
160 | } | 158 | } |
161 | 159 | ||
162 | #ifdef CONFIG_SMP | ||
163 | cuid = cpu_data(cpu).compute_unit_id; | 160 | cuid = cpu_data(cpu).compute_unit_id; |
164 | #endif | ||
165 | mask <<= 4 * cuid; | 161 | mask <<= 4 * cuid; |
166 | mask |= (0xf ^ (1 << cuid)) << 26; | 162 | mask |= (0xf ^ (1 << cuid)) << 26; |
167 | 163 | ||
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index ef21bdccd674..f4773f4aae35 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -148,7 +148,6 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) | |||
148 | 148 | ||
149 | static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c) | 149 | static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c) |
150 | { | 150 | { |
151 | #ifdef CONFIG_SMP | ||
152 | /* calling is from identify_secondary_cpu() ? */ | 151 | /* calling is from identify_secondary_cpu() ? */ |
153 | if (!c->cpu_index) | 152 | if (!c->cpu_index) |
154 | return; | 153 | return; |
@@ -192,7 +191,6 @@ static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c) | |||
192 | 191 | ||
193 | valid_k7: | 192 | valid_k7: |
194 | ; | 193 | ; |
195 | #endif | ||
196 | } | 194 | } |
197 | 195 | ||
198 | static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) | 196 | static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index a70bd5b96b9e..850f2963a420 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -676,9 +676,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) | |||
676 | if (this_cpu->c_early_init) | 676 | if (this_cpu->c_early_init) |
677 | this_cpu->c_early_init(c); | 677 | this_cpu->c_early_init(c); |
678 | 678 | ||
679 | #ifdef CONFIG_SMP | ||
680 | c->cpu_index = 0; | 679 | c->cpu_index = 0; |
681 | #endif | ||
682 | filter_cpuid_features(c, false); | 680 | filter_cpuid_features(c, false); |
683 | 681 | ||
684 | setup_smep(c); | 682 | setup_smep(c); |
@@ -764,10 +762,7 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c) | |||
764 | c->apicid = c->initial_apicid; | 762 | c->apicid = c->initial_apicid; |
765 | # endif | 763 | # endif |
766 | #endif | 764 | #endif |
767 | |||
768 | #ifdef CONFIG_X86_HT | ||
769 | c->phys_proc_id = c->initial_apicid; | 765 | c->phys_proc_id = c->initial_apicid; |
770 | #endif | ||
771 | } | 766 | } |
772 | 767 | ||
773 | setup_smep(c); | 768 | setup_smep(c); |
@@ -1146,9 +1141,7 @@ static void dbg_restore_debug_regs(void) | |||
1146 | */ | 1141 | */ |
1147 | void __cpuinit x86_default_fixup_cpu_id(struct cpuinfo_x86 *c, int node) | 1142 | void __cpuinit x86_default_fixup_cpu_id(struct cpuinfo_x86 *c, int node) |
1148 | { | 1143 | { |
1149 | #ifdef CONFIG_NUMA | ||
1150 | pr_err("NUMA core number %d differs from configured core number %d\n", node, c->phys_proc_id); | 1144 | pr_err("NUMA core number %d differs from configured core number %d\n", node, c->phys_proc_id); |
1151 | #endif | ||
1152 | } | 1145 | } |
1153 | 1146 | ||
1154 | /* | 1147 | /* |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 523131213f08..3e6ff6cbf42a 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -181,7 +181,6 @@ static void __cpuinit trap_init_f00f_bug(void) | |||
181 | 181 | ||
182 | static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c) | 182 | static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c) |
183 | { | 183 | { |
184 | #ifdef CONFIG_SMP | ||
185 | /* calling is from identify_secondary_cpu() ? */ | 184 | /* calling is from identify_secondary_cpu() ? */ |
186 | if (!c->cpu_index) | 185 | if (!c->cpu_index) |
187 | return; | 186 | return; |
@@ -198,7 +197,6 @@ static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c) | |||
198 | WARN_ONCE(1, "WARNING: SMP operation may be unreliable" | 197 | WARN_ONCE(1, "WARNING: SMP operation may be unreliable" |
199 | "with B stepping processors.\n"); | 198 | "with B stepping processors.\n"); |
200 | } | 199 | } |
201 | #endif | ||
202 | } | 200 | } |
203 | 201 | ||
204 | static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) | 202 | static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 2af127d4c3d1..e9c9d0aab36a 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -119,9 +119,7 @@ void mce_setup(struct mce *m) | |||
119 | m->time = get_seconds(); | 119 | m->time = get_seconds(); |
120 | m->cpuvendor = boot_cpu_data.x86_vendor; | 120 | m->cpuvendor = boot_cpu_data.x86_vendor; |
121 | m->cpuid = cpuid_eax(1); | 121 | m->cpuid = cpuid_eax(1); |
122 | #ifdef CONFIG_SMP | ||
123 | m->socketid = cpu_data(m->extcpu).phys_proc_id; | 122 | m->socketid = cpu_data(m->extcpu).phys_proc_id; |
124 | #endif | ||
125 | m->apicid = cpu_data(m->extcpu).initial_apicid; | 123 | m->apicid = cpu_data(m->extcpu).initial_apicid; |
126 | rdmsrl(MSR_IA32_MCG_CAP, m->mcgcap); | 124 | rdmsrl(MSR_IA32_MCG_CAP, m->mcgcap); |
127 | } | 125 | } |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index f5474218cffe..1d76872b6a45 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c | |||
@@ -64,11 +64,9 @@ struct threshold_bank { | |||
64 | }; | 64 | }; |
65 | static DEFINE_PER_CPU(struct threshold_bank * [NR_BANKS], threshold_banks); | 65 | static DEFINE_PER_CPU(struct threshold_bank * [NR_BANKS], threshold_banks); |
66 | 66 | ||
67 | #ifdef CONFIG_SMP | ||
68 | static unsigned char shared_bank[NR_BANKS] = { | 67 | static unsigned char shared_bank[NR_BANKS] = { |
69 | 0, 0, 0, 0, 1 | 68 | 0, 0, 0, 0, 1 |
70 | }; | 69 | }; |
71 | #endif | ||
72 | 70 | ||
73 | static DEFINE_PER_CPU(unsigned char, bank_map); /* see which banks are on */ | 71 | static DEFINE_PER_CPU(unsigned char, bank_map); /* see which banks are on */ |
74 | 72 | ||
@@ -202,10 +200,9 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) | |||
202 | 200 | ||
203 | if (!block) | 201 | if (!block) |
204 | per_cpu(bank_map, cpu) |= (1 << bank); | 202 | per_cpu(bank_map, cpu) |= (1 << bank); |
205 | #ifdef CONFIG_SMP | ||
206 | if (shared_bank[bank] && c->cpu_core_id) | 203 | if (shared_bank[bank] && c->cpu_core_id) |
207 | break; | 204 | break; |
208 | #endif | 205 | |
209 | offset = setup_APIC_mce(offset, | 206 | offset = setup_APIC_mce(offset, |
210 | (high & MASK_LVTOFF_HI) >> 20); | 207 | (high & MASK_LVTOFF_HI) >> 20); |
211 | 208 | ||
@@ -531,7 +528,6 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
531 | 528 | ||
532 | sprintf(name, "threshold_bank%i", bank); | 529 | sprintf(name, "threshold_bank%i", bank); |
533 | 530 | ||
534 | #ifdef CONFIG_SMP | ||
535 | if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ | 531 | if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ |
536 | i = cpumask_first(cpu_llc_shared_mask(cpu)); | 532 | i = cpumask_first(cpu_llc_shared_mask(cpu)); |
537 | 533 | ||
@@ -558,7 +554,6 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
558 | 554 | ||
559 | goto out; | 555 | goto out; |
560 | } | 556 | } |
561 | #endif | ||
562 | 557 | ||
563 | b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL); | 558 | b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL); |
564 | if (!b) { | 559 | if (!b) { |
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index 14b23140e81f..8022c6681485 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c | |||
@@ -64,12 +64,10 @@ static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c) | |||
64 | static int show_cpuinfo(struct seq_file *m, void *v) | 64 | static int show_cpuinfo(struct seq_file *m, void *v) |
65 | { | 65 | { |
66 | struct cpuinfo_x86 *c = v; | 66 | struct cpuinfo_x86 *c = v; |
67 | unsigned int cpu = 0; | 67 | unsigned int cpu; |
68 | int i; | 68 | int i; |
69 | 69 | ||
70 | #ifdef CONFIG_SMP | ||
71 | cpu = c->cpu_index; | 70 | cpu = c->cpu_index; |
72 | #endif | ||
73 | seq_printf(m, "processor\t: %u\n" | 71 | seq_printf(m, "processor\t: %u\n" |
74 | "vendor_id\t: %s\n" | 72 | "vendor_id\t: %s\n" |
75 | "cpu family\t: %d\n" | 73 | "cpu family\t: %d\n" |
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index 7a402bfbee7d..88df48956c1b 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c | |||
@@ -1609,11 +1609,9 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val, | |||
1609 | mce->cpuvendor, mce->cpuid, mce->time, | 1609 | mce->cpuvendor, mce->cpuid, mce->time, |
1610 | mce->socketid, mce->apicid); | 1610 | mce->socketid, mce->apicid); |
1611 | 1611 | ||
1612 | #ifdef CONFIG_SMP | ||
1613 | /* Only handle if it is the right mc controller */ | 1612 | /* Only handle if it is the right mc controller */ |
1614 | if (cpu_data(mce->cpu).phys_proc_id != pvt->sbridge_dev->mc) | 1613 | if (cpu_data(mce->cpu).phys_proc_id != pvt->sbridge_dev->mc) |
1615 | return NOTIFY_DONE; | 1614 | return NOTIFY_DONE; |
1616 | #endif | ||
1617 | 1615 | ||
1618 | smp_rmb(); | 1616 | smp_rmb(); |
1619 | if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) { | 1617 | if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) { |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 104b3767516c..1fdef885341c 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -57,16 +57,15 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); | |||
57 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) | 57 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) |
58 | #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO) | 58 | #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO) |
59 | 59 | ||
60 | #ifdef CONFIG_SMP | ||
61 | #define TO_PHYS_ID(cpu) cpu_data(cpu).phys_proc_id | 60 | #define TO_PHYS_ID(cpu) cpu_data(cpu).phys_proc_id |
62 | #define TO_CORE_ID(cpu) cpu_data(cpu).cpu_core_id | 61 | #define TO_CORE_ID(cpu) cpu_data(cpu).cpu_core_id |
62 | #define TO_ATTR_NO(cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO) | ||
63 | |||
64 | #ifdef CONFIG_SMP | ||
63 | #define for_each_sibling(i, cpu) for_each_cpu(i, cpu_sibling_mask(cpu)) | 65 | #define for_each_sibling(i, cpu) for_each_cpu(i, cpu_sibling_mask(cpu)) |
64 | #else | 66 | #else |
65 | #define TO_PHYS_ID(cpu) (cpu) | ||
66 | #define TO_CORE_ID(cpu) (cpu) | ||
67 | #define for_each_sibling(i, cpu) for (i = 0; false; ) | 67 | #define for_each_sibling(i, cpu) for (i = 0; false; ) |
68 | #endif | 68 | #endif |
69 | #define TO_ATTR_NO(cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO) | ||
70 | 69 | ||
71 | /* | 70 | /* |
72 | * Per-Core Temperature Data | 71 | * Per-Core Temperature Data |