x86/smp: Factor out parts of native_smp_prepare_cpus()
Commit66558b730f
("sched: Add cluster scheduler level for x86") introduced cpu_l2c_shared_map mask which is expected to be initialized by smp_op.smp_prepare_cpus(). That commit only updated native_smp_prepare_cpus() version but not xen_pv_smp_prepare_cpus(). As result Xen PV guests crash in set_cpu_sibling_map(). While the new mask can be allocated in xen_pv_smp_prepare_cpus() one can see that both versions of smp_prepare_cpus ops share a number of common operations that can be factored out. So do that instead. Fixes:66558b730f
("sched: Add cluster scheduler level for x86") Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lkml.kernel.org/r/1635896196-18961-1-git-send-email-boris.ostrovsky@oracle.com
This commit is contained in:
parent
debe436e77
commit
ce2612b670
@ -126,6 +126,7 @@ static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
|
|||||||
|
|
||||||
void cpu_disable_common(void);
|
void cpu_disable_common(void);
|
||||||
void native_smp_prepare_boot_cpu(void);
|
void native_smp_prepare_boot_cpu(void);
|
||||||
|
void smp_prepare_cpus_common(void);
|
||||||
void native_smp_prepare_cpus(unsigned int max_cpus);
|
void native_smp_prepare_cpus(unsigned int max_cpus);
|
||||||
void calculate_max_logical_packages(void);
|
void calculate_max_logical_packages(void);
|
||||||
void native_smp_cpus_done(unsigned int max_cpus);
|
void native_smp_cpus_done(unsigned int max_cpus);
|
||||||
|
@ -1350,12 +1350,7 @@ static void __init smp_get_logical_apicid(void)
|
|||||||
cpu0_logical_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
|
cpu0_logical_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void __init smp_prepare_cpus_common(void)
|
||||||
* Prepare for SMP bootup.
|
|
||||||
* @max_cpus: configured maximum number of CPUs, It is a legacy parameter
|
|
||||||
* for common interface support.
|
|
||||||
*/
|
|
||||||
void __init native_smp_prepare_cpus(unsigned int max_cpus)
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -1386,6 +1381,17 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
|
|||||||
set_sched_topology(x86_topology);
|
set_sched_topology(x86_topology);
|
||||||
|
|
||||||
set_cpu_sibling_map(0);
|
set_cpu_sibling_map(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prepare for SMP bootup.
|
||||||
|
* @max_cpus: configured maximum number of CPUs, It is a legacy parameter
|
||||||
|
* for common interface support.
|
||||||
|
*/
|
||||||
|
void __init native_smp_prepare_cpus(unsigned int max_cpus)
|
||||||
|
{
|
||||||
|
smp_prepare_cpus_common();
|
||||||
|
|
||||||
init_freq_invariance(false, false);
|
init_freq_invariance(false, false);
|
||||||
smp_sanity_check();
|
smp_sanity_check();
|
||||||
|
|
||||||
|
@ -225,7 +225,6 @@ static void __init xen_pv_smp_prepare_boot_cpu(void)
|
|||||||
static void __init xen_pv_smp_prepare_cpus(unsigned int max_cpus)
|
static void __init xen_pv_smp_prepare_cpus(unsigned int max_cpus)
|
||||||
{
|
{
|
||||||
unsigned cpu;
|
unsigned cpu;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if (skip_ioapic_setup) {
|
if (skip_ioapic_setup) {
|
||||||
char *m = (max_cpus == 0) ?
|
char *m = (max_cpus == 0) ?
|
||||||
@ -238,16 +237,9 @@ static void __init xen_pv_smp_prepare_cpus(unsigned int max_cpus)
|
|||||||
}
|
}
|
||||||
xen_init_lock_cpu(0);
|
xen_init_lock_cpu(0);
|
||||||
|
|
||||||
smp_store_boot_cpu_info();
|
smp_prepare_cpus_common();
|
||||||
cpu_data(0).x86_max_cores = 1;
|
|
||||||
|
|
||||||
for_each_possible_cpu(i) {
|
cpu_data(0).x86_max_cores = 1;
|
||||||
zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
|
|
||||||
zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
|
|
||||||
zalloc_cpumask_var(&per_cpu(cpu_die_map, i), GFP_KERNEL);
|
|
||||||
zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
|
|
||||||
}
|
|
||||||
set_cpu_sibling_map(0);
|
|
||||||
|
|
||||||
speculative_store_bypass_ht_init();
|
speculative_store_bypass_ht_init();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user