lkml.org 
[lkml]   [2023]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[patch 50/53] x86/cpu/topology: Rename smp_num_siblings
    Date
    It's really a non-intuitive name. Rename it to __max_threads_per_core which
    is obvious.

    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    ---
    arch/x86/include/asm/smp.h | 2 --
    arch/x86/include/asm/topology.h | 6 +++++-
    arch/x86/kernel/cpu/common.c | 4 ++--
    arch/x86/kernel/cpu/debugfs.c | 2 +-
    arch/x86/kernel/cpu/mce/inject.c | 2 +-
    arch/x86/kernel/cpu/topology.c | 6 +++---
    arch/x86/kernel/smpboot.c | 8 --------
    7 files changed, 12 insertions(+), 18 deletions(-)

    --- a/arch/x86/include/asm/smp.h
    +++ b/arch/x86/include/asm/smp.h
    @@ -8,8 +8,6 @@
    #include <asm/current.h>
    #include <asm/thread_info.h>

    -extern unsigned int smp_num_siblings;
    -
    DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
    DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_map);
    DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_die_map);
    --- a/arch/x86/include/asm/topology.h
    +++ b/arch/x86/include/asm/topology.h
    @@ -145,6 +145,7 @@ extern const struct cpumask *cpu_cluster

    extern unsigned int __max_dies_per_package;
    extern unsigned int __max_logical_packages;
    +extern unsigned int __max_threads_per_core;

    static inline unsigned int topology_max_packages(void)
    {
    @@ -178,7 +179,10 @@ static inline int topology_max_smt_threa
    return __max_smt_threads;
    }

    -bool topology_smt_supported(void);
    +static inline bool topology_smt_supported(void)
    +{
    + return __max_threads_per_core > 1;
    +}

    extern unsigned int __amd_nodes_per_pkg;

    --- a/arch/x86/kernel/cpu/common.c
    +++ b/arch/x86/kernel/cpu/common.c
    @@ -72,8 +72,8 @@
    u32 elf_hwcap2 __read_mostly;

    /* Number of siblings per CPU package */
    -unsigned int smp_num_siblings __ro_after_init = 1;
    -EXPORT_SYMBOL(smp_num_siblings);
    +unsigned int __max_threads_per_core __ro_after_init = 1;
    +EXPORT_SYMBOL(__max_threads_per_core);

    unsigned int __max_dies_per_package __ro_after_init = 1;
    EXPORT_SYMBOL(__max_dies_per_package);
    --- a/arch/x86/kernel/cpu/debugfs.c
    +++ b/arch/x86/kernel/cpu/debugfs.c
    @@ -30,7 +30,7 @@ static int cpu_debug_show(struct seq_fil
    seq_printf(m, "amd_nodes_per_pkg: %u\n", topology_amd_nodes_per_pkg());
    seq_printf(m, "max_cores: %u\n", c->x86_max_cores);
    seq_printf(m, "max_dies_per_pkg: %u\n", __max_dies_per_package);
    - seq_printf(m, "smp_num_siblings: %u\n", smp_num_siblings);
    + seq_printf(m, "max_threads_per_core:%u\n", __max_threads_per_core);
    return 0;
    }

    --- a/arch/x86/kernel/cpu/mce/inject.c
    +++ b/arch/x86/kernel/cpu/mce/inject.c
    @@ -433,7 +433,7 @@ static u32 get_nbc_for_node(int node_id)
    struct cpuinfo_x86 *c = &boot_cpu_data;
    u32 cores_per_node;

    - cores_per_node = (c->x86_max_cores * smp_num_siblings) / topology_amd_nodes_per_pkg();
    + cores_per_node = (c->x86_max_cores * __max_threads_per_core) / topology_amd_nodes_per_pkg();
    return cores_per_node * node_id;
    }

    --- a/arch/x86/kernel/cpu/topology.c
    +++ b/arch/x86/kernel/cpu/topology.c
    @@ -86,7 +86,7 @@ bool arch_match_cpu_phys_id(int cpu, u64
    #ifdef CONFIG_SMP
    static void cpu_mark_primary_thread(unsigned int cpu, unsigned int apicid)
    {
    - if (!(apicid & (smp_num_siblings - 1)))
    + if (!(apicid & (__max_threads_per_core - 1)))
    cpumask_set_cpu(cpu, &__cpu_primary_thread_mask);
    }
    #else
    @@ -427,8 +427,8 @@ void __init topology_init_possible_cpus(

    cnta = domain_weight(TOPO_CORE_DOMAIN);
    cntb = domain_weight(TOPO_SMT_DOMAIN);
    - smp_num_siblings = 1U << (get_count_order(cntb) - get_count_order(cnta));
    - pr_info("Max. threads per core: %3u\n", smp_num_siblings);
    + __max_threads_per_core = 1U << (get_count_order(cntb) - get_count_order(cnta));
    + pr_info("Max. threads per core: %3u\n", __max_threads_per_core);

    pr_info("Allowing %u present CPUs plus %u hotplug CPUs\n", assigned, disabled);
    if (topo_info.nr_rejected_cpus)
    --- a/arch/x86/kernel/smpboot.c
    +++ b/arch/x86/kernel/smpboot.c
    @@ -320,14 +320,6 @@ static void notrace start_secondary(void
    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;
    -}
    -
    void __init smp_store_boot_cpu_info(void)
    {
    struct cpuinfo_x86 *c = &cpu_data(0);
    \
     
     \ /
      Last update: 2023-08-07 15:57    [W:2.293 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site