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);
146
146
extern unsigned int __max_dies_per_package ;
147
147
extern unsigned int __max_logical_packages ;
148
148
extern unsigned int __max_threads_per_core ;
149
+ extern unsigned int __num_threads_per_package ;
150
+ extern unsigned int __num_cores_per_package ;
149
151
150
152
static inline unsigned int topology_max_packages (void )
151
153
{
@@ -157,6 +159,16 @@ static inline unsigned int topology_max_dies_per_package(void)
157
159
return __max_dies_per_package ;
158
160
}
159
161
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
+
160
172
#ifdef CONFIG_X86_LOCAL_APIC
161
173
int topology_get_logical_id (u32 apicid , enum x86_topology_domains at_level );
162
174
#else
Original file line number Diff line number Diff line change @@ -82,6 +82,12 @@ EXPORT_SYMBOL(__max_dies_per_package);
82
82
unsigned int __max_logical_packages __ro_after_init = 1 ;
83
83
EXPORT_SYMBOL (__max_logical_packages );
84
84
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
+
85
91
static struct ppin_info {
86
92
int feature ;
87
93
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)
392
392
unsigned int disabled = topo_info .nr_disabled_cpus ;
393
393
unsigned int cnta , cntb , cpu , allowed = 1 ;
394
394
unsigned int total = assigned + disabled ;
395
- u32 apicid ;
395
+ u32 apicid , firstid ;
396
396
397
397
if (!restrict_to_up ()) {
398
398
if (WARN_ON_ONCE (assigned > nr_cpu_ids )) {
@@ -432,6 +432,12 @@ void __init topology_init_possible_cpus(void)
432
432
__max_threads_per_core = DIV_ROUND_UP (cntb , cnta );
433
433
pr_info ("Max. threads per core: %3u\n" , __max_threads_per_core );
434
434
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
+
435
441
pr_info ("Allowing %u present CPUs plus %u hotplug CPUs\n" , assigned , disabled );
436
442
if (topo_info .nr_rejected_cpus )
437
443
pr_info ("Rejected CPUs %u\n" , topo_info .nr_rejected_cpus );
You can’t perform that action at this time.
0 commit comments