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

Re: [Xen-devel] [PATCH 2/2] microcode: Check whether the microcode is correct.



On 25/09/13 13:57, Konrad Rzeszutek Wilk wrote:
> We do the microcode code update in two steps - the presmp:
>  'microcode_presmp_init' and when CPUs are brought up:
> 'microcode_init'. The earlier performs the microcode update
> on the BSP - but unfortunately it does not check whether the
> update failed. Which means that we might try later to update
> a incorrect payload on the rest of CPUs.
>
> This patch handles this odd situation.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

While not strictly relevant to this patch, I simply noticed when
reviewing it that ucode_blob is __initdata.  Given the comment "The
cached microcode patch is applied when CPUs resume from a sleep state."
in the previous patch, what is the policy for reloading microcode after
deep sleep / cpu hotplug ?

> [v2: Redid it as we are not doing scan and <index> at the same time]
> ---
>  xen/arch/x86/microcode.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c
> index 8136d44..0bc95e6 100644
> --- a/xen/arch/x86/microcode.c
> +++ b/xen/arch/x86/microcode.c
> @@ -419,6 +419,7 @@ static int __init microcode_presmp_init(void)
>          {
>              void *data;
>              size_t len;
> +            int rc = 0;
>  
>              if ( ucode_blob.size )
>              {
> @@ -431,10 +432,23 @@ static int __init microcode_presmp_init(void)
>                  data = ucode_mod_map(&ucode_mod);
>              }
>              if ( data )
> -                microcode_update_cpu(data, len);
> +                rc = microcode_update_cpu(data, len);
> +            else
> +                rc = -ENOMEM;
>  
>              if ( !ucode_blob.size )
>                  ucode_mod_map(NULL);
> +
> +            if ( rc )
> +            {
> +                if ( ucode_blob.size )
> +                {
> +                    xfree(ucode_blob.data);
> +                    ucode_blob.size = 0;
> +                    ucode_blob.data = NULL;
> +                } else
> +                    ucode_mod.mod_end = 0;
> +            }
>          }
>  
>          register_cpu_notifier(&microcode_percpu_nfb);


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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