ia64/xen-unstable

changeset 19071:adc3775bb6d8

x86 ucode: optimizing microcode update

It's possible the data file has multiple matching ucode, we needn't to
update multiple times, just keep searching the latest version, and
update once.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 22 11:11:39 2009 +0000 (2009-01-22)
parents a1d0868ffadf
children 9f9ba1a7cc92
files xen/arch/x86/microcode_intel.c
line diff
     1.1 --- a/xen/arch/x86/microcode_intel.c	Thu Jan 22 11:11:10 2009 +0000
     1.2 +++ b/xen/arch/x86/microcode_intel.c	Thu Jan 22 11:11:39 2009 +0000
     1.3 @@ -325,6 +325,7 @@ static int cpu_request_microcode(int cpu
     1.4      long offset = 0;
     1.5      int error = 0;
     1.6      void *mc;
     1.7 +    unsigned int matching_count = 0;
     1.8  
     1.9      /* We should bind the task to the CPU */
    1.10      BUG_ON(cpu != raw_smp_processor_id());
    1.11 @@ -343,7 +344,7 @@ static int cpu_request_microcode(int cpu
    1.12           */
    1.13          if ( error == 1 )
    1.14          {
    1.15 -            apply_microcode(cpu);
    1.16 +            matching_count++;
    1.17              error = 0;
    1.18          }
    1.19          xfree(mc);
    1.20 @@ -353,6 +354,9 @@ static int cpu_request_microcode(int cpu
    1.21      if ( offset < 0 )
    1.22          error = offset;
    1.23  
    1.24 +    if ( !error && matching_count )
    1.25 +        apply_microcode(cpu);
    1.26 +
    1.27      return error;
    1.28  }
    1.29