On 1/23/19 15:45, Jan Beulich wrote:
>>>> On 23.01.19 at 14:44, <julien.gr...@arm.com> wrote:
>> On 23/01/2019 13:39, Jan Beulich wrote:
>>>>>> On 23.01.19 at 14:24, <julien.gr...@arm.com> wrote:
>>>> On 23/01/2019 11:51, Norbert Manthey wrote:
>>>>> --- a/xen/include/xen/nospec.h
>>>>> +++ b/xen/include/xen/nospec.h
>>>>> @@ -68,10 +68,18 @@ static inline bool lfence_true(void) { return true; }
>>>>>    #endif
>>>>>    
>>>>>    /*
>>>>> - * protect evaluation of conditional with respect to speculation
>>>>> + * allow to protect evaluation of conditional with respect to 
>>>>> speculation on x86
>>>>>     */
>>>>> -#define evaluate_nospec(condition)                                      \
>>>>> +#if defined(CONFIG_L1TF_LFENCE_NONE) || !defined(CONFIG_X86)
>>>>> +#define evaluate_nospec(condition) (condition)
>>>>> +#elif defined(CONFIG_L1TF_LFENCE_BOTH)
>>>>> +#define evaluate_nospec(condition)                                       
>>>>>   \
>>>>>        (((condition) && lfence_true()) || !lfence_true())
>>>>> +#elif defined(CONFIG_L1TF_LFENCE_TRUE)
>>>>> +#define evaluate_nospec(condition) ((condition) && lfence_true())
>>>>> +#elif defined(CONFIG_L1TF_LFENCE_INTERMEDIATE)
>>>>> +#define evaluate_nospec(condition) ({ bool res = (condition); rmb(); 
>>>>> res; })
>>>> +#endif
>>>>
>>>> None of the configs are defined on Arm, so can this be moved in arch-x86?
>>> To be honest I'd like to avoid introducing asm/nospec.h for the time
>>> being.
>> How about adding them in system.h as we did for array_index_mask_nospec?
> To tell you the truth, that's where Norbert had it originally.
> I think that's not the right place though (also for
> array_index_mask_nospec()). But I'll listen to a majority
> thinking differently, at least as far as what is currently
> lfence_true() goes. evaluate_nospec(), otoh, belongs where
> it is now, I think.

I will rename the lfence_true macro into "arch_barrier_nospec_true".
Furthermore, I will merge the introduction of the macros with the
introduction of the configuration and the alternative patching. Finally,
I'll reuse the arch_barrier_nospec_true implementation in the
evaluate_nospec macro.

Best,
Norbert

>
> Jan
>
>



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B

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

Reply via email to