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

[xen master] x86/APIC: drop probe_default()



commit 0ee901ce4b439ef5a44bf6ac7471e75a20dffbbe
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Nov 5 13:34:57 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/APIC: drop probe_default()
    
    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>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/genapic/default.c |  7 +------
 xen/arch/x86/genapic/probe.c   | 16 +++++++---------
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c
index bfd068cdc6..2c63c1f917 100644
--- 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
 };
diff --git a/xen/arch/x86/genapic/probe.c b/xen/arch/x86/genapic/probe.c
index b963dc5ec0..1ee6cd73cd 100644
--- 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);
 } 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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