[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v7 00/10] improve late microcode loading



Changes in version 7:
 - cache one microcode update rather than a list of it. Assuming that all CPUs
 (including those will be plugged in later) in the system have the same
 signature, one update matches with one CPU should match with others. Thus, one
 update is enough for microcode updating during CPU hot-plug and resuming.
 - To handle load failure, microcode update is cached after it is applied to
 avoid a broken update overriding a validated one. Unvalidated microcode updates
 are passed by arguments rather than another global variable, where this series
 slightly differs from Roger's suggestion in:
 https://lists.xen.org/archives/html/xen-devel/2019-03/msg00776.html
 - incorporate Sergey's patch (patch 10) to fix a bug: we maintain a variable
 to reflect current microcode revision. But in some cases, this variable isn't
 initialized during system boot time, which results in falsely reporting that
 processor is susceptible to some known vulnerabilities.
 - fix issues reported by Sergey:
 https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg00901.html
 - Responses to Sergey/Roger/Wei/Ashok's other comments.

Major changes in version 6:
 - run wbinvd before updating microcode (patch 10)
 - add an userspace tool for late microcode update (patch 1)
 - scale time to wait by the number of remaining CPUs to respond 
 - remove 'cpu' parameters from some related callbacks and functins
 - save an ucode patch only if its supported CPU is allowed to mix with
   current cpu.

Changes in version 5:
 - support parallel microcode updates for all cores (see patch 8)
 - Address Roger's comments on the last version.

The intention of this series is to make the late microcode loading
more reliable by rendezvousing all cpus in stop_machine context.
This idea comes from Ashok. I am porting his linux patch to Xen
(see patch 7 and 8 for more details).

This series includes five changes:
 1. Patch 1: an userspace tool for late microcode update
 2. Patch 2-6: introduce a global microcode cache and some cleanup
 3. Patch 7: writeback and invalidate cache before updating microcode
 3. Patch 8: synchronize late microcode loading
 4. Patch 9: support parallel microcodes update on different cores
 5. Patch 10: always read microcode revision at boot time

Currently, late microcode loading does a lot of things including
parsing microcode blob, checking the signature/revision and performing
update. Putting all of them into stop_machine context is a bad idea
because of complexity (one issue I observed is memory allocation
triggered one assertion in stop_machine context). To simplify the
load process, parsing microcode is moved out of the load process.
Remaining parts of load process is put to stop_machine context.

Regarding changes to AMD side, I didn't do any test for them due to
lack of hardware. Sergey, could you help to test this series on an
AMD machine again?
At least, two basic tests are needed:
* do a microcode update after system bootup
* don't bring all pCPUs up at bootup by specifying maxcpus option in xen
  command line and then do a microcode update and online all offlined
  CPUs via 'xen-hptool'.

Chao Gao (9):
  misc/xen-ucode: Upload a microcode blob to the hypervisor
  microcode/intel: extend microcode_update_match()
  microcode: introduce a global cache of ucode patch
  microcode: remove struct ucode_cpu_info
  microcode: remove pointless 'cpu' parameter
  microcode: split out apply_microcode() from cpu_request_microcode()
  microcode/intel: Writeback and invalidate caches before updating
    microcode
  x86/microcode: Synchronize late microcode loading
  microcode: remove microcode_update_lock

Sergey Dyasli (1):
  x86/microcode: always collect_cpu_info() during boot

 tools/libxc/include/xenctrl.h   |   1 +
 tools/libxc/xc_misc.c           |  23 +++
 tools/misc/Makefile             |   4 +
 tools/misc/xen-ucode.c          |  78 ++++++++
 xen/arch/x86/acpi/power.c       |   2 +-
 xen/arch/x86/apic.c             |   2 +-
 xen/arch/x86/microcode.c        | 401 ++++++++++++++++++++++++++++------------
 xen/arch/x86/microcode_amd.c    | 245 ++++++++++++------------
 xen/arch/x86/microcode_intel.c  | 202 ++++++++++----------
 xen/arch/x86/smpboot.c          |   5 +-
 xen/arch/x86/spec_ctrl.c        |   2 +-
 xen/include/asm-x86/microcode.h |  39 ++--
 xen/include/asm-x86/processor.h |   3 +-
 13 files changed, 639 insertions(+), 368 deletions(-)
 create mode 100644 tools/misc/xen-ucode.c

-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.