lkml.org 
[lkml]   [2022]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v6 13/17] x86: use fallback for random_get_entropy() instead of zero
Date
On Mon, Apr 25 2022 at 15:41, Jason A. Donenfeld wrote:
> On Mon, Apr 25, 2022 at 02:35:39PM +0200, Thomas Gleixner wrote:
>> > +static inline unsigned long random_get_entropy(void)
>> > +{
>> > +#ifndef CONFIG_X86_TSC
>> > + if (!cpu_feature_enabled(X86_FEATURE_TSC))
>> > + return random_get_entropy_fallback();
>> > +#endif
>>
>> Please get rid of this ifdeffery. While you are right, that anything
>> with CONFIG_X86_TSC=y should have a TSC, there is virt ....
>>
>> cpu_feature_enabled() is runtime patched and only evaluated before
>> alternative patching, so the win of this ifdef is marginally, if even
>> noticable.
>>
>> We surely can think about making TSC mandatory, but not selectively in a
>> particalur context.
>
> This would be a regression of sorts from the current code, which reads:
>
> static inline cycles_t get_cycles(void)
> {
> #ifndef CONFIG_X86_TSC
> if (!boot_cpu_has(X86_FEATURE_TSC))
> return 0;
> #endif
> return rdtsc();
> }

Bah. Indeed. Misread the patch, but yes, if you are at it to make that
cpu_feature_enabled() then change the config thing to IS_ENABLED() too.

Thanks,

tglx

\
 
 \ /
  Last update: 2022-04-25 19:05    [W:0.151 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site