aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic/apic.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-04-27 02:39:38 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-27 03:23:52 -0400
commite0e42142bab96404de535cceb85d6533d5ad7942 (patch)
treeb89b2aef9f5b9ec0ed2bb75f82305e54472a6fe9 /arch/x86/kernel/apic/apic.c
parentb2ba83ff4f4405cebc10884121ee71338a1a6c94 (diff)
x86: Use dmi check in apic_is_clustered() on 64-bit to mark the TSC unstable
We will have systems with 2 and more sockets 8cores/2thread, but we treat them as multi chassis - while they could have a stable TSC domain. Use DMI check instead. [ Impact: do not turn possibly stable TSCs off incorrectly ] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Cc: Ravikiran Thirumalai <kiran@scalex86.org> LKML-Reference: <49F5532A.5000802@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
-rw-r--r--arch/x86/kernel/apic/apic.c86
1 files changed, 59 insertions, 27 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 1386dbec552..28f747d61d7 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2138,31 +2138,14 @@ static void apic_pm_activate(void) { }
2138#endif /* CONFIG_PM */ 2138#endif /* CONFIG_PM */
2139 2139
2140#ifdef CONFIG_X86_64 2140#ifdef CONFIG_X86_64
2141/* 2141
2142 * apic_is_clustered_box() -- Check if we can expect good TSC 2142static int __cpuinit apic_cluster_num(void)
2143 *
2144 * Thus far, the major user of this is IBM's Summit2 series:
2145 *
2146 * Clustered boxes may have unsynced TSC problems if they are
2147 * multi-chassis. Use available data to take a good guess.
2148 * If in doubt, go HPET.
2149 */
2150__cpuinit int apic_is_clustered_box(void)
2151{ 2143{
2152 int i, clusters, zeros; 2144 int i, clusters, zeros;
2153 unsigned id; 2145 unsigned id;
2154 u16 *bios_cpu_apicid; 2146 u16 *bios_cpu_apicid;
2155 DECLARE_BITMAP(clustermap, NUM_APIC_CLUSTERS); 2147 DECLARE_BITMAP(clustermap, NUM_APIC_CLUSTERS);
2156 2148
2157 /*
2158 * there is not this kind of box with AMD CPU yet.
2159 * Some AMD box with quadcore cpu and 8 sockets apicid
2160 * will be [4, 0x23] or [8, 0x27] could be thought to
2161 * vsmp box still need checking...
2162 */
2163 if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && !is_vsmp_box())
2164 return 0;
2165
2166 bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid); 2149 bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
2167 bitmap_zero(clustermap, NUM_APIC_CLUSTERS); 2150 bitmap_zero(clustermap, NUM_APIC_CLUSTERS);
2168 2151
@@ -2198,18 +2181,67 @@ __cpuinit int apic_is_clustered_box(void)
2198 ++zeros; 2181 ++zeros;
2199 } 2182 }
2200 2183
2201 /* ScaleMP vSMPowered boxes have one cluster per board and TSCs are 2184 return clusters;
2202 * not guaranteed to be synced between boards 2185}
2203 */ 2186
2204 if (is_vsmp_box() && clusters > 1) 2187static int __cpuinitdata multi_checked;
2188static int __cpuinitdata multi;
2189
2190static int __cpuinit set_multi(const struct dmi_system_id *d)
2191{
2192 if (multi)
2193 return 0;
2194 printk(KERN_INFO "APIC: %s detected, Multi Chassis\n", d->ident);
2195 multi = 1;
2196 return 0;
2197}
2198
2199static const __cpuinitconst struct dmi_system_id multi_dmi_table[] = {
2200 {
2201 .callback = set_multi,
2202 .ident = "IBM System Summit2",
2203 .matches = {
2204 DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
2205 DMI_MATCH(DMI_PRODUCT_NAME, "Summit2"),
2206 },
2207 },
2208 {}
2209};
2210
2211static void __cpuinit dmi_check_multi(void)
2212{
2213 if (multi_checked)
2214 return;
2215
2216 dmi_check_system(multi_dmi_table);
2217 multi_checked = 1;
2218}
2219
2220/*
2221 * apic_is_clustered_box() -- Check if we can expect good TSC
2222 *
2223 * Thus far, the major user of this is IBM's Summit2 series:
2224 * Clustered boxes may have unsynced TSC problems if they are
2225 * multi-chassis.
2226 * Use DMI to check them
2227 */
2228__cpuinit int apic_is_clustered_box(void)
2229{
2230 dmi_check_multi();
2231 if (multi)
2205 return 1; 2232 return 1;
2206 2233
2234 if (!is_vsmp_box())
2235 return 0;
2236
2207 /* 2237 /*
2208 * If clusters > 2, then should be multi-chassis. 2238 * ScaleMP vSMPowered boxes have one cluster per board and TSCs are
2209 * May have to revisit this when multi-core + hyperthreaded CPUs come 2239 * not guaranteed to be synced between boards
2210 * out, but AFAIK this will work even for them.
2211 */ 2240 */
2212 return (clusters > 2); 2241 if (apic_cluster_num() > 1)
2242 return 1;
2243
2244 return 0;
2213} 2245}
2214#endif 2246#endif
2215 2247