All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Borislav Petkov <bp@alien8.de>
Cc: Junichi Nomura <j-nomura@ce.jp.nec.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>
Subject: Re: [PATCH 1/2] x86/CPU: Add native CPUID variants returning a single datum
Date: Fri, 30 Dec 2016 18:13:24 -0800	[thread overview]
Message-ID: <CALCETrUcaEyj3sDtEHSseJs5ZuKbX6sz_bskfmDH+WSKWf92qg@mail.gmail.com> (raw)
In-Reply-To: <20161229093012.GA11221@nazgul.tnic>

On Thu, Dec 29, 2016 at 1:30 AM, Borislav Petkov <bp@alien8.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

  reply	other threads:[~2016-12-31  2:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28  4:39 [PATCH] x86: Fix Intel microcode revision detection Junichi Nomura
2016-12-28 11:18 ` Borislav Petkov
2016-12-28 11:20   ` [PATCH 1/2] x86/CPU: Add native CPUID variants returning a single datum Borislav Petkov
2016-12-28 18:11     ` Andy Lutomirski
2016-12-29  9:30       ` Borislav Petkov
2016-12-31  2:13         ` Andy Lutomirski [this message]
2016-12-31 11:09           ` Borislav Petkov
2017-01-03 18:35             ` Andy Lutomirski
2017-01-03 19:48               ` Borislav Petkov
2016-12-28 11:21   ` [PATCH 2/2] x86/microcode: Use native CPUID to tickle out microcode revision Borislav Petkov
2016-12-28 12:53     ` [PATCH 3/2] x86/microcode/intel: Add a helper which gives the " Borislav Petkov
2016-12-28 18:12       ` Andy Lutomirski
2016-12-29  9:36         ` Borislav Petkov
2016-12-28 19:26       ` Boris Ostrovsky
2016-12-29  9:38         ` Borislav Petkov
     [not found]   ` <0a84dd78-809f-c1ef-6adc-551a124170ad@ce.jp.nec.com>
2017-01-05  9:39     ` [PATCH] x86: Fix Intel microcode revision detection Borislav Petkov
2020-04-19 16:29 [PATCH 1/2] x86/CPU: Add native CPUID variants returning a single datum Evalds Iodzevics
2020-04-19 16:54 ` Greg KH
2020-04-20  5:52   ` Evalds Iodzevics
2020-04-20  6:07     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALCETrUcaEyj3sDtEHSseJs5ZuKbX6sz_bskfmDH+WSKWf92qg@mail.gmail.com \
    --to=luto@amacapital.net \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.