On Thu, Feb 02 2023 at 21:56, Usama Arif wrote: > From: Thomas Gleixner <tglx@xxxxxxxxxxxxx> > > To allow for parallel AP bringup, we need to avoid the use of global > variables for passing information to the APs, as well as preventing them > from all trying to use the same real-mode stack simultaneously. > > So, introduce a 'lock' field in struct trampoline_header to use as a > simple bit-spinlock for the real-mode stack. That lock also protects > the global variables initial_gs, initial_stack and early_gdt_descr, > which can now be calculated... > > So how do we calculate those addresses? Well, they they can all be found > from the per_cpu data for this CPU. Simples! Except... how does it know > what its CPU# is? OK, we export the cpuid_to_apicid[] array and it can > search it to find its APIC ID in there. > > But now you whine at me that it doesn't even know its APIC ID? Well, if > it's a relatively modern CPU then the APIC ID is in CPUID leaf 0x0B so > we can use that. Otherwise... erm... OK, otherwise it can't have parallel > CPU bringup for now. We'll still use a global variable for those CPUs and > bring them up one at a time. > > So add a global 'smpboot_control' field which either contains the APIC > ID, or a flag indicating that it can be found in CPUID. > > This adds the 'do_parallel_bringup' flag in preparation but doesn't > actually enable parallel bringup yet. > > [ dwmw2: Minor tweaks, write a commit message ] > [ seanc: Fix stray override of initial_gs in common_cpu_up() ] > Not-signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> I'm happy to add my SOB if someone actually writes a coherent changelog which complies with the documented rules :)