Skip to contentSkip to conversation

x86/topology: Make __max_die_per_package available unconditionally

PATCH Applied Borislav Petkov 2 participants 2 messages Jan 14, 2021 x86

lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86/topology: Make __max_die_per_package available unconditionally

From: Borislav Petkov <[email protected]>

Move it outside of CONFIG_SMP in order to avoid ifdeffery at the usage sites.

Fixes 76e2fc63ca40 ("x86/cpu/amd: Set __max_die_per_package on AMD")
---
 arch/x86/include/asm/topology.h | 4 ++--
 arch/x86/kernel/cpu/topology.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/topology.h +2 -2
index 488a8e848754..9239399e5491 100644
@@ -110,6 +110,8 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
 #define topology_die_id(cpu)			(cpu_data(cpu).cpu_die_id)
 #define topology_core_id(cpu)			(cpu_data(cpu).cpu_core_id)
 
+extern unsigned int __max_die_per_package;
+
 #ifdef CONFIG_SMP
 #define topology_die_cpumask(cpu)		(per_cpu(cpu_die_map, cpu))
 #define topology_core_cpumask(cpu)		(per_cpu(cpu_core_map, cpu))
@@ -118,8 +120,6 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
 extern unsigned int __max_logical_packages;
 #define topology_max_packages()			(__max_logical_packages)
 
-extern unsigned int __max_die_per_package;
-
 static inline int topology_max_die_per_package(void)
 {
 	return __max_die_per_package;
arch/x86/kernel/cpu/topology.c +1 -1
index 1068002c8532..8678864ce712 100644
@@ -25,10 +25,10 @@
 #define BITS_SHIFT_NEXT_LEVEL(eax)	((eax) & 0x1f)
 #define LEVEL_MAX_SIBLINGS(ebx)		((ebx) & 0xffff)
 
-#ifdef CONFIG_SMP
 unsigned int __max_die_per_package __read_mostly = 1;
 EXPORT_SYMBOL(__max_die_per_package);
 
+#ifdef CONFIG_SMP
 /*
  * Check if given CPUID extended toplogy "leaf" is implemented
  */
Signature · 1 line
2.29.2
#1 lore raw
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     1eb8f690bcb565a6600f8b6dcc78f7b239ceba17
Gitweb:        https://git.kernel.org/tip/1eb8f690bcb565a6600f8b6dcc78f7b239ceba17
Author:        Borislav Petkov <[email protected]>
AuthorDate:    Thu, 14 Jan 2021 10:36:59 +01:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Thu, 14 Jan 2021 12:18:36 +01:00

x86/topology: Make __max_die_per_package available unconditionally

Move it outside of CONFIG_SMP in order to avoid ifdeffery at the usage sites.

Fixes 76e2fc63ca40 ("x86/cpu/amd: Set __max_die_per_package on AMD")
---
 arch/x86/include/asm/topology.h | 4 ++--
 arch/x86/kernel/cpu/topology.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/topology.h +2 -2
index 488a8e8..9239399 100644
@@ -110,6 +110,8 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
 #define topology_die_id(cpu)			(cpu_data(cpu).cpu_die_id)
 #define topology_core_id(cpu)			(cpu_data(cpu).cpu_core_id)
 
+extern unsigned int __max_die_per_package;
+
 #ifdef CONFIG_SMP
 #define topology_die_cpumask(cpu)		(per_cpu(cpu_die_map, cpu))
 #define topology_core_cpumask(cpu)		(per_cpu(cpu_core_map, cpu))
@@ -118,8 +120,6 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
 extern unsigned int __max_logical_packages;
 #define topology_max_packages()			(__max_logical_packages)
 
-extern unsigned int __max_die_per_package;
-
 static inline int topology_max_die_per_package(void)
 {
 	return __max_die_per_package;
arch/x86/kernel/cpu/topology.c +1 -1
index 1068002..8678864 100644
@@ -25,10 +25,10 @@
 #define BITS_SHIFT_NEXT_LEVEL(eax)	((eax) & 0x1f)
 #define LEVEL_MAX_SIBLINGS(ebx)		((ebx) & 0xffff)
 
-#ifdef CONFIG_SMP
 unsigned int __max_die_per_package __read_mostly = 1;
 EXPORT_SYMBOL(__max_die_per_package);
 
+#ifdef CONFIG_SMP
 /*
  * Check if given CPUID extended toplogy "leaf" is implemented
  */