Skip to content

Commit 63e708f

Browse files
praritjgross1
authored andcommitted
x86/xen: Calculate __max_logical_packages on PV domains
The kernel panics on PV domains because native_smp_cpus_done() is only called for HVM domains. Calculate __max_logical_packages for PV domains. Fixes: b4c0a73 ("x86/smpboot: Fix __max_logical_packages estimate") Signed-off-by: Prarit Bhargava <[email protected]> Tested-and-reported-by: Simon Gaiser <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: [email protected] Cc: Boris Ostrovsky <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Dou Liyang <[email protected]> Cc: Prarit Bhargava <[email protected]> Cc: Kate Stewart <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Vitaly Kuznetsov <[email protected]> Cc: [email protected] Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 29fee6e commit 63e708f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

arch/x86/include/asm/smp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
129129
void cpu_disable_common(void);
130130
void native_smp_prepare_boot_cpu(void);
131131
void native_smp_prepare_cpus(unsigned int max_cpus);
132+
void calculate_max_logical_packages(void);
132133
void native_smp_cpus_done(unsigned int max_cpus);
133134
void common_cpu_up(unsigned int cpunum, struct task_struct *tidle);
134135
int native_cpu_up(unsigned int cpunum, struct task_struct *tidle);

arch/x86/kernel/smpboot.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,18 +1281,24 @@ void __init native_smp_prepare_boot_cpu(void)
12811281
cpu_set_state_online(me);
12821282
}
12831283

1284-
void __init native_smp_cpus_done(unsigned int max_cpus)
1284+
void __init calculate_max_logical_packages(void)
12851285
{
12861286
int ncpus;
12871287

1288-
pr_debug("Boot done\n");
12891288
/*
12901289
* Today neither Intel nor AMD support heterogenous systems so
12911290
* extrapolate the boot cpu's data to all packages.
12921291
*/
12931292
ncpus = cpu_data(0).booted_cores * topology_max_smt_threads();
12941293
__max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus);
12951294
pr_info("Max logical packages: %u\n", __max_logical_packages);
1295+
}
1296+
1297+
void __init native_smp_cpus_done(unsigned int max_cpus)
1298+
{
1299+
pr_debug("Boot done\n");
1300+
1301+
calculate_max_logical_packages();
12961302

12971303
if (x86_has_numa_in_package)
12981304
set_sched_topology(x86_numa_in_package_topology);

arch/x86/xen/smp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ void __init xen_smp_cpus_done(unsigned int max_cpus)
122122

123123
if (xen_hvm_domain())
124124
native_smp_cpus_done(max_cpus);
125+
else
126+
calculate_max_logical_packages();
125127

126128
if (xen_have_vcpu_info_placement)
127129
return;

0 commit comments

Comments
 (0)