Misc fixes:
- Fix a secondary CPUs enumeration regression caused by creative MADT APIC table entries on certain systems. - Fix a race in the NOP-patcher that can spuriously trigger crashes on bootup. - Fix a bootup failure regression caused by the parallel bringup code, caused by firmware inconsistency between the APIC initialization states of the boot and secondary CPUs, on certain systems. Signed-off-by: Ingo Molnar <mingo@kernel.org> -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmWG704RHG1pbmdvQGtl cm5lbC5vcmcACgkQEnMQ0APhK1j52w/+IfvoA9zX6+qsl0lIU76FsD50szR7C8IR 4DsN68BbjI6sUNN/RWrjTY249UCbl8ykL8ozaek+eBaCXcTXIoGh96oPnojY/8vA HTYCgilmCvwNozawkjAeWedwbxdcafTr7l1bad5Y6LyYJv7BNUnsELq67bIQoOwK QGtnjDnTojVBoGy920KgZZ0zkqM05zWQ24MvM0Pn8T9lC2TokqCrbY4T8ags1AW0 j+swsd34ON+jKM0tXqQdBgxbb4TRW05Yg2PC9hLMxtXRXsYFfXW8udS0E83JpWD8 XL4z34IQqRuuiCqVboeBsP2gta4/oEM+ctbTXbmYs/ca7euZ7mnrUDcDVG2qyKyP F4hGgySyRv5wHx1IdTDIjozhsK+oYPLpqj87bBNr5N/aZImlKYTkICFt6EFhxrZn aoQCdE3ba4EoQqes05aVAvNABAt2ml1UNMyz4uu83diJG7aszVY0WOz4laX4edof L4EBpl2RrWqWwr7CnkrMhHfAcYVKv6k50/MK4ZrQrm1Xqgw6fbtvyxp72iw+ktJk XXnlDU6Ngc+F4dBXNY1Wr1q5kB4eYWy9DgmpHC56H6QPWTCV/Vk9wayeSXBrpoXa w5E91MKj9Oo68QbtmczbvlTmjKgWsWKGNvHHFF2ItmF2Tc/8BKFazNNZ+wzjsRl+ oJnjZILBHfI= =V+LX -----END PGP SIGNATURE----- Merge tag 'x86-urgent-2023-12-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 fixes from Ingo Molnar: - Fix a secondary CPUs enumeration regression caused by creative MADT APIC table entries on certain systems. - Fix a race in the NOP-patcher that can spuriously trigger crashes on bootup. - Fix a bootup failure regression caused by the parallel bringup code, caused by firmware inconsistency between the APIC initialization states of the boot and secondary CPUs, on certain systems. * tag 'x86-urgent-2023-12-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/acpi: Handle bogus MADT APIC tables gracefully x86/alternatives: Disable interrupts and sync when optimizing NOPs in place x86/alternatives: Sync core before enabling interrupts x86/smpboot/64: Handle X2APIC BIOS inconsistency gracefully
This commit is contained in:
commit
3f82f1c3a0
arch/x86/kernel
@ -293,6 +293,7 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end)
|
||||
processor->processor_id, /* ACPI ID */
|
||||
processor->lapic_flags & ACPI_MADT_ENABLED);
|
||||
|
||||
has_lapic_cpus = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1134,7 +1135,6 @@ static int __init acpi_parse_madt_lapic_entries(void)
|
||||
if (!count) {
|
||||
count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
|
||||
acpi_parse_lapic, MAX_LOCAL_APIC);
|
||||
has_lapic_cpus = count > 0;
|
||||
x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
|
||||
acpi_parse_x2apic, MAX_LOCAL_APIC);
|
||||
}
|
||||
|
@ -255,6 +255,16 @@ static void __init_or_module noinline optimize_nops(u8 *instr, size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
static void __init_or_module noinline optimize_nops_inplace(u8 *instr, size_t len)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
local_irq_save(flags);
|
||||
optimize_nops(instr, len);
|
||||
sync_core();
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* In this context, "source" is where the instructions are placed in the
|
||||
* section .altinstr_replacement, for example during kernel build by the
|
||||
@ -438,7 +448,7 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
|
||||
* patch if feature is *NOT* present.
|
||||
*/
|
||||
if (!boot_cpu_has(a->cpuid) == !(a->flags & ALT_FLAG_NOT)) {
|
||||
optimize_nops(instr, a->instrlen);
|
||||
optimize_nops_inplace(instr, a->instrlen);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1685,8 +1695,8 @@ void __init_or_module text_poke_early(void *addr, const void *opcode,
|
||||
} else {
|
||||
local_irq_save(flags);
|
||||
memcpy(addr, opcode, len);
|
||||
local_irq_restore(flags);
|
||||
sync_core();
|
||||
local_irq_restore(flags);
|
||||
|
||||
/*
|
||||
* Could also do a CLFLUSH here to speed up CPU recovery; but
|
||||
|
@ -255,6 +255,22 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
|
||||
testl $X2APIC_ENABLE, %eax
|
||||
jnz .Lread_apicid_msr
|
||||
|
||||
#ifdef CONFIG_X86_X2APIC
|
||||
/*
|
||||
* If system is in X2APIC mode then MMIO base might not be
|
||||
* mapped causing the MMIO read below to fault. Faults can't
|
||||
* be handled at that point.
|
||||
*/
|
||||
cmpl $0, x2apic_mode(%rip)
|
||||
jz .Lread_apicid_mmio
|
||||
|
||||
/* Force the AP into X2APIC mode. */
|
||||
orl $X2APIC_ENABLE, %eax
|
||||
wrmsr
|
||||
jmp .Lread_apicid_msr
|
||||
#endif
|
||||
|
||||
.Lread_apicid_mmio:
|
||||
/* Read the APIC ID from the fix-mapped MMIO space. */
|
||||
movq apic_mmio_base(%rip), %rcx
|
||||
addq $APIC_ID, %rcx
|
||||
|
Loading…
x
Reference in New Issue
Block a user