[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1806191041390.1692@nanos.tec.linutronix.de>
Date: Tue, 19 Jun 2018 10:47:29 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Fenghua Yu <fenghua.yu@...el.com>
cc: Ingo Molnar <mingo@...hat.com>, H Peter Anvin <hpa@...or.com>,
Ashok Raj <ashok.raj@...el.com>,
Alan Cox <alan@...ux.intel.com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
x86 <x86@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>
Subject: Re: [RFC PATCH 6/8] x86/lib_direct_store.h: Add APIs for direct
store instructions
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
Powered by blists - more mailing lists