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

[PATCH v2 4/6] x86/APIC: drop probe_default()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 5 Nov 2021 13:34:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; 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=eRkmeCDY9qmOnl/LgdTXyOV/AKSNeWTq/aTjmmt073o=; b=KfU1I9KEEihNtulQuXPDwfjE2CYQf3caDD7gtsAVMnXQZ729Pr5WuydNGaXnBYrRnnEekXfELpCY01uoC4Ac/MMqNe4UDHVZ6iAgIpBVdD1CAjAnHCjRY2JScFRT3eTGxXHZmJnwvrVFr1mttTSRCozCHLj2rw8vgGWj4piO4ic6HOXR/FL3tdHUbGPs0kpjAFPxBwiAlGmzKdr4IRD+3QCP4tpiZ7V5YQqEBk9KJdH54OPwZKkBvG1kWEnUj391cwynqPMyT7JAH/eZ41+i4ZQrJJ3kHob+tC6JO8XmNJk0E2n2CTLvNd1PKL+ESwBU8bybA/+BxHMB5XEr069A/g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hLYriAh8JmamKWYSHB8x6DaO9zEd2sXtCa1j/cErARPRS9i1MIL1KOyWzIHWLgwhGLll4mwUPSBdHfer0vWL87mYifkd6ypdMmObMtyQIXAAtZKFhopGBG5iNI9+aDOD4m9rU6UqF6JcXzCgQZDfuUhNdpb0NqLTBLdK/3BX3zL5lKUbXv5T1du1k8A2J1bikJ6iWccekJpwYgrQ4bLvX3uxNDZDwa98DXn7Ej332JXeZDoi0YsxBbIFg7CYNwYjiDXHwxs7rPd1pE2ceT/4wrNonjXT5tNTzQZCplU7VrCO1narfUudz09WeAYHNcU59C2VtmnTACNP7EiZ9xjZ2w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 05 Nov 2021 12:35:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The function does nothing but return success. Simply treat absence of a
probe hook to mean just this. This then eliminates the (purely
theoretical at this point) risk of trying to call through
apic_x2apic_{cluster,phys}'s respective NULL pointers.

While doing this also eliminate generic_apic_probe()'s "changed"
variable: apic_probe[]'s default entry will now be used unconditionally
in yet more obvious a way, such that separately setting genapic from
apic_default is (hopefully) no longer justified. Yet that was the main
purpose of the variable.

To help prove that apic_default's probe() hook doesn't get used
elsewhere, further make apic_probe[] static at this occasion.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: New.

--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -14,12 +14,7 @@
 #include <asm/io_apic.h>
 
 /* should be called last. */
-static __init int probe_default(void)
-{ 
-       return 1;
-} 
-
 const struct genapic __initconstrel apic_default = {
-       APIC_INIT("default", probe_default),
+       APIC_INIT("default", NULL),
        GENAPIC_FLAT
 };
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -18,7 +18,7 @@
 
 struct genapic __read_mostly genapic;
 
-const struct genapic *const __initconstrel apic_probe[] = {
+static const struct genapic *const __initconstrel apic_probe[] = {
        &apic_bigsmp, 
        &apic_default,  /* must be last */
        NULL,
@@ -59,22 +59,20 @@ custom_param("apic", genapic_apic_force)
 
 void __init generic_apic_probe(void) 
 { 
-       bool changed;
        int i;
 
        record_boot_APIC_mode();
 
        check_x2apic_preenabled();
-       cmdline_apic = changed = !!genapic.name;
 
-       for (i = 0; !changed && apic_probe[i]; i++) { 
-               if (apic_probe[i]->probe()) {
-                       changed = 1;
+       cmdline_apic = genapic.name;
+
+       for (i = 0; !genapic.name && apic_probe[i]; i++) {
+               if (!apic_probe[i]->probe || apic_probe[i]->probe())
                        genapic = *apic_probe[i];
-               } 
        }
-       if (!changed) 
-               genapic = apic_default;
+
+       BUG_ON(!genapic.name);
 
        printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
 } 




 


Rackspace

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