[Xen-devel] [PATCH] x86/ucode: Drop the sanity check for interrupts being disabled

Andrew Cooper posted 1 patch 4 years, 1 month ago
Failed in applying to current master (apply log)
xen/arch/x86/cpu/microcode/amd.c   | 4 ----
xen/arch/x86/cpu/microcode/intel.c | 4 ----
2 files changed, 8 deletions(-)
[Xen-devel] [PATCH] x86/ucode: Drop the sanity check for interrupts being disabled
Posted by Andrew Cooper 4 years, 1 month ago
Of the substantial number of things which can go wrong during microcode load,
this is not one.  Loading occurs entirely within the boundary of a single
WRMSR instruction.  Its certainly not a BUG()-worthy condition.

Xen has legitimate reasons to not want interrupts enabled at this point, but
that is to do with organising the system rendezvous.  As these are private low
level helpers invoked only from the microcode core logic, forgo the check
entirely.

While dropping system.h, clean up the processor.h include which was an
oversight in the previous header cleanup.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>

An ASSERT() would be one option, but I'd prefer to remove the include.
---
 xen/arch/x86/cpu/microcode/amd.c   | 4 ----
 xen/arch/x86/cpu/microcode/intel.c | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 01854be92c..9fe1a3c941 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,8 +20,6 @@
 
 #include <asm/hvm/svm/svm.h>
 #include <asm/msr.h>
-#include <asm/processor.h>
-#include <asm/system.h>
 
 #include "private.h"
 
@@ -237,8 +235,6 @@ static int apply_microcode(const struct microcode_patch *patch)
 
     hdr = patch->mpb;
 
-    BUG_ON(local_irq_is_enabled());
-
     hw_err = wrmsr_safe(MSR_AMD_PATCHLOADER, (unsigned long)hdr);
 
     /* get patch id after patching */
diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index bd33f5bc9b..b8b28060f5 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -25,8 +25,6 @@
 #include <xen/init.h>
 
 #include <asm/msr.h>
-#include <asm/processor.h>
-#include <asm/system.h>
 
 #include "private.h"
 
@@ -304,8 +302,6 @@ static int apply_microcode(const struct microcode_patch *patch)
     if ( !match_cpu(patch) )
         return -EINVAL;
 
-    BUG_ON(local_irq_is_enabled());
-
     /* write microcode via MSR 0x79 */
     wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)patch->data);
 
-- 
2.11.0


Re: [Xen-devel] [PATCH] x86/ucode: Drop the sanity check for interrupts being disabled
Posted by Jan Beulich 4 years, 1 month ago
On 27.03.2020 13:19, Andrew Cooper wrote:
> Of the substantial number of things which can go wrong during microcode load,
> this is not one.  Loading occurs entirely within the boundary of a single
> WRMSR instruction.  Its certainly not a BUG()-worthy condition.
> 
> Xen has legitimate reasons to not want interrupts enabled at this point, but
> that is to do with organising the system rendezvous.  As these are private low
> level helpers invoked only from the microcode core logic, forgo the check
> entirely.
> 
> While dropping system.h, clean up the processor.h include which was an
> oversight in the previous header cleanup.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>