[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/Xen: streamline (and fix) PV CPU enumeration


  • To: Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 1 Feb 2022 11:57:16 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pY8BM5zZYdZJ+CGLGhbRBx4Ul0yoDcBNt29Q1qqtf54=; b=Y24cK6Ic0mAo3+eqh4RppKxJUHWl8mvF1IX1Fe/rKFhZjIDFuL6DACG/MYZsCMRQFlQkqgn1w6CHQLYrImozlyelIJgq+e06/Fl93Uu37cSI5ZarcPsRpdBmk5ox0zq6oeeLj8RFSc47JY2yYX0hGPi4Azg6TkPUSZORVcJ551CWRtZYw9NCgguHZARqDDJ/sqvffhhxb5MBB0cgv3HR4QiTaYCJWynzZ1QshaMgqzKemwzEgq0mO831SGehSiSHEv4f+Bbek9shdYS3yWn2597k3pQJcAJ/F9wJmyA6KcLGVHNNcPV33/93UuHZPO1DbZRZuhqrgQMsmEg/aMfiDw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FJJrymzbkByTFbQi7oShfGULSsSWs7h+3bxq0VUCNSSSpTTcRw/HGaIyE72TRtjI3zBwLKAAFX0xWGVTqSocDFwhRR0rOr9Rz23/WOEHcKTgbYXIRsBvf0W8DuyA77P0sLj/bTV2hu+vtxQ0gkNlkY1s5kG8X+mP3ZOpV2Fb0kd4XBd/8wRJVLFjJdjmt3x5u2MIusV2itn3WBEWVwLs9xe5N60YErq2DcZY1Wp33888RxV4ZYMyU3OWeVTgL6F6Msj7RImIbPhbvRnrJ7EHx+AJnWYgUmQzAlmEFbPZgILwJwJaE6UNzFKA73f1uaK/kLCUYlMWeUSp/qllfLZJSA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 01 Feb 2022 10:57:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <jbeulich@xxxxxxxx>
---
v2: Extend description.

--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1341,10 +1341,6 @@ asmlinkage __visible void __init xen_sta
 
                xen_acpi_sleep_register();
 
-               /* Avoid searching for BIOS MP tables */
-               x86_init.mpparse.find_smp_config = x86_init_noop;
-               x86_init.mpparse.get_smp_config = x86_init_uint_noop;
-
                xen_boot_params_init_edd();
 
 #ifdef CONFIG_ACPI
--- a/arch/x86/xen/smp_pv.c
+++ b/arch/x86/xen/smp_pv.c
@@ -148,28 +148,12 @@ int xen_smp_intr_init_pv(unsigned int cp
        return rc;
 }
 
-static void __init xen_fill_possible_map(void)
-{
-       int i, rc;
-
-       if (xen_initial_domain())
-               return;
-
-       for (i = 0; i < nr_cpu_ids; i++) {
-               rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
-               if (rc >= 0) {
-                       num_processors++;
-                       set_cpu_possible(i, true);
-               }
-       }
-}
-
-static void __init xen_filter_cpu_maps(void)
+static void __init _get_smp_config(unsigned int early)
 {
        int i, rc;
        unsigned int subtract = 0;
 
-       if (!xen_initial_domain())
+       if (early)
                return;
 
        num_processors = 0;
@@ -210,7 +194,6 @@ static void __init xen_pv_smp_prepare_bo
                 * sure the old memory can be recycled. */
                make_lowmem_page_readwrite(xen_initial_gdt);
 
-       xen_filter_cpu_maps();
        xen_setup_vcpu_info_placement();
 
        /*
@@ -476,5 +459,8 @@ static const struct smp_ops xen_smp_ops
 void __init xen_smp_init(void)
 {
        smp_ops = xen_smp_ops;
-       xen_fill_possible_map();
+
+       /* Avoid searching for BIOS MP tables */
+       x86_init.mpparse.find_smp_config = x86_init_noop;
+       x86_init.mpparse.get_smp_config = _get_smp_config;
 }




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.