Skip to content

Commit 6df1e7f

Browse files
committed
Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpu changes from Ingo Molnar: "The biggest change that stands out is the increase of the CONFIG_NR_CPUS range from 4096 to 8192 - as real hardware out there already went beyond 4k CPUs ... We only allow more than 512 CPUs if offstack cpumasks are enabled. CONFIG_MAXSMP=y remains to be the 'you are nuts!' extreme testcase, which now means a max of 8192 CPUs" * 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/cpu: Increase max CPU count to 8192 x86/cpu: Allow higher NR_CPUS values x86/cpu: Always print SMP information in /proc/cpuinfo x86/cpu: Track legacy CPU model data only on 32-bit kernels
2 parents d96d8aa + b53b5ed commit 6df1e7f

8 files changed

Lines changed: 45 additions & 40 deletions

File tree

arch/x86/Kconfig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,14 +826,16 @@ config MAXSMP
826826
config NR_CPUS
827827
int "Maximum number of CPUs" if SMP && !MAXSMP
828828
range 2 8 if SMP && X86_32 && !X86_BIGSMP
829-
range 2 512 if SMP && !MAXSMP
829+
range 2 512 if SMP && !MAXSMP && !CPUMASK_OFFSTACK
830+
range 2 8192 if SMP && !MAXSMP && CPUMASK_OFFSTACK && X86_64
830831
default "1" if !SMP
831-
default "4096" if MAXSMP
832+
default "8192" if MAXSMP
832833
default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)
833834
default "8" if SMP
834835
---help---
835836
This allows you to specify the maximum number of CPUs which this
836-
kernel will support. The maximum supported value is 512 and the
837+
kernel will support. If CPUMASK_OFFSTACK is enabled, the maximum
838+
supported value is 4096, otherwise the maximum value is 512. The
837839
minimum value which makes sense is 2.
838840

839841
This is purely to save memory - each supported CPU adds

arch/x86/kernel/cpu/amd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,8 @@ static const struct cpu_dev amd_cpu_dev = {
823823
.c_vendor = "AMD",
824824
.c_ident = { "AuthenticAMD" },
825825
#ifdef CONFIG_X86_32
826-
.c_models = {
827-
{ .vendor = X86_VENDOR_AMD, .family = 4, .model_names =
826+
.legacy_models = {
827+
{ .family = 4, .model_names =
828828
{
829829
[3] = "486 DX/2",
830830
[7] = "486 DX/2-WB",
@@ -835,7 +835,7 @@ static const struct cpu_dev amd_cpu_dev = {
835835
}
836836
},
837837
},
838-
.c_size_cache = amd_size_cache,
838+
.legacy_cache_size = amd_size_cache,
839839
#endif
840840
.c_early_init = early_init_amd,
841841
.c_detect_tlb = cpu_detect_tlb_amd,

arch/x86/kernel/cpu/centaur.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,10 @@ static void init_centaur(struct cpuinfo_x86 *c)
468468
#endif
469469
}
470470

471+
#ifdef CONFIG_X86_32
471472
static unsigned int
472473
centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
473474
{
474-
#ifdef CONFIG_X86_32
475475
/* VIA C3 CPUs (670-68F) need further shifting. */
476476
if ((c->x86 == 6) && ((c->x86_model == 7) || (c->x86_model == 8)))
477477
size >>= 8;
@@ -484,16 +484,18 @@ centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
484484
if ((c->x86 == 6) && (c->x86_model == 9) &&
485485
(c->x86_mask == 1) && (size == 65))
486486
size -= 1;
487-
#endif
488487
return size;
489488
}
489+
#endif
490490

491491
static const struct cpu_dev centaur_cpu_dev = {
492492
.c_vendor = "Centaur",
493493
.c_ident = { "CentaurHauls" },
494494
.c_early_init = early_init_centaur,
495495
.c_init = init_centaur,
496-
.c_size_cache = centaur_size_cache,
496+
#ifdef CONFIG_X86_32
497+
.legacy_cache_size = centaur_size_cache,
498+
#endif
497499
.c_x86_vendor = X86_VENDOR_CENTAUR,
498500
};
499501

arch/x86/kernel/cpu/common.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,21 +346,23 @@ static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
346346
/* Look up CPU names by table lookup. */
347347
static const char *table_lookup_model(struct cpuinfo_x86 *c)
348348
{
349-
const struct cpu_model_info *info;
349+
#ifdef CONFIG_X86_32
350+
const struct legacy_cpu_model_info *info;
350351

351352
if (c->x86_model >= 16)
352353
return NULL; /* Range check */
353354

354355
if (!this_cpu)
355356
return NULL;
356357

357-
info = this_cpu->c_models;
358+
info = this_cpu->legacy_models;
358359

359-
while (info && info->family) {
360+
while (info->family) {
360361
if (info->family == c->x86)
361362
return info->model_names[c->x86_model];
362363
info++;
363364
}
365+
#endif
364366
return NULL; /* Not found */
365367
}
366368

@@ -450,8 +452,8 @@ void cpu_detect_cache_sizes(struct cpuinfo_x86 *c)
450452
c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff);
451453
#else
452454
/* do processor-specific cache resizing */
453-
if (this_cpu->c_size_cache)
454-
l2size = this_cpu->c_size_cache(c, l2size);
455+
if (this_cpu->legacy_cache_size)
456+
l2size = this_cpu->legacy_cache_size(c, l2size);
455457

456458
/* Allow user to override all this if necessary. */
457459
if (cachesize_override != -1)

arch/x86/kernel/cpu/cpu.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
#ifndef ARCH_X86_CPU_H
22
#define ARCH_X86_CPU_H
33

4-
struct cpu_model_info {
5-
int vendor;
6-
int family;
7-
const char *model_names[16];
8-
};
9-
104
/* attempt to consolidate cpu attributes */
115
struct cpu_dev {
126
const char *c_vendor;
137

148
/* some have two possibilities for cpuid string */
159
const char *c_ident[2];
1610

17-
struct cpu_model_info c_models[4];
18-
1911
void (*c_early_init)(struct cpuinfo_x86 *);
2012
void (*c_bsp_init)(struct cpuinfo_x86 *);
2113
void (*c_init)(struct cpuinfo_x86 *);
2214
void (*c_identify)(struct cpuinfo_x86 *);
2315
void (*c_detect_tlb)(struct cpuinfo_x86 *);
24-
unsigned int (*c_size_cache)(struct cpuinfo_x86 *, unsigned int);
2516
int c_x86_vendor;
17+
#ifdef CONFIG_X86_32
18+
/* Optional vendor specific routine to obtain the cache size. */
19+
unsigned int (*legacy_cache_size)(struct cpuinfo_x86 *,
20+
unsigned int);
21+
22+
/* Family/stepping-based lookup table for model names. */
23+
struct legacy_cpu_model_info {
24+
int family;
25+
const char *model_names[16];
26+
} legacy_models[5];
27+
#endif
2628
};
2729

2830
struct _tlb_table {

arch/x86/kernel/cpu/intel.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,8 @@ static const struct cpu_dev intel_cpu_dev = {
665665
.c_vendor = "Intel",
666666
.c_ident = { "GenuineIntel" },
667667
#ifdef CONFIG_X86_32
668-
.c_models = {
669-
{ .vendor = X86_VENDOR_INTEL, .family = 4, .model_names =
668+
.legacy_models = {
669+
{ .family = 4, .model_names =
670670
{
671671
[0] = "486 DX-25/33",
672672
[1] = "486 DX-50",
@@ -679,7 +679,7 @@ static const struct cpu_dev intel_cpu_dev = {
679679
[9] = "486 DX/4-WB"
680680
}
681681
},
682-
{ .vendor = X86_VENDOR_INTEL, .family = 5, .model_names =
682+
{ .family = 5, .model_names =
683683
{
684684
[0] = "Pentium 60/66 A-step",
685685
[1] = "Pentium 60/66",
@@ -690,7 +690,7 @@ static const struct cpu_dev intel_cpu_dev = {
690690
[8] = "Mobile Pentium MMX"
691691
}
692692
},
693-
{ .vendor = X86_VENDOR_INTEL, .family = 6, .model_names =
693+
{ .family = 6, .model_names =
694694
{
695695
[0] = "Pentium Pro A-step",
696696
[1] = "Pentium Pro",
@@ -704,7 +704,7 @@ static const struct cpu_dev intel_cpu_dev = {
704704
[11] = "Pentium III (Tualatin)",
705705
}
706706
},
707-
{ .vendor = X86_VENDOR_INTEL, .family = 15, .model_names =
707+
{ .family = 15, .model_names =
708708
{
709709
[0] = "Pentium 4 (Unknown)",
710710
[1] = "Pentium 4 (Willamette)",
@@ -714,7 +714,7 @@ static const struct cpu_dev intel_cpu_dev = {
714714
}
715715
},
716716
},
717-
.c_size_cache = intel_size_cache,
717+
.legacy_cache_size = intel_size_cache,
718718
#endif
719719
.c_detect_tlb = intel_detect_tlb,
720720
.c_early_init = early_init_intel,

arch/x86/kernel/cpu/proc.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c,
1111
unsigned int cpu)
1212
{
1313
#ifdef CONFIG_SMP
14-
if (c->x86_max_cores * smp_num_siblings > 1) {
15-
seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
16-
seq_printf(m, "siblings\t: %d\n",
17-
cpumask_weight(cpu_core_mask(cpu)));
18-
seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
19-
seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
20-
seq_printf(m, "apicid\t\t: %d\n", c->apicid);
21-
seq_printf(m, "initial apicid\t: %d\n", c->initial_apicid);
22-
}
14+
seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
15+
seq_printf(m, "siblings\t: %d\n", cpumask_weight(cpu_core_mask(cpu)));
16+
seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
17+
seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
18+
seq_printf(m, "apicid\t\t: %d\n", c->apicid);
19+
seq_printf(m, "initial apicid\t: %d\n", c->initial_apicid);
2320
#endif
2421
}
2522

arch/x86/kernel/cpu/umc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
static const struct cpu_dev umc_cpu_dev = {
1212
.c_vendor = "UMC",
1313
.c_ident = { "UMC UMC UMC" },
14-
.c_models = {
15-
{ .vendor = X86_VENDOR_UMC, .family = 4, .model_names =
14+
.legacy_models = {
15+
{ .family = 4, .model_names =
1616
{
1717
[1] = "U5D",
1818
[2] = "U5S",

0 commit comments

Comments
 (0)