x86/microcode: support for microcode update in Xen dom0
Subsystems (3)
cover x86/microcode: support for microcode update in Xen dom0
From: Jeremy Fitzhardinge <[email protected]>
Hi all,
I'm proposing this for the next merge window v3.2.
I originally posted this early this year, and it prompted a debate about what the "proper" way that Linux should do microcode updates, with the general concensus being "earlier", ideally in the bootloader (or in the case of Xen, as the hypervisor boots before starting any domains). However, as far as I know there has been no progress along those lines.
I would like to therefore merge this so that a Linux kernel booting as dom0 under Xen can update the microcode in the same manner as a kernel booting natively. When we work out how boot-time microcode updates can be done, then we'll look at modifying Xen accordingly. In the meantime, we should have a functional parity.
The only change to this code from the previous posting is some patch restructuring so that regardless of how the platform.h ABI header gets merged (since there are some other pending branches containing it), it will be identical and cause no merge headaches.
Quoted 1 line
From original posting:
This series adds a new "Xen" microcode update type, in addition to Intel and AMD.
The Xen hypervisor is responsible for performing the actual microcode update (since only it knows what physical CPUs are in the system and has sufficient privilege to access them), but it requires the dom0 kernel to provide the actual microcode update data.
Xen update mechanism is uniform independent of the CPU type, but the driver must know where to find the data file, which depends on the CPU type. And since the update hypercall updates all CPUs, we only need to execute it once on any CPU - but for simplicity it just runs it only on (V)CPU 0.
Thanks,
J
Jeremy Fitzhardinge (2):
xen: add dom0_op hypercall
xen: add CPU microcode update driver
Yu Ke (1):
xen/acpi: Domain0 acpi parser related platform hypercall
arch/ia64/include/asm/xen/interface.h | 1 + arch/x86/include/asm/microcode.h | 9 + arch/x86/include/asm/xen/hypercall.h | 8 + arch/x86/include/asm/xen/interface.h | 1 + arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_core.c | 5 +- arch/x86/kernel/microcode_xen.c | 198 ++++++++++++++++++++ arch/x86/xen/Kconfig | 4 + include/xen/interface/platform.h | 320 +++++++++++++++++++++++++++++++++ include/xen/interface/xen.h | 1 + 10 files changed, 547 insertions(+), 1 deletions(-) create mode 100644 arch/x86/kernel/microcode_xen.c create mode 100644 include/xen/interface/platform.h
Signature · 1 line
1.7.6.2
PATCH 1/3 xen/acpi: Domain0 acpi parser related platform hypercall
From: Yu Ke <[email protected]>
This patches implements the xen_platform_op hypercall, to pass the parsed ACPI info to hypervisor.
--- arch/ia64/include/asm/xen/interface.h | 1 + arch/x86/include/asm/xen/interface.h | 1 + include/xen/interface/platform.h | 320 +++++++++++++++++++++++++++++++++ include/xen/interface/xen.h | 1 + 4 files changed, 323 insertions(+), 0 deletions(-) create mode 100644 include/xen/interface/platform.h
arch/ia64/include/asm/xen/interface.h +1 -0
@@ -76,6 +76,7 @@ DEFINE_GUEST_HANDLE(char);DEFINE_GUEST_HANDLE (int);DEFINE_GUEST_HANDLE (long);DEFINE_GUEST_HANDLE (void); +DEFINE_GUEST_HANDLE (uint64_t);typedef unsigned long xen_pfn_t ;DEFINE_GUEST_HANDLE (xen_pfn_t);
arch/x86/include/asm/xen/interface.h +1 -0
@@ -55,6 +55,7 @@ DEFINE_GUEST_HANDLE(char);DEFINE_GUEST_HANDLE (int);DEFINE_GUEST_HANDLE (long);DEFINE_GUEST_HANDLE (void); +DEFINE_GUEST_HANDLE (uint64_t);#endif #ifndef HYPERVISOR_VIRT_START
include/xen/interface/platform.h new file +320 -0
320 lines not on this page · raw message
include/xen/interface/xen.h +1 -0
@@ -452,6 +452,7 @@ struct start_info {/* These flags are passed in the 'flags' field of start_info_t. */ #define SIF_PRIVILEGED (1<<0)/* Is the domain privileged? */ #define SIF_INITDOMAIN (1<<1)/* Is this the initial control domain? */ +#define SIF_PM_MASK (0xFF<<8)/* reserve 1 byte for xen-pm options */ typedef uint64_t cpumap_t ;
Signature · 1 line
1.7.6.2
PATCH 2/3 xen: add dom0_op hypercall
In reply to Jeremy FitzhardingeFrom: Jeremy Fitzhardinge <[email protected]>
--- arch/x86/include/asm/xen/hypercall.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/x86/include/asm/xen/hypercall.h +8 -0
@@ -45,6 +45,7 @@#include <xen/interface/xen.h> #include <xen/interface/sched.h> #include <xen/interface/physdev.h> +#include <xen/interface/platform.h> /* * The hypercall asms have to meet several constraints:
@@ -299,6 +300,13 @@ HYPERVISOR_set_timer_op(u64 timeout) }static inline int +HYPERVISOR_dom0_op (struct xen_platform_op *platform_op) +{ + platform_op->interface_version =XENPF_INTERFACE_VERSION ; +return _hypercall1 (int, dom0_op, platform_op); +} + +static inline int HYPERVISOR_set_debugreg (int reg,unsigned long value) {return _hypercall2 (int, set_debugreg, reg, value);
Signature · 1 line
1.7.6.2
PATCH 3/3 xen: add CPU microcode update driver
In reply to Jeremy FitzhardingeFrom: Jeremy Fitzhardinge <[email protected]>
Xen does all the hard work for us, including choosing the right update method for this cpu type and actually doing it for all cpus. We just need to supply it with the firmware blob.
Because Xen updates all CPUs (and the kernel's virtual cpu numbers have no fixed relationship with the underlying physical cpus), we only bother doing anything for cpu "0".
--- arch/x86/include/asm/microcode.h | 9 ++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_core.c | 5 +- arch/x86/kernel/microcode_xen.c | 198 ++++++++++++++++++++++++++++++++++++++ arch/x86/xen/Kconfig | 4 + 5 files changed, 216 insertions(+), 1 deletions(-) create mode 100644 arch/x86/kernel/microcode_xen.c
arch/x86/include/asm/microcode.h +9 -0
@@ -61,4 +61,13 @@ static inline struct microcode_ops * __init init_amd_microcode(void) }#endif +#ifdef CONFIG_MICROCODE_XEN +extern struct microcode_ops *__init init_xen_microcode (void ); +#else +static inline struct microcode_ops *__init init_xen_microcode (void ) +{ +return NULL ; +} +#endif +#endif /* _ASM_X86_MICROCODE_H */
arch/x86/kernel/Makefile +1 -0
@@ -105,6 +105,7 @@ obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o microcode-y := microcode_core.o microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o +microcode-$(CONFIG_MICROCODE_XEN) += microcode_xen.o obj-$(CONFIG_MICROCODE) += microcode.o obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
arch/x86/kernel/microcode_core.c +4 -1
@@ -84,6 +84,7 @@#include <linux/mm.h> #include <linux/syscore_ops.h> +#include <xen/xen.h> #include <asm/microcode.h> #include <asm/processor.h>
@@ -501,7 +502,9 @@ static int __init microcode_init(void)struct cpuinfo_x86 *c = &cpu_data (0 );int error; -if (c->x86_vendor ==X86_VENDOR_INTEL ) +if (xen_pv_domain ()) + microcode_ops =init_xen_microcode (); +else if (c->x86_vendor ==X86_VENDOR_INTEL ) microcode_ops =init_intel_microcode ();else if (c->x86_vendor ==X86_VENDOR_AMD ) microcode_ops =init_amd_microcode ();
arch/x86/kernel/microcode_xen.c new file +198 -0
198 lines not on this page · raw message
arch/x86/xen/Kconfig +4 -0
@@ -57,3 +57,7 @@ config XEN_DEBUG help Enable various WARN_ON checks in the Xen MMU code. Enabling this option WILL incur a significant performance overhead. + +config MICROCODE_XEN + def_bool y + depends on XEN_DOM0 && MICROCODE
Signature · 1 line
1.7.6.2
Ping?
Quoted 64 lines · Jeremy Fitzhardinge
From: Jeremy Fitzhardinge <[email protected]>
Hi all,
I'm proposing this for the next merge window v3.2.
I originally posted this early this year, and it prompted a debate about what the "proper" way that Linux should do microcode updates, with the general concensus being "earlier", ideally in the bootloader (or in the case of Xen, as the hypervisor boots before starting any domains). However, as far as I know there has been no progress along those lines.
I would like to therefore merge this so that a Linux kernel booting as dom0 under Xen can update the microcode in the same manner as a kernel booting natively. When we work out how boot-time microcode updates can be done, then we'll look at modifying Xen accordingly. In the meantime, we should have a functional parity.
The only change to this code from the previous posting is some patch restructuring so that regardless of how the
platform.hABI header gets merged (since there are some other pending branches containing it), it will be identical and cause no merge headaches.From original posting:
This series adds a new "Xen" microcode update type, in addition to Intel and AMD.
The Xen hypervisor is responsible for performing the actual microcode update (since only it knows what physical CPUs are in the system and has sufficient privilege to access them), but it requires the dom0 kernel to provide the actual microcode update data.
Xen update mechanism is uniform independent of the CPU type, but the driver must know where to find the data file, which depends on the CPU type. And since the update hypercall updates all CPUs, we only need to execute it once on any CPU - but for simplicity it just runs it only on (V)CPU 0.
Thanks,
JJeremy Fitzhardinge (2):
xen: adddom0_ophypercall
xen: add CPU microcode update driverYu Ke (1):
xen/acpi: Domain0 acpi parser related platform hypercallarch/ia64/include/asm/xen/interface.h | 1 + arch/x86/include/asm/microcode.h | 9 + arch/x86/include/asm/xen/hypercall.h | 8 + arch/x86/include/asm/xen/interface.h | 1 + arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_core.c | 5 +- arch/x86/kernel/microcode_xen.c | 198 ++++++++++++++++++++ arch/x86/xen/Kconfig | 4 + include/xen/interface/platform.h | 320 +++++++++++++++++++++++++++++++++ include/xen/interface/xen.h | 1 + 10 files changed, 547 insertions(+), 1 deletions(-) create mode 100644 arch/x86/kernel/microcode_xen.c create mode 100644 include/xen/interface/platform.h
Quoted 15 lines · Jeremy Fitzhardinge
Ping?
Quoted 12 lines · Jeremy Fitzhardinge
From: Jeremy Fitzhardinge <[email protected]>
Hi all,
I'm proposing this for the next merge window v3.2.
I originally posted this early this year, and it prompted a debate about what the "proper" way that Linux should do microcode updates, with the general concensus being "earlier", ideally in the bootloader (or in the case of Xen, as the hypervisor boots before starting any domains). However, as far as I know there has been no progress along those lines.
Err,
wait a sec, last time the suggestion was that _because_ xen supports the multiboot protocol, implementing an early solution would be even easier for you:
http://marc.info/?l=linux-kernel&m=129667641316947&w=2
Why would a xen microcode solution would even be contingent on how upstream Linux solves it (and when)?
AFAICT, you want to hand off the microcode image from the bootloader to the hypervisor and update ucode there - no need for dom0 changes...
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
Quoted 22 lines · Borislav Petkov
Quoted 15 lines · Jeremy Fitzhardinge
Ping?
Quoted 12 lines · Jeremy Fitzhardinge
From: Jeremy Fitzhardinge <[email protected]>
Hi all,
I'm proposing this for the next merge window v3.2.
I originally posted this early this year, and it prompted a debate about what the "proper" way that Linux should do microcode updates, with the general concensus being "earlier", ideally in the bootloader (or in the case of Xen, as the hypervisor boots before starting any domains). However, as far as I know there has been no progress along those lines.
Err,
wait a sec, last time the suggestion was that _because_ xen supports the multiboot protocol, implementing an early solution would be even easier for you:
Quoted 7 lines
http://marc.info/?l=linux-kernel&m=129667641316947&w=2
Why would a xen microcode solution would even be contingent on how upstream Linux solves it (and when)?
AFAICT, you want to hand off the microcode image from the bootloader to the hypervisor and update ucode there - no need for dom0 changes...
I don't want a Xen-specific solution to this. If Linux overall moves to a boot-time microcode loading scheme, then I'm happy to support it. But in the meantime, I want a Xen system to Just Work in the same manner as a non-Xen one, without requiring special support from all the distros.
J
H. Peter Anvin
reviewerQuoted 4 lines · Borislav Petkov
Why would a xen microcode solution would even be contingent on how upstream Linux solves it (and when)?
Agreed... especially since Xen is "special" when it comes to booting anyway.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Quoted 5 lines · H. Peter Anvin
Quoted 3 lines · Borislav Petkov
Why would a xen microcode solution would even be contingent on how upstream Linux solves it (and when)?
Agreed... especially since Xen is "special" when it comes to booting anyway.
"Special" only in the sense that you need a new line in grub.
But doing boot-time microcode is a lot more "special" since it would require distros to move the microcode files to /boot. That would either mean having two sets of microcode packages, or also changing the way that Linux does its microcode loading (if only by changing the paths, but I have no idea what that implies since its all tied up with the rest of the firmware loading stuff).
The whole thrust of the Xen upstreaming work has been to minimize the amount of arbitrary "specialness" so that its as easy as possibly for people and distros to deploy and use Xen.
With respect to microcode loading, this patch means that users and distros just don't need to worry about microcode any more. It packages and operates exactly like it would for native Linux, which is exactly how we like it.
While doing the whole boot time multiboot thing may offer some small hypothetical technical advantages, it has the significant cost of just complicating the whole deployment and use story.
If there were a general shift to "this is how we're going to do microcode in the future", then Xen will happily go along for the ride. But for right now, this patch seems like the pragmatic solution.
I think the real question is where there's something objectionable about the patch itself?
Thanks,
J
Quoted 3 lines · Jeremy Fitzhardinge
While doing the whole boot time multiboot thing may offer some small hypothetical technical advantages, it has the significant cost of just complicating the whole deployment and use story.
You simply can't call the need to apply ucode as early as possible a "hypothetical techical advantage." Other issues like how to handle ucode images and how to put them together and how distros distribute them and whether xen minimizes the amount of "specialness" or not are only secondary.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
Quoted 10 lines · Borislav Petkov
Quoted 3 lines · Jeremy Fitzhardinge
While doing the whole boot time multiboot thing may offer some small hypothetical technical advantages, it has the significant cost of just complicating the whole deployment and use story.
You simply can't call the need to apply ucode as early as possible a "hypothetical techical advantage." Other issues like how to handle ucode images and how to put them together and how distros distribute them and whether xen minimizes the amount of "specialness" or not are only secondary.
Why is it paramount to do it as early as possible? As in, even doing it before Linux kernel is invoked is preferred than during initrd runtime?
H. Peter Anvin
reviewerQuoted 2 lines · Konrad Rzeszutek Wilk
Why is it paramount to do it as early as possible? As in, even doing it before Linux kernel is invoked is preferred than during initrd runtime?
It is paramount to do it as early as possible *because the CPU is broken*. That's why there is a microcode update at all. It is *supposed* to be installed by BIOS, but for whatever reason it wasn't (including user doesn't want to update the BIOS), so the very fact that this is done in the OS at all is a bit of a fail.
Doing it in the bootloader is messy because bootloaders typically aren't SMP-aware (and really shouldn't need to be), which leaves the OS. On native hardware it should ideally be done as early in the processor bringup as possible.
-hpa
Quoted 9 lines · H. Peter Anvin
Quoted 2 lines · Konrad Rzeszutek Wilk
Why is it paramount to do it as early as possible? As in, even doing it before Linux kernel is invoked is preferred than during initrd runtime?
It is paramount to do it as early as possible *because the CPU is broken*. That's why there is a microcode update at all. It is *supposed* to be installed by BIOS, but for whatever reason it wasn't (including user doesn't want to update the BIOS), so the very fact that this is done in the OS at all is a bit of a fail.
Oh, that's easy: you know how OEMs support a platform for a while and then move on to something new and stop updating BIOSen, including ucode images contained in them?
Well, in that case, the OS is the last possible place where we want to be able to apply the ucode. And, we want to apply it as _early_ _as_ _possible_. Bootloader doesn't cut it as hpa says below, so next comes SMP cores bootup code. That's it.
Quoted 4 lines
Doing it in the bootloader is messy because bootloaders typically aren't SMP-aware (and really shouldn't need to be), which leaves the OS. On native hardware it should ideally be done as early in the processor bringup as possible.
Yep.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
H. Peter Anvin
reviewerThe stickiest part of all of this is where to leave the microcode so the kernel can get to it way early. We could use the linked list, but that would mean bootloader enabling; another idea was to stick it as a prefix to the initramfs identified by a signature.
-hpa
Quoted 4 lines · H. Peter Anvin
The stickiest part of all of this is where to leave the microcode so the kernel can get to it way early. We could use the linked list, but that would mean bootloader enabling; another idea was to stick it as a prefix to the initramfs identified by a signature.
I think it would be easiest for the multiboot case if it were a separate file, but I don't feel I'm really up on all the details.
J
H. Peter Anvin
reviewerQuoted 8 lines · Jeremy Fitzhardinge
Quoted 4 lines · H. Peter Anvin
The stickiest part of all of this is where to leave the microcode so the kernel can get to it way early. We could use the linked list, but that would mean bootloader enabling; another idea was to stick it as a prefix to the initramfs identified by a signature.
I think it would be easiest for the multiboot case if it were a separate file, but I don't feel I'm really up on all the details.
For the multiboot case, yes of course.
Some bootloaders allow initramfs to be concatenated from multiple files; unfortunately I'm not sure if Grub ever grew that capability. Sigh.
-hpa
Quoted 7 lines · H. Peter Anvin
Quoted 6 lines · Jeremy Fitzhardinge
Quoted 4 lines · H. Peter Anvin
The stickiest part of all of this is where to leave the microcode so the kernel can get to it way early. We could use the linked list, but that would mean bootloader enabling; another idea was to stick it as a prefix to the initramfs identified by a signature.
Quoted 8 lines
Quoted 2 lines
I think it would be easiest for the multiboot case if it were a separate file, but I don't feel I'm really up on all the details.
For the multiboot case, yes of course.
Some bootloaders allow initramfs to be concatenated from multiple files; unfortunately I'm not sure if Grub ever grew that capability. Sigh.
Presumably we'd want some way to make all possible microcode files available to the hypervisor/kernel so that there's no need to construct the bootloader config for a specific CPU vendor (or worse, CPU model). So that would need either some way of specifying multiple files, or a wrapper which can contain multiple files?
J
H. Peter Anvin
reviewerQuoted 7 lines · Jeremy Fitzhardinge
Presumably we'd want some way to make all possible microcode files available to the hypervisor/kernel so that there's no need to construct the bootloader config for a specific CPU vendor (or worse, CPU model). So that would need either some way of specifying multiple files, or a wrapper which can contain multiple files?
I have been thinking a "bundle" format with a per-vendor header followed by the microcode in the appropriate format for each vendor.
-hpa
Quoted 11 lines · H. Peter Anvin
Quoted 7 lines · Jeremy Fitzhardinge
Presumably we'd want some way to make all possible microcode files available to the hypervisor/kernel so that there's no need to construct the bootloader config for a specific CPU vendor (or worse, CPU model). So that would need either some way of specifying multiple files, or a wrapper which can contain multiple files?
I have been thinking a "bundle" format with a per-vendor header followed by the microcode in the appropriate format for each vendor.
Yes, makes sense. Keep it as simple as possible.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
Am 13.10.2011 09:00, schrieb Borislav Petkov:
Quoted 10 lines · H. Peter Anvin
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 7 lines
Presumably we'd want some way to make all possible microcode files available to the hypervisor/kernel so that there's no need to construct the bootloader config for a specific CPU vendor (or worse, CPU model). So that would need either some way of specifying multiple files, or a wrapper which can contain multiple files?
Quoted 4 lines
Quoted 2 lines
I have been thinking a "bundle" format with a per-vendor header followed by the microcode in the appropriate format for each vendor.
Yes, makes sense. Keep it as simple as possible.
For the majority of the past 10 years, the microcode has been shipped as one big file (at least for intel).
So have you looked at the file format of the bundles that already exist?
Quoted 3 lines · H. Peter Anvin
The stickiest part of all of this is where to leave the microcode so the kernel can get to it way early. We could use the linked list, but that would mean bootloader enabling;
Yep, started looking at that and it means grub legacy and grub2 enabling at least.
Quoted 2 lines
another idea was to stick it as a prefix
to the initramfs identified by a signature.
https://bugzilla.redhat.com/show_bug.cgi?id=179127
with the patch there you can do
initrd /initramfs-image1.gz /initramfs-image2.gz
which is exactly what we want.
Bottomline is, extending initrd handling to deal with multiple initrd images might turn out to be easier to do than the linked list deal.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
Quoted 2 lines · Borislav Petkov
Bottomline is, extending initrd handling to deal with multiple initrd images might turn out to be easier to do than the linked list deal.
Alternatively and IMHO, we could avoid the bootloader enabling by making the ucode part of the initramfs and pull up some of the prepare_namespace() work in kernel_init() before smp_init() so that we can have it ready for when bootstrapping the cores.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
H. Peter Anvin
reviewerQuoted 9 lines · Borislav Petkov
Quoted 2 lines · Borislav Petkov
Bottomline is, extending initrd handling to deal with multiple initrd images might turn out to be easier to do than the linked list deal.
Alternatively and IMHO, we could avoid the bootloader enabling by making the ucode part of the initramfs and pull up some of the
prepare_namespace()work inkernel_init()beforesmp_init()so that we can have it ready for when bootstrapping the cores.
I think that is really ugly, and it also makes it much harder to get the microcode patch in early on the BSP. There are enough issues where we would like to get the microcode in early even on the BSP.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Quoted 8 lines · Borislav Petkov
Quoted 2 lines · Borislav Petkov
Bottomline is, extending initrd handling to deal with multiple initrd images might turn out to be easier to do than the linked list deal.
Alternatively and IMHO, we could avoid the bootloader enabling by making the ucode part of the initramfs and pull up some of the
prepare_namespace()work inkernel_init()beforesmp_init()so that we can have it ready for when bootstrapping the cores.
<scratches his head>
You are still using the microcode API (the existing one) to program the CPUs right? It is just that you are fetching the images much much earlier than it currently is done?
H. Peter Anvin
reviewerQuoted 6 lines · Konrad Rzeszutek Wilk
<scratches his head>
You are still using the microcode API (the existing one) to program the CPUs right? It is just that you are fetching the images much much earlier than it currently is done?
No, the goal is to ditch the existing API and load the CPUs very early in the start path.
-hpa
Quoted 9 lines · H. Peter Anvin
Quoted 5 lines · Konrad Rzeszutek Wilk
<scratches his head>
You are still using the microcode API (the existing one) to program the CPUs right? It is just that you are fetching the images much much earlier than it currently is done?No, the goal is to ditch the existing API and load the CPUs very early in the start path.
And how do we apply new microcode at runtime? A new API?
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Quoted 8 lines · H. Peter Anvin
Quoted 6 lines · Konrad Rzeszutek Wilk
<scratches his head>
You are still using the microcode API (the existing one) to program the CPUs right? It is just that you are fetching the images much much earlier than it currently is done?
Quoted 4 lines
No, the goal is to ditch the existing API and load the CPUs very early in the start path.
-hpa
I think this approach is good to get the microcode applied as early as possible at boot time. But on servers you usually do not want to reboot the machine unless you do a BIOS update which will apply the new microcode anyway. So for applying the microcode update at runtime I would like to keep the existing API.
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Quoted 5 lines · Christoph Egger
I think this approach is good to get the microcode applied as early as possible at boot time. But on servers you usually do not want to reboot the machine unless you do a BIOS update which will apply the new microcode anyway. So for applying the microcode update at runtime I would like to keep the existing API.
No, you don't want to keep the existing API and you know it. I've explained to you last week why.
Signature · 5 lines
Regards/Gruss, Boris. Operating Systems Research Center Advanced Micro Devices, Inc.
Quoted 10 lines · Borislav Petkov
Quoted 5 lines · Christoph Egger
I think this approach is good to get the microcode applied as early as possible at boot time. But on servers you usually do not want to reboot the machine unless you do a BIOS update which will apply the new microcode anyway. So for applying the microcode update at runtime I would like to keep the existing API.
No, you don't want to keep the existing API and you know it. I've explained to you last week why.
By "existing API" I mean the xen hypercall. Sorry for the confusion.
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
A message that is not in the archive (sent off-list or not yet received): [email protected]
Borislav Petkov writes ("Re: [Xen-devel] Re: [PATCH 0/3] x86/microcode: support for microcode update in Xen dom0"):
Quoted 2 lines
No, you don't want to keep the existing API and you know it. I've explained to you last week why.
So should I submit a patchset to remove the existing post-boot microcode loading from Linux ?
Ian.
Quoted 6 lines · Borislav Petkov
Quoted 3 lines · Jeremy Fitzhardinge
While doing the whole boot time multiboot thing may offer some small hypothetical technical advantages, it has the significant cost of just complicating the whole deployment and use story.
You simply can't call the need to apply ucode as early as possible a "hypothetical techical advantage."
The current scheme has worked pretty well so far; there doesn't seem to be a huge concern about it. Have there been actual observed failures with the current mechanism, or is the drive to make it earlier driven by an aesthetic desire to make it "as it should be"?
Quoted 4 lines
Other issues like how to handle ucode
images and how to put them together and how distros distribute them and whether xen minimizes the amount of "specialness" or not are only secondary.
No, they're not. If users end up with a broken setup then they get no microcode updates at all, which makes everything else moot. It has to be deployed correctly for it to be worth anything at all.
What is secondary, or rather, completely irrelevant is whether Xen is involved or not.
J
H. Peter Anvin
reviewerQuoted 6 lines · Jeremy Fitzhardinge
The current scheme has worked pretty well so far; there doesn't seem to be a huge concern about it. Have there been actual observed failures with the current mechanism, or is the drive to make it earlier driven by an aesthetic desire to make it "as it should be"?
Yes, there has. There is at least one case where we have to print an error message saying "update your BIOS" because our current microcode update is too late.
-hpa
Quoted 11 lines · H. Peter Anvin
Quoted 6 lines · Jeremy Fitzhardinge
The current scheme has worked pretty well so far; there doesn't seem to be a huge concern about it. Have there been actual observed failures with the current mechanism, or is the drive to make it earlier driven by an aesthetic desire to make it "as it should be"?
Yes, there has. There is at least one case where we have to print an error message saying "update your BIOS" because our current microcode update is too late.
Is that K8 errata 93 or something else?
J
H. Peter Anvin
reviewerQuoted 7 lines · Jeremy Fitzhardinge
Quoted 4 lines
Yes, there has. There is at least one case where we have to print an error message saying "update your BIOS" because our current microcode update is too late.
Is that K8 errata 93 or something else?
The one I'm thinking about is an Atom erratum, but it's entirely possible there are others.
-hpa
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 8 lines · H. Peter Anvin
Quoted 6 lines · Jeremy Fitzhardinge
The current scheme has worked pretty well so far; there doesn't seem to be a huge concern about it. Have there been actual observed failures with the current mechanism, or is the drive to make it earlier driven by an aesthetic desire to make it "as it should be"?
Quoted 5 lines
Quoted 3 lines
Yes, there has. There is at least one case where we have to print an error message saying "update your BIOS" because our current microcode update is too late.
Is that K8 errata 93 or something else?
AFAIR, that was an Atom erratum fix.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
H. Peter Anvin
reviewerQuoted 2 lines · Jeremy Fitzhardinge
If there were a general shift to "this is how we're going to do microcode in the future", then Xen will happily go along for the ride.
It *is* how we want to do microcode in the future. There is a prototype for the Intel hardware side here; we just haven't had time to finalize it partly because I got pulled onto the kernel.org situation.
Quoted 1 line
But for right now, this patch seems like the pragmatic solution.
No.
Quoted 2 lines
I think the real question is where there's something objectionable about the patch itself?
"It does something that is slightly broken on real hardware and totally broken for a hypervisor and perpetuates it, while still needing enabling?"
-hpa
Quoted 7 lines · H. Peter Anvin
Quoted 2 lines · Jeremy Fitzhardinge
If there were a general shift to "this is how we're going to do microcode in the future", then Xen will happily go along for the ride.
It *is* how we want to do microcode in the future. There is a prototype for the Intel hardware side here; we just haven't had time to finalize it partly because I got pulled onto the kernel.org situation.
OK, great! Has there been any public discussion about this?
J
H. Peter Anvin
reviewerQuoted 7 lines · Jeremy Fitzhardinge
Quoted 4 lines
It *is* how we want to do microcode in the future. There is a prototype for the Intel hardware side here; we just haven't had time to finalize it partly because I got pulled onto the kernel.org situation.
OK, great! Has there been any public discussion about this?
I don't remember.
-hpa
A message that is not in the archive (sent off-list or not yet received): [email protected]
H. Peter Anvin writes ("[Xen-devel] Re: [PATCH 0/3] x86/microcode: support for microcode update in Xen dom0"):
Quoted 4 lines · Jeremy Fitzhardinge
Quoted 1 line
But for right now, this patch seems like the pragmatic solution.
No.
This is a quite astonishing response. At the moment, microcode updates in Xen systems are _completely broken_ because they do not happen at all.
The existing machinery in Linux is the way it is and you say it's no good - how about we just remove it all too ? Because that's what you're suggesting is the proper course for Xen!
At the moment, Jeremy's patch is a significant improvement. It is quite unreasonable to block it because some pie-in-the-sky scheme for doing it at boot time does not exist yet.
Either:
(a) Jeremy's patch should go in
(b) all after-boot microcode update code should be removed from Linux
Ian.
(very cross)
After pulling in this change from your tree, I found the following bug, when checking an enum value, which should be considered before inclusion:
(quoted diff) +0 -0
b/arch/x86/kernel/microcode_xen.c
index 9d2a06b..6a73957 100644
arch/x86/kernel/microcode_xen.c +0 -0
@@ -157,7 +157,7 @@ static enum ucode_state xen_request_microcode_user(int
cpu,
ret = UCODE_OK;
out:
- if (ret == 0)
+ if (ret == UCODE_OK)
uci->mc = uc;
else
vfree(uc);
Quoted 65 lines · Jeremy Fitzhardinge
From: Jeremy Fitzhardinge <[email protected]>
Hi all,
I'm proposing this for the next merge window v3.2.
I originally posted this early this year, and it prompted a debate about what the "proper" way that Linux should do microcode updates, with the general concensus being "earlier", ideally in the bootloader (or in the case of Xen, as the hypervisor boots before starting any domains). However, as far as I know there has been no progress along those lines.
I would like to therefore merge this so that a Linux kernel booting as dom0 under Xen can update the microcode in the same manner as a kernel booting natively. When we work out how boot-time microcode updates can be done, then we'll look at modifying Xen accordingly. In the meantime, we should have a functional parity.
The only change to this code from the previous posting is some patch restructuring so that regardless of how the
platform.hABI header gets merged (since there are some other pending branches containing it), it will be identical and cause no merge headaches.Quoted 1 line
From original posting:
This series adds a new "Xen" microcode update type, in addition to Intel and AMD.
The Xen hypervisor is responsible for performing the actual microcode update (since only it knows what physical CPUs are in the system and has sufficient privilege to access them), but it requires the dom0 kernel to provide the actual microcode update data.
Xen update mechanism is uniform independent of the CPU type, but the driver must know where to find the data file, which depends on the CPU type. And since the update hypercall updates all CPUs, we only need to execute it once on any CPU - but for simplicity it just runs it only on (V)CPU 0.
Thanks,
JJeremy Fitzhardinge (2):
xen: adddom0_ophypercall
xen: add CPU microcode update driverYu Ke (1):
xen/acpi: Domain0 acpi parser related platform hypercallarch/ia64/include/asm/xen/interface.h | 1 + arch/x86/include/asm/microcode.h | 9 + arch/x86/include/asm/xen/hypercall.h | 8 + arch/x86/include/asm/xen/interface.h | 1 + arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_core.c | 5 +- arch/x86/kernel/microcode_xen.c | 198 ++++++++++++++++++++ arch/x86/xen/Kconfig | 4 + include/xen/interface/platform.h | 320 +++++++++++++++++++++++++++++++++ include/xen/interface/xen.h | 1 + 10 files changed, 547 insertions(+), 1 deletions(-) create mode 100644 arch/x86/kernel/microcode_xen.c create mode 100644 include/xen/interface/platform.h
Quoted 9 lines
--
1.7.6.2_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 19 lines · Ben Guthro
After pulling in this change from your tree, I found the following bug, when checking an enum value, which should be considered before inclusion:
arch/x86/kernel/microcode_xen.c +1
-1@@ -157,7 +157,7 @@ static enum ucode_state xen_request_microcode_user(int cpu, ret =UCODE_OK ; out: -if (ret ==0 ) +if (ret ==UCODE_OK ) uci->mc = uc;else
Quoted 1 line
vfree(uc);
Thanks!
J