[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 30 Dec 2016 18:13:24 -0800
From: Andy Lutomirski <luto@...capital.net>
To: Borislav Petkov <bp@...en8.de>
Cc: Junichi Nomura <j-nomura@...jp.nec.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"hpa@...or.com" <hpa@...or.com>
Subject: Re: [PATCH 1/2] x86/CPU: Add native CPUID variants returning a single datum
On Thu, Dec 29, 2016 at 1:30 AM, Borislav Petkov <bp@...en8.de> wrote:
> On Wed, Dec 28, 2016 at 10:11:22AM -0800, Andy Lutomirski wrote:
>> On a very quick read, it looks like none of your new call sites
>> actually use the return value at all. Since you also appear to be
>> consolidating them all, would it make sense to just open-code the
>> single (?) remaining user?
>
> I've got stuff coming up which will use the retval but it is not fully
> cooked yet. And also, we want to have generic helpers so that people do
> not reimplement them left and right.
Okay, but I still think that a variant that says "do cpuid and ignore
the return value" would make sense. Imagine a very clever
implementation of native_cpuid_eax like:
asm ("cpuid" : "=a" (eax) : ...);
return eax;
Now you call it and ignore the return value and the compiler optimizes
it out :) Also, someone reading the code might scratch their head and
wonder why you picked eax and not ebx, ecx, or edx.
--Andy
Powered by blists - more mailing lists