On Wed, 2023-02-08 at 14:13 +0100, Thomas Gleixner wrote: > On Wed, Feb 08 2023 at 00:09, Brian Gerst wrote: > > On Tue, Feb 7, 2023 at 6:10 PM Usama Arif <usama.arif@xxxxxxxxxxxxx> wrote: > > > Introduce a global variable 'smpboot_control' indicating to the AP how > > > it should find its APIC ID. For a serialized bringup, the APIC ID is > > > explicitly passed in the low bits of smpboot_control, while for parallel > > > mode there are flags directing the AP to find its APIC ID in CPUID leaf > > > 0x0b (for X2APIC mode) or CPUID leaf 0x01 where 8 bits are sufficient. > > > > For the serialized bringup case, it would be simpler to just put the > > cpu number in the lower bits instead of the APIC id, skipping the > > lookup. > > Yes and no. It can be done, but I rather prefer the consistency of the > data and the mechanism. The "overhead" or "win" is not even measurable. Yeah. I might do this much though, just to track CPU# simply in %ecx: --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -285,17 +285,15 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL) leaq cpuid_to_apicid(%rip), %rbx .Lfind_cpunr: - cmpl (%rbx), %edx + cmpl (%rbx,%rcx,4), %edx jz .Linit_cpu_data - addq $4, %rbx - addq $8, %rcx + inc %rcx jmp .Lfind_cpunr .Linit_cpu_data: - /* Get the per cpu offset */ + /* Get the per cpu offset for the given CPU# which is in ECX */ leaq __per_cpu_offset(%rip), %rbx - addq %rcx, %rbx - movq (%rbx), %rbx + movq (%rbx,%rcx,8), %rbx /* Save it for GS BASE setup */ movq %rbx, initial_gs(%rip)
Attachment:
smime.p7s
Description: S/MIME cryptographic signature