]> git.dujemihanovic.xyz Git - linux.git/commitdiff
cpu/SMT: Remove topology_smt_supported()
authorLaurent Dufour <ldufour@linux.ibm.com>
Wed, 5 Jul 2023 14:51:38 +0000 (16:51 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 28 Jul 2023 07:53:37 +0000 (09:53 +0200)
Since the maximum number of threads is now passed to cpu_smt_set_num_threads(),
checking that value is enough to know whether SMT is supported.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20230705145143.40545-6-ldufour@linux.ibm.com
arch/x86/include/asm/topology.h
arch/x86/kernel/smpboot.c
kernel/cpu.c

index ae49ed4417d05d178253fb9abf0baae7f4468a84..3235ba1e5b06d77f4f40962ef44888e62d30988c 100644 (file)
@@ -141,7 +141,6 @@ static inline int topology_max_smt_threads(void)
 int topology_update_package_map(unsigned int apicid, unsigned int cpu);
 int topology_update_die_map(unsigned int dieid, unsigned int cpu);
 int topology_phys_to_logical_pkg(unsigned int pkg);
-bool topology_smt_supported(void);
 
 extern struct cpumask __cpu_primary_thread_mask;
 #define cpu_primary_thread_mask ((const struct cpumask *)&__cpu_primary_thread_mask)
@@ -164,7 +163,6 @@ static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
 static inline int topology_max_die_per_package(void) { return 1; }
 static inline int topology_max_smt_threads(void) { return 1; }
 static inline bool topology_is_primary_thread(unsigned int cpu) { return true; }
-static inline bool topology_smt_supported(void) { return false; }
 #endif /* !CONFIG_SMP */
 
 static inline void arch_fix_phys_package_id(int num, u32 slot)
index e1aa2cd7734ba40825f83ecfe01e25fd41b8e5a4..d4e897b820c416baeef7f0c02959069fdd7ed0d3 100644 (file)
@@ -326,14 +326,6 @@ static void notrace start_secondary(void *unused)
        cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
-/**
- * topology_smt_supported - Check whether SMT is supported by the CPUs
- */
-bool topology_smt_supported(void)
-{
-       return smp_num_siblings > 1;
-}
-
 /**
  * topology_phys_to_logical_pkg - Map a physical package id to a logical
  * @phys_pkg:  The physical package id to map
index d7dd535cb5b55fabb6aed15f2f49524792408db9..70add058e77bc0e46ae3004de5fd5fa8f9f898d8 100644 (file)
@@ -621,7 +621,7 @@ void __init cpu_smt_set_num_threads(unsigned int num_threads,
 {
        WARN_ON(!num_threads || (num_threads > max_threads));
 
-       if (!topology_smt_supported())
+       if (max_threads == 1)
                cpu_smt_control = CPU_SMT_NOT_SUPPORTED;
 
        cpu_smt_max_threads = max_threads;
@@ -1801,7 +1801,7 @@ early_param("cpuhp.parallel", parallel_bringup_parse_param);
 
 static inline bool cpuhp_smt_aware(void)
 {
-       return topology_smt_supported();
+       return cpu_smt_max_threads > 1;
 }
 
 static inline const struct cpumask *cpuhp_get_primary_thread_mask(void)