RE: [patch V3 00/60] x86/apic: Decrapification and static calls

From: Michael Kelley (LINUX)
Date: Wed Aug 02 2023 - 23:50:40 EST


From: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Sent: Tuesday, August 1, 2023 3:47 AM
>
> Hi!
>
> This is the follow up to:
>
>
> https://lore.kernel.org/lkml/20230724131206.500814398@xxxxxxxxxxxxx/
>
> which addresses the XEN PV fallout decoded by Juergen.
>
> TLDR: This cleans up accrued and partially unused gunk in order to convert
> the APIC callbacks to static calls.
>
> The changes vs. V2:
>
> - Unbreak XEN/PV - Juergen
>
> Resulting delta patch below.
>
> - Rebased to 6.5-rc4 in preparation for the CPUID overhaul on top, which
> has some collisions due to the recent mitigation muck.
>
> The series is also available from git:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git apic-static-call-v3
>
> Thanks,
>
> tglx
> ---
> diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c
> index 468406f511ff..7ad91225fdf4 100644
> --- a/arch/x86/xen/apic.c
> +++ b/arch/x86/xen/apic.c
> @@ -155,20 +155,9 @@ static struct apic xen_pv_apic __ro_after_init = {
> .icr_read = xen_apic_icr_read,
> .icr_write = xen_apic_icr_write,
> };
> -
> -static void __init xen_apic_check(void)
> -{
> - apic_install_driver(&xen_pv_apic);
> -}
> +apic_driver(xen_pv_apic);
>
> void __init xen_init_apic(void)
> {
> x86_apic_ops.io_apic_read = xen_io_apic_read;
> - /* On PV guests the APIC CPUID bit is disabled so none of the
> - * routines end up executing. */
> - if (!xen_initial_domain())
> - apic_install_driver(&xen_pv_apic);
> -
> - x86_platform.apic_post_init = xen_apic_check;
> }
> -apic_driver(xen_pv_apic);
> diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
> index 93b658248d01..c393c44892ac 100644
> --- a/arch/x86/xen/enlighten_pv.c
> +++ b/arch/x86/xen/enlighten_pv.c
> @@ -1326,7 +1326,7 @@ asmlinkage __visible void __init xen_start_kernel(struct
> start_info *si)
>
> x86_init.resources.memory_setup = xen_memory_setup;
> x86_init.irqs.intr_mode_select = x86_init_noop;
> - x86_init.irqs.intr_mode_init = x86_init_noop;
> + x86_init.irqs.intr_mode_init = x86_64_probe_apic;
> x86_init.oem.arch_setup = xen_arch_setup;
> x86_init.oem.banner = xen_banner;
> x86_init.hyper.init_platform = xen_pv_init_platform;
> @@ -1366,12 +1366,10 @@ asmlinkage __visible void __init xen_start_kernel(struct
> start_info *si)
>
> xen_init_capabilities();
>
> -#ifdef CONFIG_X86_LOCAL_APIC
> /*
> * set up the basic apic ops.
> */
> xen_init_apic();
> -#endif
>
> machine_ops = xen_machine_ops;
>
> diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c
> index c6b42c66c60c..a0f07bbfcd6e 100644
> --- a/arch/x86/xen/smp_pv.c
> +++ b/arch/x86/xen/smp_pv.c
> @@ -182,7 +182,8 @@ static void __init _get_smp_config(unsigned int early)
> if (subtract)
> set_nr_cpu_ids(nr_cpu_ids - subtract);
> #endif
> -
> + /* Pretend to be a proper enumerated system */
> + smp_found_config = 1;
> }
>
> static void __init xen_pv_smp_prepare_boot_cpu(void)
>

Entire series tested implicitly on Hyper-V guests as part of
testing the topology series with the scope described here:
https://lore.kernel.org/lkml/BYAPR21MB16884A9AE4AF581B0B1CDB25D708A@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#mf6ccf50e65e214cd6d8ba3e683873bf4139259a1

Tested-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>