Skip to content

Commit e25a8d9

Browse files
jbeulichjgross1
authored andcommitted
x86/Xen: streamline (and fix) PV CPU enumeration
This started out with me noticing that "dom0_max_vcpus=<N>" with <N> larger than the number of physical CPUs reported through ACPI tables would not bring up the "excess" vCPU-s. Addressing this is the primary purpose of the change; CPU maps handling is being tidied only as far as is necessary for the change here (with the effect of also avoiding the setting up of too much per-CPU infrastructure, i.e. for CPUs which can never come online). Noticing that xen_fill_possible_map() is called way too early, whereas xen_filter_cpu_maps() is called too late (after per-CPU areas were already set up), and further observing that each of the functions serves only one of Dom0 or DomU, it looked like it was better to simplify this. Use the .get_smp_config hook instead, uniformly for Dom0 and DomU. xen_fill_possible_map() can be dropped altogether, while xen_filter_cpu_maps() is re-purposed but not otherwise changed. Signed-off-by: Jan Beulich <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Juergen Gross <[email protected]>
1 parent 3ccb312 commit e25a8d9

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

arch/x86/xen/enlighten_pv.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,10 +1341,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
13411341

13421342
xen_acpi_sleep_register();
13431343

1344-
/* Avoid searching for BIOS MP tables */
1345-
x86_init.mpparse.find_smp_config = x86_init_noop;
1346-
x86_init.mpparse.get_smp_config = x86_init_uint_noop;
1347-
13481344
xen_boot_params_init_edd();
13491345

13501346
#ifdef CONFIG_ACPI

arch/x86/xen/smp_pv.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -148,28 +148,12 @@ int xen_smp_intr_init_pv(unsigned int cpu)
148148
return rc;
149149
}
150150

151-
static void __init xen_fill_possible_map(void)
152-
{
153-
int i, rc;
154-
155-
if (xen_initial_domain())
156-
return;
157-
158-
for (i = 0; i < nr_cpu_ids; i++) {
159-
rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
160-
if (rc >= 0) {
161-
num_processors++;
162-
set_cpu_possible(i, true);
163-
}
164-
}
165-
}
166-
167-
static void __init xen_filter_cpu_maps(void)
151+
static void __init _get_smp_config(unsigned int early)
168152
{
169153
int i, rc;
170154
unsigned int subtract = 0;
171155

172-
if (!xen_initial_domain())
156+
if (early)
173157
return;
174158

175159
num_processors = 0;
@@ -210,7 +194,6 @@ static void __init xen_pv_smp_prepare_boot_cpu(void)
210194
* sure the old memory can be recycled. */
211195
make_lowmem_page_readwrite(xen_initial_gdt);
212196

213-
xen_filter_cpu_maps();
214197
xen_setup_vcpu_info_placement();
215198

216199
/*
@@ -476,5 +459,8 @@ static const struct smp_ops xen_smp_ops __initconst = {
476459
void __init xen_smp_init(void)
477460
{
478461
smp_ops = xen_smp_ops;
479-
xen_fill_possible_map();
462+
463+
/* Avoid searching for BIOS MP tables */
464+
x86_init.mpparse.find_smp_config = x86_init_noop;
465+
x86_init.mpparse.get_smp_config = _get_smp_config;
480466
}

0 commit comments

Comments
 (0)