|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH 1/9] x86/boot: choose AP stack based on APIC ID
On 7.02.2024 17:11, Jan Beulich wrote:
AckOn 14.11.2023 18:49, Krystian Hebel wrote: + jnz .Lx2apic + + /* Not x2APIC, read from MMIO */ + mov 0xfee00020, %espPlease don't open-code existing constants (APIC_ID here and below, APIC_DEFAULT_PHYS_BASE just here, and ...+ shr $24, %esp Yes, this was also caught in review done by Qubes OS team. New constant and {G,S}ET_xAPIC_ID() should be in separate patch, I presume? Is either style preferred? This file has both.+ jmp 1f + +.Lx2apic: + mov $(MSR_X2APIC_FIRST + (0x20 >> 4)), %ecx + rdmsr + mov %eax, %esp +1:Overall I'm worried of the use of %esp throughout here. Fair question, no idea what I had in mind, will change.+ cmovz stack_start(%rip), %rsp + jz .L_stack_set + + /* APs only: get stack base from APIC ID saved in %esp. */ + mov $-1, %raxWhy a 64-bit insn here and ...+ lea x86_cpu_to_apicid(%rip), %rcx +1: + add $1, %rax... here, when you only use (far less than) 32-bit values? Looks like I am, I missed that. I'm not sure if this will still apply after+ cmp $NR_CPUS, %eax + jb 2f + hlt +2: + cmp %esp, (%rcx, %rax, 4) + jne 1bAren't you open-coding REPNE SCASD here? changes from further patches, but I'll keep that in mind. It really shouldn't be used anywhere, but I'll change it.+ /* %eax is now Xen CPU index. */ + lea stack_base(%rip), %rcx + mov (%rcx, %rax, 8), %rsp + + test %rsp,%rsp + jnz 1f + hlt +1: + add $(STACK_SIZE - CPUINFO_sizeof), %rspEven this post-adjustment is worrying me. Imo the stack pointer is better set exactly once, to its final value. Keeping it at its init value of 0 until then yields more predictable results in case it ends up being used somewhere.
The allocation in cpu_smpboot_alloc() was left for hot-plug. This
loops Best regards,Jan -- Krystian Hebel Firmware Engineer https://3mdeb.com | @3mdeb_com
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |