File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ extern const struct cpumask *cpu_clustergroup_mask(int cpu);
146146extern unsigned int __max_dies_per_package ;
147147extern unsigned int __max_logical_packages ;
148148extern unsigned int __max_threads_per_core ;
149+ extern unsigned int __num_threads_per_package ;
150+ extern unsigned int __num_cores_per_package ;
149151
150152static inline unsigned int topology_max_packages (void )
151153{
@@ -157,6 +159,16 @@ static inline unsigned int topology_max_dies_per_package(void)
157159 return __max_dies_per_package ;
158160}
159161
162+ static inline unsigned int topology_num_cores_per_package (void )
163+ {
164+ return __num_cores_per_package ;
165+ }
166+
167+ static inline unsigned int topology_num_threads_per_package (void )
168+ {
169+ return __num_threads_per_package ;
170+ }
171+
160172#ifdef CONFIG_X86_LOCAL_APIC
161173int topology_get_logical_id (u32 apicid , enum x86_topology_domains at_level );
162174#else
Original file line number Diff line number Diff line change @@ -82,6 +82,12 @@ EXPORT_SYMBOL(__max_dies_per_package);
8282unsigned int __max_logical_packages __ro_after_init = 1 ;
8383EXPORT_SYMBOL (__max_logical_packages );
8484
85+ unsigned int __num_cores_per_package __ro_after_init = 1 ;
86+ EXPORT_SYMBOL (__num_cores_per_package );
87+
88+ unsigned int __num_threads_per_package __ro_after_init = 1 ;
89+ EXPORT_SYMBOL (__num_threads_per_package );
90+
8591static struct ppin_info {
8692 int feature ;
8793 int msr_ppin_ctl ;
Original file line number Diff line number Diff line change @@ -392,7 +392,7 @@ void __init topology_init_possible_cpus(void)
392392 unsigned int disabled = topo_info .nr_disabled_cpus ;
393393 unsigned int cnta , cntb , cpu , allowed = 1 ;
394394 unsigned int total = assigned + disabled ;
395- u32 apicid ;
395+ u32 apicid , firstid ;
396396
397397 if (!restrict_to_up ()) {
398398 if (WARN_ON_ONCE (assigned > nr_cpu_ids )) {
@@ -432,6 +432,12 @@ void __init topology_init_possible_cpus(void)
432432 __max_threads_per_core = DIV_ROUND_UP (cntb , cnta );
433433 pr_info ("Max. threads per core: %3u\n" , __max_threads_per_core );
434434
435+ firstid = find_first_bit (apic_maps [TOPO_SMT_DOMAIN ].map , MAX_LOCAL_APIC );
436+ __num_cores_per_package = topology_unit_count (firstid , TOPO_CORE_DOMAIN , TOPO_PKG_DOMAIN );
437+ pr_info ("Num. cores per package: %3u\n" , __num_cores_per_package );
438+ __num_threads_per_package = topology_unit_count (firstid , TOPO_SMT_DOMAIN , TOPO_PKG_DOMAIN );
439+ pr_info ("Num. threads per package: %3u\n" , __num_threads_per_package );
440+
435441 pr_info ("Allowing %u present CPUs plus %u hotplug CPUs\n" , assigned , disabled );
436442 if (topo_info .nr_rejected_cpus )
437443 pr_info ("Rejected CPUs %u\n" , topo_info .nr_rejected_cpus );
You can’t perform that action at this time.
0 commit comments