x86/topology: Set x86_max_cores to 1 for CONFIG_SMP=n
authorThomas Gleixner <[email protected]>
Tue, 10 May 2016 07:20:33 +0000 (09:20 +0200)
committerThomas Gleixner <[email protected]>
Tue, 10 May 2016 07:28:31 +0000 (09:28 +0200)
Josef reported that the uncore driver trips over with CONFIG_SMP=n because
x86_max_cores is 16 instead of 12.

The reason is, that for SMP=n the extended topology detection is a NOOP and
the cache leaf is used to determine the number of cores. That's wrong in two
aspects:

1) The cache leaf enumerates the maximum addressable number of cores in the
   package, which is obviously not correct

2) UP has no business with topology bits at all.

Make intel_num_cpu_cores() return 1 for CONFIG_SMP=n

Reported-by: Josef Bacik <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: kernel-team <[email protected]>
Cc: Kan Liang <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
arch/x86/kernel/cpu/intel.c

index 1f7fdb91a818bc10d4b975a070d6b2c1a947b15b..e4393bfc7f0d9bb39520adceeae2968652779a5c 100644 (file)
@@ -336,7 +336,7 @@ static int intel_num_cpu_cores(struct cpuinfo_x86 *c)
 {
        unsigned int eax, ebx, ecx, edx;
 
-       if (c->cpuid_level < 4)
+       if (!IS_ENABLED(CONFIG_SMP) || c->cpuid_level < 4)
                return 1;
 
        /* Intel has a non-standard dependency on %ecx for this CPUID level. */