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

Re: [Xen-devel] [PATCH v11 4/7] x86/microcode: Synchronize late microcode loading



On 26.09.2019 15:53, Chao Gao wrote:
> @@ -264,40 +336,150 @@ static int microcode_update_cpu(const struct 
> microcode_patch *patch)
>      return err;
>  }
>  
> -static long do_microcode_update(void *patch)
> +static bool wait_for_state(typeof(loading_state) state)
>  {
> -    unsigned int cpu;
> -    int ret = microcode_update_cpu(patch);
> +    typeof(loading_state) cur_state;
>  
> -    /* Store the patch after a successful loading */
> -    if ( !ret && patch )
> +    while ( (cur_state = ACCESS_ONCE(loading_state)) != state )

With ACCESS_ONCE() used here, I think ...

>      {
> -        spin_lock(&microcode_mutex);
> -        microcode_update_cache(patch);
> -        spin_unlock(&microcode_mutex);
> -        patch = NULL;
> +        if ( cur_state == LOADING_EXIT )
> +            return false;
> +        cpu_relax();
>      }
>  
> -    if ( microcode_ops->end_update_percpu )
> -        microcode_ops->end_update_percpu();
> +    return true;
> +}
> +
> +static void set_state(unsigned int state)
> +{
> +    loading_state = state;
> +    smp_wmb();

... it also wants to be used here (instead of the explicit barrier).
With this (which I'd be fine to be adjusted while committing)
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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