Re: [RFC PATCH 6/8] x86/lib_direct_store.h: Add APIs for direct store instructions

From: Thomas Gleixner
Date: Tue Jun 19 2018 - 04:47:49 EST


On Fri, 15 Jun 2018, Fenghua Yu wrote:
> +static inline bool movdiri_supported(void)
> +{
> + int eax, ebx, ecx, edx;
> + bool ret;
> +
> + /*
> + * If movdiri has been enumerated before, return cached movdiri
> + * support info.
> + */
> + if (_movdiri_enumerated)
> + return _movdiri_supported;
> +
> + /* Otherwise, enumerate movdiri from CPUID. */
> + asm volatile("mov $7, %%eax\t\n"
> + "mov $0, %%ecx\t\n"
> + "cpuid\t\n"
> + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx));

Why on earth do we need yet another machinery to figure out whether
something is enumerated in CPUID? We have feature bits and the whole set of
functions around it, including those which are run time patched.

Aside of that adding static booleans to every compilation unit which
includes that header file is just broken.

Thanks,

tglx