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

[xen master] x86/ucode: Don't use microcode_update_cpu() in early_microcode_load()



commit 41314ccee88839374f1a1a995bc7ae313f5ba272
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Nov 6 14:59:33 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Nov 12 19:16:53 2024 +0000

    x86/ucode: Don't use microcode_update_cpu() in early_microcode_load()
    
    There are two callers of microcode_update_cpu(), and because one passes NULL
    and one doesn't, there are effectively two disjoint pieces of logic wrapped 
in
    a single function.
    
    early_microcode_load()'s use skips all the microcode_cache handling, and is
    just a simple patch application.
    
    Use ucode_ops.apply_microcode() directly, and remove the non-cache path from
    microcode_update_cpu().  This skips a redundant collect_cpu_info()
    call (performed in early_microcode_init(), marginally earlier), and avoids
    holding microcode_mutex when we're not interacting with microcode_cache at
    all.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/cpu/microcode/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c 
b/xen/arch/x86/cpu/microcode/core.c
index 11cd878d1f..81a772cb2b 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -277,9 +277,7 @@ static int microcode_update_cpu(const struct 
microcode_patch *patch,
     alternative_vcall(ucode_ops.collect_cpu_info);
 
     spin_lock(&microcode_mutex);
-    if ( patch )
-        err = alternative_call(ucode_ops.apply_microcode, patch, flags);
-    else if ( microcode_cache )
+    if ( microcode_cache )
     {
         err = alternative_call(ucode_ops.apply_microcode, microcode_cache,
                                flags);
@@ -900,7 +898,7 @@ static int __init early_microcode_load(struct boot_info *bi)
      */
     early_mod_idx = idx;
 
-    rc = microcode_update_cpu(patch, 0);
+    rc = ucode_ops.apply_microcode(patch, 0);
 
  unmap:
     bootstrap_unmap();
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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