public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch V3 00/30] x86/microcode: Cleanup and late loading enhancements
@ 2023-09-12  7:57 Thomas Gleixner
  2023-09-12  7:57 ` [patch V3 01/30] x86/microcode/32: Move early loading after paging enable Thomas Gleixner
                   ` (31 more replies)
  0 siblings, 32 replies; 71+ messages in thread
From: Thomas Gleixner @ 2023-09-12  7:57 UTC (permalink / raw)
  To: LKML; +Cc: x86, Borislav Petkov, Chang S. Bae, Arjan van de Ven,
	Nikolay Borisov

This is a follow up on:

  https://lore.kernel.org/lkml/20230812194003.682298127@linutronix.de

Late microcode loading is desired by enterprise users. Late loading is
problematic as it requires detailed knowledge about the change and an
analysis whether this change modifies something which is already in use by
the kernel. Large enterprise customers have engineering teams and access to
deep technical vendor support. The regular admin does not have such
resources, so the kernel has always tainted the kernel after late loading.

Intel recently added a new previously reserved field to the microcode
header which contains the minimal microcode revision which must be running
on the CPU to make the load safe. This field is 0 in all older microcode
revisions, which the kernel assumes to be unsafe. Minimal revision checking
can be enforced via Kconfig or kernel command line. It then refuses to load
an unsafe revision. The default loads unsafe revisions like before and
taints the kernel. If a safe revision is loaded the kernel is not tainted.

But that does not solve all other known problems with late loading:

    - Late loading on current Intel CPUs is unsafe vs. NMI when
      hyperthreading is enabled. If a NMI hits the secondary sibling while
      the primary loads the microcode, the machine can crash.

    - Soft offline SMT siblings which are playing dead with MWAIT can cause
      damage too when the microcode update modifies MWAIT. That's a
      realistic scenario in the context of 'nosmt' mitigations. :(

Neither the core code nor the Intel specific code handles any of this at all.

While trying to implement this, I stumbled over disfunctional, horribly
complex and redundant code, which I decided to clean up first so the new
functionality can be added on a clean slate.

So the series has several sections:

   1) Move the 32bit early loading after paging enable

   2) Cleanup of the Intel specific code

   3) Implementation of proper core control logic to handle the NMI safe
      requirements

   4) Support for minimal revision check in the core and the Intel specific
      parts.

Changes vs. V2:

  - Rebased on v6.5-rc1

  - Removed the 32bit oddity of invoking the microcode loader before
    paging is enabled.

  - Some minor improvements.

The series is also available from git:

   git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git ucode-v3

Thanks,

	tglx
---
 Documentation/admin-guide/kernel-parameters.txt |    5 
 arch/x86/Kconfig                                |   25 
 arch/x86/include/asm/apic.h                     |    5 
 arch/x86/include/asm/cpu.h                      |   20 
 arch/x86/include/asm/microcode.h                |   16 
 arch/x86/kernel/Makefile                        |    1 
 arch/x86/kernel/apic/apic_flat_64.c             |    2 
 arch/x86/kernel/apic/ipi.c                      |    8 
 arch/x86/kernel/apic/x2apic_cluster.c           |    1 
 arch/x86/kernel/apic/x2apic_phys.c              |    1 
 arch/x86/kernel/cpu/common.c                    |   12 
 arch/x86/kernel/cpu/microcode/amd.c             |   57 --
 arch/x86/kernel/cpu/microcode/core.c            |  643 +++++++++++++++--------
 arch/x86/kernel/cpu/microcode/intel.c           |  659 ++++++------------------
 arch/x86/kernel/cpu/microcode/internal.h        |   32 -
 arch/x86/kernel/head32.c                        |    6 
 arch/x86/kernel/head_32.S                       |   10 
 arch/x86/kernel/nmi.c                           |    9 
 arch/x86/kernel/smpboot.c                       |   12 
 drivers/platform/x86/intel/ifs/load.c           |    8 
 include/linux/cpuhotplug.h                      |    1 
 21 files changed, 740 insertions(+), 793 deletions(-)


^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2023-10-03 14:24 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-12  7:57 [patch V3 00/30] x86/microcode: Cleanup and late loading enhancements Thomas Gleixner
2023-09-12  7:57 ` [patch V3 01/30] x86/microcode/32: Move early loading after paging enable Thomas Gleixner
2023-09-13 15:06   ` Borislav Petkov
2023-09-16  9:03   ` Chang S. Bae
2023-09-17 19:17     ` Thomas Gleixner
2023-09-19 14:54       ` [patch V3a " Thomas Gleixner
2023-09-12  7:57 ` [patch V3 02/30] x86/boot/32: Disable stackprotector and tracing for mk_early_pgtbl_32() Thomas Gleixner
2023-09-18 17:12   ` Borislav Petkov
2023-09-12  7:57 ` [patch V3 03/30] x86/microcode/intel: Rip out mixed stepping support for Intel CPUs Thomas Gleixner
2023-09-25 15:19   ` Qiuxu Zhuo
2023-09-12  7:57 ` [patch V3 04/30] x86/microcode/intel: Simplify scan_microcode() Thomas Gleixner
2023-09-19 12:52   ` Borislav Petkov
2023-09-12  7:57 ` [patch V3 05/30] x86/microcode/intel: Simplify and rename generic_load_microcode() Thomas Gleixner
2023-09-12  7:57 ` [patch V3 06/30] x86/microcode/intel: Cleanup code further Thomas Gleixner
2023-09-19 14:13   ` Borislav Petkov
2023-09-12  7:57 ` [patch V3 07/30] x86/microcode/intel: Simplify early loading Thomas Gleixner
2023-09-19 14:32   ` Borislav Petkov
2023-09-19 14:57     ` Thomas Gleixner
2023-09-19 17:35       ` Thomas Gleixner
2023-09-12  7:57 ` [patch V3 08/30] x86/microcode/intel: Save the microcode only after a successful late-load Thomas Gleixner
2023-09-20 14:39   ` Borislav Petkov
2023-09-25 15:30   ` Subject: " Qiuxu Zhuo
2023-09-12  7:57 ` [patch V3 09/30] x86/microcode/intel: Switch to kvmalloc() Thomas Gleixner
2023-09-25 15:43   ` Subject: " Qiuxu Zhuo
2023-09-12  7:57 ` [patch V3 10/30] x86/microcode/intel: Unify microcode apply() functions Thomas Gleixner
2023-09-21 10:07   ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 11/30] x86/microcode/intel: Rework intel_cpu_collect_info() Thomas Gleixner
2023-09-12  7:58 ` [patch V3 12/30] x86/microcode/intel: Reuse intel_cpu_collect_info() Thomas Gleixner
2023-09-21 10:42   ` Borislav Petkov
2023-09-25 10:47     ` Thomas Gleixner
2023-10-03 14:14       ` Borislav Petkov
2023-10-03 14:23         ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 13/30] x86/microcode/intel: Rework intel_find_matching_signature() Thomas Gleixner
2023-09-12  7:58 ` [patch V3 14/30] x86/microcode/amd: Read revision from hardware in collect_cpu_info_amd() Thomas Gleixner
2023-09-12  7:58 ` [patch V3 15/30] x86/microcode: Remove pointless apply() invocation Thomas Gleixner
2023-09-12  7:58 ` [patch V3 16/30] x86/microcode: Get rid of the schedule work indirection Thomas Gleixner
2023-09-12  7:58 ` [patch V3 17/30] x86/microcode: Clean up mc_cpu_down_prep() Thomas Gleixner
2023-09-12  7:58 ` [patch V3 18/30] x86/microcode: Handle "nosmt" correctly Thomas Gleixner
2023-09-22 13:42   ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 19/30] x86/microcode: Clarify the late load logic Thomas Gleixner
2023-09-22 15:59   ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 20/30] x86/microcode: Sanitize __wait_for_cpus() Thomas Gleixner
2023-09-22 16:24   ` Borislav Petkov
2023-09-26  8:51     ` Thomas Gleixner
2023-09-27  7:56       ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 21/30] x86/microcode: Add per CPU result state Thomas Gleixner
2023-09-24  6:29   ` Borislav Petkov
2023-09-26  9:09     ` Thomas Gleixner
2023-09-27 11:28       ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 22/30] x86/microcode: Add per CPU control field Thomas Gleixner
2023-09-24  6:47   ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 23/30] x86/microcode: Provide new control functions Thomas Gleixner
2023-09-24  6:58   ` Borislav Petkov
2023-09-26  9:42     ` Thomas Gleixner
2023-09-27 11:50       ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 24/30] x86/microcode: Replace the all in one rendevouz handler Thomas Gleixner
2023-09-27 16:47   ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 25/30] x86/microcode: Rendezvous and load in NMI Thomas Gleixner
2023-09-27 17:17   ` Borislav Petkov
2023-09-28  9:33     ` Thomas Gleixner
2023-09-12  7:58 ` [patch V3 26/30] x86/microcode: Protect against instrumentation Thomas Gleixner
2023-09-28 10:52   ` Borislav Petkov
2023-09-12  7:58 ` [patch V3 27/30] x86/apic: Provide apic_force_nmi_on_cpu() Thomas Gleixner
2023-09-12  7:58 ` [patch V3 28/30] x86/microcode: Handle "offline" CPUs correctly Thomas Gleixner
2023-09-12  7:58 ` [patch V3 29/30] x86/microcode: Prepare for minimal revision check Thomas Gleixner
2023-09-28 11:47   ` Borislav Petkov
2023-10-02  9:42     ` Thomas Gleixner
2023-09-12  7:58 ` [patch V3 30/30] x86/microcode/intel: Add a minimum required revision for late-loads Thomas Gleixner
2023-09-25 16:20   ` Qiuxu Zhuo
2023-09-25 17:02 ` [patch V3 00/30] x86/microcode: Cleanup and late loading enhancements Qiuxu Zhuo
2023-09-28 12:00 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox