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